diff --git a/storagenode/metadata/collection.go b/storagenode/metadata/collection.go index c4cef6c..dd6b5b6 100644 --- a/storagenode/metadata/collection.go +++ b/storagenode/metadata/collection.go @@ -105,6 +105,26 @@ func (c *Collection) Equal(o *Collection) bool { return false } + if len(c.Fields) != len(o.Fields) { + return false + } + + for k, _ := range c.Fields { + if _, ok := o.Fields[k]; !ok { + return false + } + } + + if len(c.Indexes) != len(o.Indexes) { + return false + } + + for k, _ := range c.Indexes { + if _, ok := o.Indexes[k]; !ok { + return false + } + } + return true } diff --git a/storagenode/metadata/collection_index.go b/storagenode/metadata/collection_index.go index d7e13b6..fee7c7c 100644 --- a/storagenode/metadata/collection_index.go +++ b/storagenode/metadata/collection_index.go @@ -33,6 +33,10 @@ func (c *CollectionIndex) Equal(o *CollectionIndex) bool { return false } + if c.Primary != o.Primary { + return false + } + return true } diff --git a/storagenode/metadata/shard.go b/storagenode/metadata/shard.go index 5de7a15..44bc052 100644 --- a/storagenode/metadata/shard.go +++ b/storagenode/metadata/shard.go @@ -35,6 +35,16 @@ func (s *ShardInstance) Equal(o *ShardInstance) bool { return false } + if len(s.Collections) != len(o.Collections) { + return false + } + + for k, _ := range o.Collections { + if _, ok := s.Collections[k]; !ok { + return false + } + } + return true }