Index: impl/memory/datastore_index.go |
diff --git a/impl/memory/datastore_index.go b/impl/memory/datastore_index.go |
index 0126034d2bd2d610633528d16782e0f5742783a6..cbd1f36a69b5e328a4582e0e959b3269a02ba9fb 100644 |
--- a/impl/memory/datastore_index.go |
+++ b/impl/memory/datastore_index.go |
@@ -224,7 +224,7 @@ func mergeIndexes(ns string, store, oldIdx, newIdx *memStore) { |
}) |
} |
-func addIndexes(store *memStore, aid, ns string, compIdx []*ds.IndexDefinition) { |
+func addIndexes(store *memStore, aid string, compIdx []*ds.IndexDefinition) { |
normalized := make([]*ds.IndexDefinition, len(compIdx)) |
idxColl := store.SetCollection("idx", nil) |
for i, idx := range compIdx { |
@@ -232,23 +232,25 @@ func addIndexes(store *memStore, aid, ns string, compIdx []*ds.IndexDefinition) |
idxColl.Set(serialize.ToBytes(*normalized[i].PrepForIdxTable()), []byte{}) |
} |
- if allEnts := store.GetCollection("ents:" + ns); allEnts != nil { |
- allEnts.VisitItemsAscend(nil, true, func(i *gkvlite.Item) bool { |
- pm, err := rpm(i.Val) |
- memoryCorruption(err) |
+ for _, ns := range namespaces(store) { |
+ if allEnts := store.GetCollection("ents:" + ns); allEnts != nil { |
+ allEnts.VisitItemsAscend(nil, true, func(i *gkvlite.Item) bool { |
+ pm, err := rpm(i.Val) |
+ memoryCorruption(err) |
- prop, err := serialize.ReadProperty(bytes.NewBuffer(i.Key), serialize.WithoutContext, aid, ns) |
- memoryCorruption(err) |
+ prop, err := serialize.ReadProperty(bytes.NewBuffer(i.Key), serialize.WithoutContext, aid, ns) |
+ memoryCorruption(err) |
- k := prop.Value().(*ds.Key) |
+ k := prop.Value().(*ds.Key) |
- sip := serialize.PropertyMapPartially(k, pm) |
+ sip := serialize.PropertyMapPartially(k, pm) |
- mergeIndexes(ns, store, |
- newMemStore(), |
- indexEntries(sip, ns, normalized)) |
- return true |
- }) |
+ mergeIndexes(ns, store, |
+ newMemStore(), |
+ indexEntries(sip, ns, normalized)) |
+ return true |
+ }) |
+ } |
} |
} |