first write, then track

This commit is contained in:
vyzo 2021-07-02 14:25:02 +03:00
parent bd92c230da
commit 4071488ef2

View File

@ -311,10 +311,9 @@ func (s *SplitStore) Put(blk blocks.Block) error {
s.txnLk.RLock() s.txnLk.RLock()
defer s.txnLk.RUnlock() defer s.txnLk.RUnlock()
s.trackWrite(blk.Cid())
err := s.hot.Put(blk) err := s.hot.Put(blk)
if err == nil { if err == nil {
s.trackWrite(blk.Cid())
s.trackTxnRef(blk.Cid()) s.trackTxnRef(blk.Cid())
} }
@ -330,10 +329,9 @@ func (s *SplitStore) PutMany(blks []blocks.Block) error {
s.txnLk.RLock() s.txnLk.RLock()
defer s.txnLk.RUnlock() defer s.txnLk.RUnlock()
s.trackWriteMany(batch)
err := s.hot.PutMany(blks) err := s.hot.PutMany(blks)
if err == nil { if err == nil {
s.trackWriteMany(batch)
s.trackTxnRefMany(batch) s.trackTxnRefMany(batch)
} }