server: Move adjusting revision to hasher

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
Marek Siarkowicz 2022-05-19 14:10:36 +02:00
parent 2b8dd0de4e
commit 991b429336
3 changed files with 4 additions and 4 deletions

View File

@ -42,8 +42,8 @@ func newKVHasher(lower, upper int64, keep map[revision]struct{}) kvHasher {
h.Write(buckets.Key.Name())
return kvHasher{
hash: h,
lower: revision{main: lower},
upper: revision{main: upper},
lower: revision{main: lower + 1},
upper: revision{main: upper + 1},
keep: keep,
}
}

View File

@ -189,7 +189,7 @@ func (s *store) HashByRev(rev int64) (hash uint32, currentRev int64, compactRev
tx.RLock()
defer tx.RUnlock()
s.mu.RUnlock()
hash, err = unsafeHashByRev(tx, compactRev+1, rev+1, keep)
hash, err = unsafeHashByRev(tx, compactRev, rev, keep)
hashRevSec.Observe(time.Since(start).Seconds())
return hash, currentRev, compactRev, err
}

View File

@ -38,7 +38,7 @@ func (s *store) scheduleCompaction(compactMainRev, prevCompactRev int64) (uint32
binary.BigEndian.PutUint64(end, uint64(compactMainRev+1))
batchNum := s.cfg.CompactionBatchLimit
h := newKVHasher(prevCompactRev+1, compactMainRev+1, keep)
h := newKVHasher(prevCompactRev, compactMainRev, keep)
last := make([]byte, 8+1+8)
for {
var rev revision