move comments about tracking perf issues into a more pertinent place

This commit is contained in:
vyzo 2021-07-02 11:41:12 +03:00
parent 3e8e9273ca
commit aeaa59d4b5

View File

@ -232,8 +232,6 @@ func (s *SplitStore) Has(cid cid.Cid) (bool, error) {
// treat it as an implicit Write, absence options -- the vm uses this check to avoid duplicate // treat it as an implicit Write, absence options -- the vm uses this check to avoid duplicate
// writes on Flush. When we have options in the API, the vm can explicitly signal that this is // writes on Flush. When we have options in the API, the vm can explicitly signal that this is
// an implicit Write. // an implicit Write.
// Unfortunately we can't just directly tracker.Put one by one, as it is ridiculously slow with
// bolot because of syncing, so we batch them
s.trackWrite(cid) s.trackWrite(cid)
// also make sure the object is considered live during compaction // also make sure the object is considered live during compaction
@ -605,6 +603,8 @@ func (s *SplitStore) updateWriteEpoch() {
} }
} }
// Unfortunately we can't just directly tracker.Put one by one, as it is ridiculously slow with
// bbolt because of syncing (order of 10ms), so we batch them.
func (s *SplitStore) trackWrite(c cid.Cid) { func (s *SplitStore) trackWrite(c cid.Cid) {
s.mx.Lock() s.mx.Lock()
defer s.mx.Unlock() defer s.mx.Unlock()
@ -612,6 +612,7 @@ func (s *SplitStore) trackWrite(c cid.Cid) {
s.pendingWrites[c] = struct{}{} s.pendingWrites[c] = struct{}{}
} }
// and also combine batch writes into them
func (s *SplitStore) trackWrites(cids []cid.Cid) { func (s *SplitStore) trackWrites(cids []cid.Cid) {
s.mx.Lock() s.mx.Lock()
defer s.mx.Unlock() defer s.mx.Unlock()