mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Merge branch 'master' into mutual-tls
This commit is contained in:
commit
876493c67d
2 changed files with 25 additions and 1 deletions
|
|
@ -601,7 +601,7 @@ func (s *Server) receiveMessage(m Message) error {
|
|||
return fmt.Errorf("local index not found: %s", obj.Index)
|
||||
}
|
||||
opt := obj.Meta
|
||||
_, err := idx.createField(obj.Field, *opt)
|
||||
_, err := idx.createFieldIfNotExists(obj.Field, *opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,6 +318,30 @@ func TestConfig_Parse_DataDir(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestConcurrentFieldCreation(t *testing.T) {
|
||||
cluster := test.MustRunCluster(t, 3)
|
||||
defer cluster.Close()
|
||||
|
||||
api0 := cluster[0].API
|
||||
if _, err := api0.CreateIndex(context.Background(), "i", pilosa.IndexOptions{}); err != nil {
|
||||
t.Fatalf("creating index: %v", err)
|
||||
}
|
||||
eg := errgroup.Group{}
|
||||
for i := 0; i < 100; i++ {
|
||||
i := i
|
||||
eg.Go(func() error {
|
||||
if _, err := api0.CreateField(context.Background(), "i", fmt.Sprintf("f%d", i)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
err := eg.Wait()
|
||||
if err != nil {
|
||||
t.Fatalf("creating concurrent field: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMain_RecalculateHashes(t *testing.T) {
|
||||
const clusterSize = 5
|
||||
cluster := test.MustRunCluster(t, clusterSize)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue