mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-15 08:41:02 +00:00
only persist views to etcd when they're not already known
Persisting views to etcd every time we check for them causes what ends up being about a factor of 60 slowdown. Let's do it a little less.
This commit is contained in:
parent
4097ec155b
commit
0790fbe866
1 changed files with 6 additions and 3 deletions
9
field.go
9
field.go
|
|
@ -1187,6 +1187,12 @@ func (f *Field) createViewIfNotExistsBase(cvm *CreateViewMessage) (*view, bool,
|
|||
f.mu.Lock()
|
||||
defer f.mu.Unlock()
|
||||
|
||||
// If we already have this view, we can probably assume etcd already
|
||||
// has it.
|
||||
if view := f.viewMap[cvm.View]; view != nil {
|
||||
return view, false, nil
|
||||
}
|
||||
|
||||
// Create the view in etcd as the system of record.
|
||||
// Don't persist views related to the existence field.
|
||||
if f.name != existenceFieldName {
|
||||
|
|
@ -1195,9 +1201,6 @@ func (f *Field) createViewIfNotExistsBase(cvm *CreateViewMessage) (*view, bool,
|
|||
}
|
||||
}
|
||||
|
||||
if view := f.viewMap[cvm.View]; view != nil {
|
||||
return view, false, nil
|
||||
}
|
||||
view := f.newView(f.viewPath(cvm.View), cvm.View)
|
||||
|
||||
if err := view.openEmpty(); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue