debug log writes at track so that we get correct stack traces

This commit is contained in:
vyzo 2021-07-02 12:25:58 +03:00
parent aeaa59d4b5
commit 2faa4aa993

View File

@ -610,6 +610,8 @@ func (s *SplitStore) trackWrite(c cid.Cid) {
defer s.mx.Unlock() defer s.mx.Unlock()
s.pendingWrites[c] = struct{}{} s.pendingWrites[c] = struct{}{}
s.debug.LogWrite(s.curTs, c, s.writeEpoch)
} }
// and also combine batch writes into them // and also combine batch writes into them
@ -620,6 +622,8 @@ func (s *SplitStore) trackWrites(cids []cid.Cid) {
for _, c := range cids { for _, c := range cids {
s.pendingWrites[c] = struct{}{} s.pendingWrites[c] = struct{}{}
} }
s.debug.LogWriteMany(s.curTs, cids, s.writeEpoch)
} }
func (s *SplitStore) flushPendingWrites(locked bool) { func (s *SplitStore) flushPendingWrites(locked bool) {
@ -639,14 +643,10 @@ func (s *SplitStore) flushPendingWrites(locked bool) {
s.pendingWrites = make(map[cid.Cid]struct{}) s.pendingWrites = make(map[cid.Cid]struct{})
epoch := s.writeEpoch epoch := s.writeEpoch
curTs := s.curTs
err := s.tracker.PutBatch(cids, epoch) err := s.tracker.PutBatch(cids, epoch)
if err != nil { if err != nil {
log.Errorf("error putting implicit write batch to tracker: %s", err) log.Errorf("error putting implicit write batch to tracker: %s", err)
} }
s.debug.LogWriteMany(curTs, cids, epoch)
} }
func (s *SplitStore) background() { func (s *SplitStore) background() {