mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
make note of a possible race condition
This commit is contained in:
parent
ed7dcdcdef
commit
f2d28a1df9
2 changed files with 24 additions and 19 deletions
|
|
@ -725,6 +725,11 @@ func (c *Cluster) followResizeInstruction(instr *internal.ResizeInstruction) {
|
|||
|
||||
srcURI := decodeURI(src.URI)
|
||||
|
||||
// TODO: there's a possible race condition here;
|
||||
// if NodeStatus has not been shared with the joining
|
||||
// node (and the schema created locally), then
|
||||
// the following Frame() lookup could fail.
|
||||
|
||||
// Retrieve frame.
|
||||
f := c.Holder.Frame(src.Index, src.Frame)
|
||||
if f == nil {
|
||||
|
|
|
|||
38
server.go
38
server.go
|
|
@ -396,6 +396,25 @@ func (s *Server) mergeRemoteStatus(ns *internal.NodeStatus) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Sync schema.
|
||||
// Create indexes that don't exist.
|
||||
for _, index := range ns.Schema.Indexes {
|
||||
opt := IndexOptions{}
|
||||
idx, err := s.Holder.CreateIndexIfNotExists(index.Name, opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Create frames that don't exist.
|
||||
for _, f := range index.Frames {
|
||||
opt := decodeFrameOptions(f.Meta)
|
||||
_, err := idx.CreateFrameIfNotExists(f.Name, *opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// TODO: Create inputDefinitions that don't exist.
|
||||
}
|
||||
|
||||
// Sync maxSlices (standard).
|
||||
oldmaxslices := s.Holder.MaxSlices()
|
||||
for index, newMax := range ns.MaxSlices.Standard {
|
||||
|
|
@ -428,25 +447,6 @@ func (s *Server) mergeRemoteStatus(ns *internal.NodeStatus) error {
|
|||
}
|
||||
}
|
||||
|
||||
// Sync schema.
|
||||
// Create indexes that don't exist.
|
||||
for _, index := range ns.Schema.Indexes {
|
||||
opt := IndexOptions{}
|
||||
idx, err := s.Holder.CreateIndexIfNotExists(index.Name, opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Create frames that don't exist.
|
||||
for _, f := range index.Frames {
|
||||
opt := decodeFrameOptions(f.Meta)
|
||||
_, err := idx.CreateFrameIfNotExists(f.Name, *opt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// TODO: Create inputDefinitions that don't exist.
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue