github.com/weaviate/weaviate@v1.24.6/usecases/sharding/config_update.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package sharding 13 14 import ( 15 "fmt" 16 ) 17 18 type nodeCounter interface { 19 NodeCount() int 20 } 21 22 func ValidateConfigUpdate(old, updated Config, nodeCounter nodeCounter) error { 23 if old.DesiredCount != updated.DesiredCount { 24 return fmt.Errorf("re-sharding not supported yet: shard count is immutable: "+ 25 "attempted change from \"%d\" to \"%d\"", old.DesiredCount, 26 updated.DesiredCount) 27 } 28 29 if old.VirtualPerPhysical != updated.VirtualPerPhysical { 30 return fmt.Errorf("virtual shards per physical is immutable: "+ 31 "attempted change from \"%d\" to \"%d\"", old.VirtualPerPhysical, 32 updated.VirtualPerPhysical) 33 } 34 35 return nil 36 }