Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block files: idxAvailability must rely on visibleFiles instead of atomics #12078

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions turbo/snapshotsync/freezeblocks/block_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,10 @@ func (s *RoSnapshots) idxAvailability() uint64 {
if !s.HasType(segtype.Type()) {
return true
}
maxIdx = value.maxVisibleBlock.Load()
return false // all types of segments have the same height. stop here
if len(value.VisibleSegments) > 0 {
maxIdx = value.VisibleSegments[len(value.VisibleSegments)-1].to - 1
}
return false // all types of visible-segments have the same height. stop here
})

return maxIdx
Expand Down
4 changes: 3 additions & 1 deletion turbo/snapshotsync/freezeblocks/caplin_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,11 @@ func (s *CaplinSnapshots) recalcVisibleFiles() {
s.BeaconBlocks.VisibleSegments = getNewVisibleSegments(s.BeaconBlocks.DirtySegments)
s.BlobSidecars.VisibleSegments = getNewVisibleSegments(s.BlobSidecars.DirtySegments)

var maxIdx uint64
if len(s.BeaconBlocks.VisibleSegments) > 0 {
s.BeaconBlocks.maxVisibleBlock.Store(s.BeaconBlocks.VisibleSegments[len(s.BeaconBlocks.VisibleSegments)-1].to - 1)
maxIdx = s.BeaconBlocks.VisibleSegments[len(s.BeaconBlocks.VisibleSegments)-1].to - 1
}
s.BeaconBlocks.maxVisibleBlock.Store(maxIdx)
}

func (s *CaplinSnapshots) idxAvailability() uint64 {
Expand Down
Loading