mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-10 23:11:01 +00:00
test storing frame cache size
This commit is contained in:
parent
8e2592e706
commit
9a1a631dd4
2 changed files with 22 additions and 1 deletions
|
|
@ -44,7 +44,7 @@ const (
|
|||
// HashBlockSize is the number of bitmaps in a merkle hash block.
|
||||
HashBlockSize = 100
|
||||
|
||||
// Percentage of the ThresholdLength size to resort the cache at
|
||||
// ThresholdBufferPct is the percentage of the ThresholdLength size to resort the cache at
|
||||
ThresholdBufferPct = 0.9
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -126,3 +126,24 @@ func (f *Frame) MustSetBit(view string, bitmapID, profileID uint64, t *time.Time
|
|||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
// Ensure frame can set its cache
|
||||
func TestFrame_SetCacheSize(t *testing.T) {
|
||||
f := MustOpenFrame()
|
||||
defer f.Close()
|
||||
cacheSize := 100
|
||||
|
||||
// Set & retrieve frame cache size.
|
||||
if err := f.SetRankedCacheSize(cacheSize); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if q := f.RankedCacheSize(); q != cacheSize {
|
||||
t.Fatalf("unexpected frame cache size: %d", q)
|
||||
}
|
||||
|
||||
// Reload frame and verify that it is persisted.
|
||||
if err := f.Reopen(); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if q := f.RankedCacheSize(); q != cacheSize {
|
||||
t.Fatalf("unexpected frame cache size (reopen): %d", q)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue