Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

handle missing leading zero padding in replica

chrislu7dd480acad23
diff --git a/weed/storage/super_block/replica_placement.go b/weed/storage/super_block/replica_placement.go
index 9a59eb258c..b2bf21fcb7 100644
--- a/weed/storage/super_block/replica_placement.go
+++ b/weed/storage/super_block/replica_placement.go
@@ -12,6 +12,14 @@ type ReplicaPlacement struct {
func NewReplicaPlacementFromString(t string) (*ReplicaPlacement, error) {
rp := &ReplicaPlacement{}
+ switch len(t) {
+ case 0:
+ t = "000"
+ case 1:
+ t = "00" + t
+ case 2:
+ t = "0" + t
+ }
for i, c := range t {
count := int(c - '0')
if count < 0 {