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.
This commit is contained in:
Seebs 2022-03-30 15:46:55 -05:00
parent e67beb8766
commit 9acc7a6019

View file

@ -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
}