mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
Merge pull request #1405 from tgruben/back-fix
backport fix for issue #1400
This commit is contained in:
commit
41a878f8a8
3 changed files with 17 additions and 1 deletions
|
|
@ -150,6 +150,12 @@ func (btc *BTreeContainers) Size() int {
|
|||
return btc.tree.Len()
|
||||
}
|
||||
|
||||
func (btc *BTreeContainers) Reset() {
|
||||
btc.tree = TreeNew(cmp)
|
||||
btc.lastKey = 0
|
||||
btc.lastContainer = nil
|
||||
}
|
||||
|
||||
func (btc *BTreeContainers) Iterator(key uint64) (citer roaring.ContainerIterator, found bool) {
|
||||
e, ok := btc.tree.Seek(key)
|
||||
if ok {
|
||||
|
|
|
|||
|
|
@ -124,6 +124,13 @@ func (sc *SliceContainers) Size() int {
|
|||
|
||||
}
|
||||
|
||||
func (sc *SliceContainers) Reset() {
|
||||
sc.keys = sc.keys[:0]
|
||||
sc.containers = sc.containers[:0]
|
||||
sc.lastContainer = nil
|
||||
sc.lastKey = 0
|
||||
}
|
||||
|
||||
func (sc *SliceContainers) seek(key uint64) (int, bool) {
|
||||
i := search64(sc.keys, key)
|
||||
found := true
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ type Containers interface {
|
|||
// return the first container at or after key. found will be true if a
|
||||
// container is found at key.
|
||||
Iterator(key uint64) (citer ContainerIterator, found bool)
|
||||
//Reset will clear the containers collection to allow for recycling during snapshot
|
||||
Reset()
|
||||
|
||||
}
|
||||
|
||||
type ContainerIterator interface {
|
||||
|
|
@ -635,7 +638,7 @@ func (b *Bitmap) UnmarshalBinary(data []byte) error {
|
|||
keyN := binary.LittleEndian.Uint32(data[4:8])
|
||||
|
||||
headerSize := headerBaseSize
|
||||
|
||||
b.Containers.Reset()
|
||||
// Descriptive header section: Read container keys and cardinalities.
|
||||
for i, buf := 0, data[headerSize:]; i < int(keyN); i, buf = i+1, buf[12:] {
|
||||
b.Containers.PutContainerValues(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue