From 9acc7a601979f48807c733d94b11b4ec1ffacda7 Mon Sep 17 00:00:00 2001 From: Seebs Date: Wed, 30 Mar 2022 15:46:55 -0500 Subject: [PATCH] Drop unneeded locks The filter and rewrite logic are unlocking and relocking but I don't think they should. I think those locks were added early on during testing of the filter stuff, but I don't think they should be needed, and I've been unable to find a case where they were. I think probably I had something where a ConsiderData function was trying to run a Tx. --- rbf/tx.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/rbf/tx.go b/rbf/tx.go index 41ae2812c..2f15a1476 100644 --- a/rbf/tx.go +++ b/rbf/tx.go @@ -1754,17 +1754,13 @@ func (s *containerFilter) ApplyFilter() (err error) { if key < minKey { continue } - s.tx.mu.RUnlock() res := s.filter.ConsiderKey(key, int32(cell.BitN)) - s.tx.mu.RLock() if res.Err != nil { return res.Err } if res.YesKey <= key && res.NoKey <= key { data := intoContainer(cell, s.cursor.tx, &s.header, s.body[:]) - s.tx.mu.RUnlock() res = s.filter.ConsiderData(key, data) - s.tx.mu.RLock() if res.Err != nil { return res.Err } @@ -1820,17 +1816,13 @@ func (s *containerFilter) ApplyRewriter() (err error) { if key < minKey { continue } - s.tx.mu.RUnlock() res := s.rewriter.ConsiderKey(key, int32(cell.BitN)) - s.tx.mu.RLock() if res.Err != nil { return res.Err } if res.YesKey <= key && res.NoKey <= key { data := intoWritableContainer(cell, s.cursor.tx, &s.header, s.body[:]) - s.tx.mu.RUnlock() res = s.rewriter.RewriteData(key, data, writeback) - s.tx.mu.RLock() if res.Err != nil { return res.Err }