Skip to content

Commit 7332487

Browse files
committed
update storage/operation/prefix.go and chunk data packs
1 parent 7979348 commit 7332487

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

storage/operation/prefix.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,15 @@ const (
9898
codeTransactionIDByScheduledTransactionID = 82 // index of transaction ID by scheduled transaction ID
9999
codeBlockIDByScheduledTransactionID = 83 // index of block ID by scheduled transaction ID
100100

101+
// The storage prefixes `codeChunkDataPack` and `codeIndexChunkDataPackByChunkID` are used primarily by execution nodes
102+
// to persist their own results for chunks they executed.
103+
// - `codeIndexChunkDataPackByChunkID` stores the chunkID → chunkDataPackID index, and
104+
// - `codeChunkDataPack` stores the chunk data pack by its own ID.
105+
// This breakup allows us to store chunk data packs in a different database in a concurrent safe way.
106+
codeIndexChunkDataPackByChunkID = 99
107+
codeChunkDataPack = 100
108+
101109
// legacy codes (should be cleaned up)
102-
codeChunkDataPack = 100
103110
codeCommit = 101
104111
codeEvent = 102
105112
codeExecutionStateInteractions = 103
@@ -111,15 +118,10 @@ const (
111118
codeLightTransactionResultIndex = 109
112119
codeTransactionResultErrorMessage = 110
113120
codeTransactionResultErrorMessageIndex = 111
114-
// Compared to the deprecated `codeChunkDataPack`, which stored chunkID -> storedChunkDataPack relationship:
115-
// - `codeIndexChunkDataPackByChunkID` stores the chunkID->chunkDataPackID index, and
116-
// - `codeChunkDataPack` stores chunkDataPackID -> storedChunkDataPack relationship.
117-
// This breakup allows us to store chunk data packs in a different database in a concurrent safe way
118-
codeIndexChunkDataPackByChunkID = 112
119-
codeIndexCollection = 200
120-
codeIndexExecutionResultByBlock = 202
121-
codeIndexCollectionByTransaction = 203
122-
codeIndexResultApprovalByChunk = 204
121+
codeIndexCollection = 200
122+
codeIndexExecutionResultByBlock = 202
123+
codeIndexCollectionByTransaction = 203
124+
codeIndexResultApprovalByChunk = 204
123125

124126
// TEMPORARY codes
125127
disallowedNodeIDs = 205 // manual override for adding node IDs to list of ejected nodes, applies to networking layer only

storage/store/chunk_data_packs.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,10 @@ func (ch *ChunkDataPacks) BatchRemoveChunkDataPacksOnly(chunkIDs []flow.Identifi
244244
}
245245
}
246246

247-
// Remove from cache and protocol DB
248-
return ch.protocolDB.WithReaderBatchWriter(func(rw storage.ReaderBatchWriter) error {
249-
for _, chunkID := range chunkIDs {
250-
err := ch.chunkIDToChunkDataPackIDCache.RemoveTx(rw, chunkID)
251-
if err != nil {
252-
return err
253-
}
254-
}
255-
return nil
256-
})
247+
// The chunk data pack pruner only removes the stored chunk data packs (in ch.stored).
248+
// It does not delete the corresponding index mappings from the protocol database.
249+
// These mappings should be cleaned up by the protocol DB pruner, which will be implemented later.
250+
return nil
257251
}
258252

259253
// ByChunkID returns the chunk data for the given chunk ID.

0 commit comments

Comments
 (0)