mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
handle dirty correctly even if a page split happens
This commit is contained in:
parent
6e90bfc9bc
commit
5d1db3a4f2
1 changed files with 1 additions and 9 deletions
10
rbf/tx.go
10
rbf/tx.go
|
|
@ -1785,13 +1785,13 @@ func (s *containerFilter) ApplyRewriter() (err error) {
|
|||
var dirty bool
|
||||
var key roaring.FilterKey
|
||||
var writeback roaring.ContainerWriteback = func(updateKey roaring.FilterKey, data *roaring.Container) (err error) {
|
||||
dirty = true
|
||||
var exact bool
|
||||
if updateKey != key {
|
||||
exact, err = s.cursor.Seek(uint64(updateKey))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dirty = true
|
||||
} else {
|
||||
exact = true
|
||||
}
|
||||
|
|
@ -1799,20 +1799,12 @@ func (s *containerFilter) ApplyRewriter() (err error) {
|
|||
if exact {
|
||||
err = s.cursor.deleteLeafCell(uint64(updateKey))
|
||||
key = ^roaring.FilterKey(0)
|
||||
// if we got here by a seek, we're already marked dirty,
|
||||
// but if we're on a cell and delete it, we've invalidated
|
||||
// our cursor position.
|
||||
dirty = true
|
||||
}
|
||||
// if we don't delete, we aren't changing our situation at all
|
||||
} else {
|
||||
cell = ConvertToLeafArgs(uint64(updateKey), data)
|
||||
err = s.cursor.putLeafCell(cell)
|
||||
key = ^roaring.FilterKey(0)
|
||||
// no dirty flag here; if we had to seek, the cursor became
|
||||
// dirty (is no longer pointed at the key we thought it was
|
||||
// pointed to, so the main loop would want to seek), and if
|
||||
// we didn't seek, we're still where we used to be.
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue