mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-08 03:47:51 +00:00
commit
aa37f50f42
2 changed files with 67 additions and 2 deletions
|
|
@ -307,16 +307,16 @@ func (c *Cluster) isCoordinator() bool {
|
|||
// nodes with its version of Cluster.Status.
|
||||
func (c *Cluster) SetCoordinator(n *Node) error {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
// Verify that the new Coordinator value matches
|
||||
// this node.
|
||||
if c.Node.ID != n.ID {
|
||||
c.mu.Unlock()
|
||||
return fmt.Errorf("coordinator node does not match this node")
|
||||
}
|
||||
|
||||
// Update IsCoordinator on all nodes (locally).
|
||||
_ = c.updateCoordinator(n)
|
||||
|
||||
c.mu.Unlock()
|
||||
// Send the update coordinator message to all nodes.
|
||||
err := c.Broadcaster.SendSync(
|
||||
&internal.UpdateCoordinatorMessage{
|
||||
|
|
|
|||
|
|
@ -1171,3 +1171,68 @@ func BenchmarkFragment_Snapshot(b *testing.B) {
|
|||
}
|
||||
}
|
||||
}
|
||||
func BenchmarkFragment_FullSnapshot(b *testing.B) {
|
||||
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
|
||||
defer f.Close()
|
||||
// Generate some intersecting data.
|
||||
maxX := 1048576 / 2
|
||||
sz := maxX
|
||||
rows := make([]uint64, sz, sz)
|
||||
cols := make([]uint64, sz, sz)
|
||||
|
||||
max := 0
|
||||
for row := 0; row < 100; row++ {
|
||||
val := 1
|
||||
i := 0
|
||||
for col := 0; col < SliceWidth/2; col++ {
|
||||
rows[i] = uint64(row)
|
||||
cols[i] = uint64(val)
|
||||
val += 2
|
||||
i++
|
||||
}
|
||||
if err := f.Import(rows, cols); err != nil {
|
||||
b.Fatalf("Error Building Sample: %s", err)
|
||||
}
|
||||
if row > max {
|
||||
max = row
|
||||
}
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err := f.Snapshot(); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkFragment_Import(b *testing.B) {
|
||||
f := test.MustOpenFragment("i", "f", pilosa.ViewStandard, 0, "")
|
||||
defer f.Close()
|
||||
maxX := 1048576 * 5 * 2
|
||||
sz := maxX
|
||||
rows := make([]uint64, sz, sz)
|
||||
cols := make([]uint64, sz, sz)
|
||||
i := 0
|
||||
for row := 0; row < 100; row++ {
|
||||
val := 1
|
||||
for col := 0; col < SliceWidth/2; col++ {
|
||||
rows[i] = uint64(row)
|
||||
cols[i] = uint64(val)
|
||||
val += 2
|
||||
i++
|
||||
}
|
||||
if i == maxX {
|
||||
break
|
||||
}
|
||||
}
|
||||
b.ResetTimer()
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
if err := f.Import(rows, cols); err != nil {
|
||||
b.Fatalf("Error Building Sample: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue