mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
test compact map with snowflake sequencer
This commit is contained in:
parent
217d7dc377
commit
509a9047db
|
@ -2,10 +2,25 @@ package needle_map
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/sequence"
|
||||
. "github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSnowflakeSequencer(t *testing.T) {
|
||||
m := NewCompactMap()
|
||||
seq, _ := sequence.NewSnowflakeSequencer("for_test", 1)
|
||||
|
||||
for i := 0; i < 200000; i++ {
|
||||
id := seq.NextFileId(1)
|
||||
oldOffset, oldSize := m.Set(NeedleId(id), ToOffset(8), 3000073)
|
||||
if oldSize != 0 {
|
||||
t.Errorf("id %d oldOffset %v oldSize %d", id, oldOffset, oldSize)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestOverflow2(t *testing.T) {
|
||||
m := NewCompactMap()
|
||||
_, oldSize := m.Set(NeedleId(150088), ToOffset(8), 3000073)
|
||||
|
|
Loading…
Reference in a new issue