Parent issue
Part of #16239 -- avoiding inconsistency due to lexicographic prune.
Problem
DomainLatestIterFile.initCursorMDBX() and advanceInFiles() in db/state/domain_stream.go push DB entries into the priority heap without checking whether their step falls within the file range. The comment // DB can store not-finished step, it means - then set first txn in step - it anyway will be ahead of files is incorrect for prunable data — DB entries whose step overlaps with files have step * stepSize < files.EndTxNum().
Affected locations
initCursorMDBX() LargeValues path (line ~210)
initCursorMDBX() DupSort path (line ~228)
advanceInFiles() LargeValues DB_CURSOR branch (line ~292)
advanceInFiles() DupSort DB_CURSOR branch (line ~312)
All four locations have the same misleading comment and lack a filesEndTxNum check.
Fix
Apply the same "skip DB entries within file range" pattern used in:
DomainLatestIterFile would need a filesEndTxNum uint64 field set during init() from domainRoTx.files.EndTxNum(), since advanceInFiles() doesn't have access to domainRoTx.
Parent issue
Part of #16239 -- avoiding inconsistency due to lexicographic prune.
Problem
DomainLatestIterFile.initCursorMDBX()andadvanceInFiles()indb/state/domain_stream.gopush DB entries into the priority heap without checking whether their step falls within the file range. The comment// DB can store not-finished step, it means - then set first txn in step - it anyway will be ahead of filesis incorrect for prunable data — DB entries whose step overlaps with files havestep * stepSize < files.EndTxNum().Affected locations
initCursorMDBX()LargeValues path (line ~210)initCursorMDBX()DupSort path (line ~228)advanceInFiles()LargeValues DB_CURSOR branch (line ~292)advanceInFiles()DupSort DB_CURSOR branch (line ~312)All four locations have the same misleading comment and lack a
filesEndTxNumcheck.Fix
Apply the same "skip DB entries within file range" pattern used in:
debugIteratePrefixLatest)RangeAsOf)iterateChangedRecent)recentIterateRange)DomainLatestIterFilewould need afilesEndTxNum uint64field set duringinit()fromdomainRoTx.files.EndTxNum(), sinceadvanceInFiles()doesn't have access todomainRoTx.