Skip to content

Commit

Permalink
--wip-- [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
wmitsuda committed Dec 3, 2024
1 parent 87988bf commit 3ea3702
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions erigon-lib/state/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ func (sf AggV3StaticFiles) CleanupOnError() {
}
}

// TODO: implement multiencseq support for collation
func (a *Aggregator) buildFiles(ctx context.Context, step uint64) error {
a.logger.Debug("[agg] collate and build", "step", step, "collate_workers", a.collateAndBuildWorkers, "merge_workers", a.mergeWorkers, "compress_workers", a.d[kv.AccountsDomain].compressCfg.Workers)

Expand Down
2 changes: 2 additions & 0 deletions erigon-lib/state/history.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ func (h *History) buildVI(ctx context.Context, historyIdxPath string, hist, efHi
histReader := seg.NewReader(hist.MakeGetter(), h.compression)
efHistReader := seg.NewReader(efHist.MakeGetter(), h.InvertedIndex.compression)

// TODO: dedup
for {
histReader.Reset(0)
efHistReader.Reset(0)
Expand Down Expand Up @@ -572,6 +573,7 @@ func (c HistoryCollation) Close() {
}
}

// TODO: dedup collate code for ii
// [txFrom; txTo)
func (h *History) collate(ctx context.Context, step, txFrom, txTo uint64, roTx kv.Tx) (HistoryCollation, error) {
if h.snapshotsDisabled {
Expand Down
1 change: 1 addition & 0 deletions erigon-lib/state/inverted_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,7 @@ func (iit *InvertedIndexRoTx) IterateChangedKeys(startTxNum, endTxNum uint64, ro
return ii1
}

// TODO: add multiencseq support to collate
// collate [stepFrom, stepTo)
func (ii *InvertedIndex) collate(ctx context.Context, step uint64, roTx kv.Tx) (InvertedIndexCollation, error) {
stepTo := step + 1
Expand Down
2 changes: 2 additions & 0 deletions erigon-lib/state/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ func (ht *HistoryRoTx) staticFilesInRange(r HistoryRanges) (indexFiles, historyF
return
}

// TODO: add support to multiencseq
func mergeEfs(preval, val, buf []byte) ([]byte, error) {
preef, _ := eliasfano32.ReadEliasFano(preval)
ef, _ := eliasfano32.ReadEliasFano(val)
Expand Down Expand Up @@ -778,6 +779,7 @@ func (ht *HistoryRoTx) mergeFiles(ctx context.Context, indexFiles, historyFiles
})
}
}
// TODO: dedup
// In the loop below, the pair `keyBuf=>valBuf` is always 1 item behind `lastKey=>lastVal`.
// `lastKey` and `lastVal` are taken from the top of the multi-way merge (assisted by the CursorHeap cp), but not processed right away
// instead, the pair from the previous iteration is processed first - `keyBuf=>valBuf`. After that, `keyBuf` and `valBuf` are assigned
Expand Down

0 comments on commit 3ea3702

Please sign in to comment.