mmm: freeranges tests and fixes.

This commit is contained in:
fiatjaf
2025-10-15 02:39:21 +00:00
parent ac49036b77
commit 5d2675f356
9 changed files with 193 additions and 67 deletions

View File

@@ -37,7 +37,7 @@ type MultiMmapManager struct {
knownLayers lmdb.DBI
indexId lmdb.DBI
freeRanges []position
freeRanges positions
}
func (b *MultiMmapManager) String() string {
@@ -123,7 +123,18 @@ func (b *MultiMmapManager) Init() error {
}
// scan index table to calculate free ranges from used positions
b.GatherFreeRanges(txn)
b.freeRanges, err = b.gatherFreeRanges(txn)
if err != nil {
return err
}
logOp := b.Logger.Debug()
for _, pos := range b.freeRanges {
if pos.size > 20 {
logOp = logOp.Uint32(fmt.Sprintf("%d", pos.start), pos.size)
}
}
logOp.Msg("calculated free ranges from index scan")
return nil
}); err != nil {