Browse Source

test compact map with snowflake sequencer

pull/3228/head
chrislu 3 years ago
parent
commit
509a9047db
  1. 15
      weed/storage/needle_map/compact_map_test.go

15
weed/storage/needle_map/compact_map_test.go

@ -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…
Cancel
Save