diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2020-11-22 20:29:17 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-22 20:29:17 +0800 |
| commit | 9aa990f80f8af70628c72eaf0c20d445c15b9e9d (patch) | |
| tree | 2dd4ed5551515b207074bf27908432b0293cd321 /weed/shell | |
| parent | e8296104fc715f0f7c41a82059f366603b3e94f0 (diff) | |
| parent | 92f906b6fcce2ef72661bb825075e2826b8f3aa1 (diff) | |
| download | seaweedfs-9aa990f80f8af70628c72eaf0c20d445c15b9e9d.tar.xz seaweedfs-9aa990f80f8af70628c72eaf0c20d445c15b9e9d.zip | |
Merge pull request #39 from chrislusf/master
sync
Diffstat (limited to 'weed/shell')
| -rw-r--r-- | weed/shell/command_collection_delete.go | 2 | ||||
| -rw-r--r-- | weed/shell/command_fs_meta_cat.go | 5 | ||||
| -rw-r--r-- | weed/shell/command_volume_balance.go | 6 | ||||
| -rw-r--r-- | weed/shell/command_volume_balance_test.go | 16 |
4 files changed, 23 insertions, 6 deletions
diff --git a/weed/shell/command_collection_delete.go b/weed/shell/command_collection_delete.go index 28b9cebbd..5777d5780 100644 --- a/weed/shell/command_collection_delete.go +++ b/weed/shell/command_collection_delete.go @@ -22,7 +22,7 @@ func (c *commandCollectionDelete) Name() string { func (c *commandCollectionDelete) Help() string { return `delete specified collection - collection.delete -collectin <collection_name> -force + collection.delete -collection <collection_name> -force ` } diff --git a/weed/shell/command_fs_meta_cat.go b/weed/shell/command_fs_meta_cat.go index a097a3a4e..e0525defa 100644 --- a/weed/shell/command_fs_meta_cat.go +++ b/weed/shell/command_fs_meta_cat.go @@ -72,8 +72,9 @@ func (c *commandFsMetaCat) Do(args []string, commandEnv *CommandEnv, writer io.W bytes, _ := proto.Marshal(respLookupEntry.Entry) gzippedBytes, _ := util.GzipData(bytes) - zstdBytes, _ := util.ZstdData(bytes) - fmt.Fprintf(writer, "chunks %d meta size: %d gzip:%d zstd:%d\n", len(respLookupEntry.Entry.Chunks), len(bytes), len(gzippedBytes), len(zstdBytes)) + // zstdBytes, _ := util.ZstdData(bytes) + // fmt.Fprintf(writer, "chunks %d meta size: %d gzip:%d zstd:%d\n", len(respLookupEntry.Entry.Chunks), len(bytes), len(gzippedBytes), len(zstdBytes)) + fmt.Fprintf(writer, "chunks %d meta size: %d gzip:%d\n", len(respLookupEntry.Entry.Chunks), len(bytes), len(gzippedBytes)) return nil diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.go index 53222ca29..928dec02a 100644 --- a/weed/shell/command_volume_balance.go +++ b/weed/shell/command_volume_balance.go @@ -306,16 +306,16 @@ func isGoodMove(placement *super_block.ReplicaPlacement, existingReplicas []*Vol dcs[targetNode.dc] = true racks[fmt.Sprintf("%s %s", targetNode.dc, targetNode.rack)]++ - if len(dcs) > placement.DiffDataCenterCount+1 { + if len(dcs) != placement.DiffDataCenterCount+1 { return false } - if len(racks) > placement.DiffRackCount+placement.DiffDataCenterCount+1 { + if len(racks) != placement.DiffRackCount+placement.DiffDataCenterCount+1 { return false } for _, sameRackCount := range racks { - if sameRackCount > placement.SameRackCount+1 { + if sameRackCount != placement.SameRackCount+1 { return false } } diff --git a/weed/shell/command_volume_balance_test.go b/weed/shell/command_volume_balance_test.go index 9e154dc00..696bc7fac 100644 --- a/weed/shell/command_volume_balance_test.go +++ b/weed/shell/command_volume_balance_test.go @@ -21,6 +21,22 @@ func TestIsGoodMove(t *testing.T) { var tests = []testMoveCase{ { + name: "test 100 move to wrong data centers", + replication: "100", + replicas: []*VolumeReplica{ + { + location: &location{"dc1", "r1", &master_pb.DataNodeInfo{Id: "dn1"}}, + }, + { + location: &location{"dc2", "r2", &master_pb.DataNodeInfo{Id: "dn2"}}, + }, + }, + sourceLocation: location{"dc1", "r1", &master_pb.DataNodeInfo{Id: "dn1"}}, + targetLocation: location{"dc2", "r3", &master_pb.DataNodeInfo{Id: "dn3"}}, + expected: false, + }, + + { name: "test 100 move to spread into proper data centers", replication: "100", replicas: []*VolumeReplica{ |
