Skip to content

feat(statediff): refill directly from frozen IAVL - #7

Open
littlehand26 wants to merge 23 commits into
mainfrom
fix/bugb-direct-refill
Open

littlehand26 wants to merge 23 commits into
mainfrom
fix/bugb-direct-refill

Conversation

@littlehand26

Copy link
Copy Markdown
Contributor

Problem

Legacy archive lifecycle metadata is incomplete before height 6,347,789, so historical StorageDiff cannot be reconstructed reliably from orphan records. Direct N-1/N IAVL traversal is correct but needs resumable S3 refill and better locality.

Solution

  • add direct-IAVL input to the existing resumable refill pipeline
  • bind checkpoints to archive identity and S3 target
  • keep 64-height root verification while allowing one worker to process a larger contiguous run
  • preserve ordered publication, the 64 MiB retained-result bound, and the legacy/modern seam
  • expose --iavl-run-heights for measured 64/128/256 A/B runs

Tests

  • go test -mod=readonly -tags=objstore ./cmd/statediff-rewriter -count=1
  • go test -mod=readonly -race -tags=objstore ./cmd/statediff-rewriter -run TestIterateParallelDirect -count=10
  • go vet -mod=readonly -tags=objstore ./cmd/statediff-rewriter
  • git diff --check

Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Signed-off-by: lihe <he.li@debank.com>
Comment on lines +129 to +133
for label, diff := range map[string]dtypes.BlockStorageDiff{"old": oldDiff, "new": newDiff} {
if diff.Hash != root || diff.ParentHash != parent {
return fmt.Errorf("%s body root mismatch", label)
}
}
if err != nil {
return err
}
defer file.Close()
Comment on lines +231 to +239
for key, newValue := range newValues.Values {
oldValue, ok := oldValues.Values[key]
switch {
case !ok:
stats.Added++
case oldValue != newValue:
stats.Changed++
}
}
Comment on lines +240 to +244
for key := range oldValues.Values {
if _, ok := newValues.Values[key]; !ok {
stats.Removed++
}
}
elapsed := finished.Sub(started).Seconds()
rate := float64(0)
if elapsed > 0 {
rate = float64(invocationProcessed) / elapsed
GeneratedRecords: generatedRecords.Load(), ReusedRecords: reusedRecords.Load(), Concurrency: 1,
CacheSize: options.CacheSize, ZlibLevel: options.ZlibLevel, DurationSeconds: duration.Seconds(),
HandledBlocksPerSecond: float64(records) / duration.Seconds(),
GeneratedBlocksPerSecond: float64(generatedRecords.Load()) / duration.Seconds(),
Files: len(legacyRanges), GeneratedFiles: generatedFiles.Load(), ReusedFiles: reusedFiles.Load(), Records: records,
GeneratedRecords: generatedRecords.Load(), ReusedRecords: reusedRecords.Load(), Concurrency: 1,
CacheSize: options.CacheSize, ZlibLevel: options.ZlibLevel, DurationSeconds: duration.Seconds(),
HandledBlocksPerSecond: float64(records) / duration.Seconds(),
"io"
"os"
"path/filepath"
"runtime"
"io"
"os"
"path/filepath"
"reflect"
Comment on lines +181 to +184
go func() {
groupDone <- group.Wait()
close(results)
}()

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants