diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-06-04 01:49:51 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-06-04 01:49:51 -0700 |
| commit | 06133ae98fe3176b69d3a2a17a6793c94146a2c8 (patch) | |
| tree | 7718b12142c4e7a695f429f86af506f120f11257 | |
| parent | 6cea23d091120f53b7a6b2dd657add0954d93739 (diff) | |
| download | seaweedfs-06133ae98fe3176b69d3a2a17a6793c94146a2c8.tar.xz seaweedfs-06133ae98fe3176b69d3a2a17a6793c94146a2c8.zip | |
correct count for free ec slots, avoid removing generated shards
| -rw-r--r-- | weed/shell/command_ec_balance.go | 1 | ||||
| -rw-r--r-- | weed/shell/command_ec_rebuild.go | 13 |
2 files changed, 5 insertions, 9 deletions
diff --git a/weed/shell/command_ec_balance.go b/weed/shell/command_ec_balance.go index 414f0ec4d..f3f4fff45 100644 --- a/weed/shell/command_ec_balance.go +++ b/weed/shell/command_ec_balance.go @@ -256,6 +256,7 @@ func pickOneEcNodeAndMoveOneShard(ctx context.Context, commandEnv *commandEnv, a } destEcNode.freeEcSlot-- + existingLocation.freeEcSlot++ return nil } diff --git a/weed/shell/command_ec_rebuild.go b/weed/shell/command_ec_rebuild.go index 479b51484..660267b22 100644 --- a/weed/shell/command_ec_rebuild.go +++ b/weed/shell/command_ec_rebuild.go @@ -144,23 +144,18 @@ func rebuildOneEcVolume(ctx context.Context, commandEnv *commandEnv, rebuilder * fmt.Fprintf(writer, "%s delete copied ec shards %s %d.%v\n", rebuilder.info.Id, collection, volumeId, copiedShardIds) } - // ask the rebuilder to delete the copied shards - err = sourceServerDeleteEcShards(ctx, commandEnv.option.GrpcDialOption, collection, volumeId, rebuilder.info.Id, generatedShardIds) - if err != nil { - fmt.Fprintf(writer, "%s delete generated ec shards %s %d.%v\n", rebuilder.info.Id, collection, volumeId, generatedShardIds) - } - }() if !applyChanges { return nil } - // generate ec shards, and maybe ecx file, and mount them + // generate ec shards, and maybe ecx file generatedShardIds, err = generateMissingShards(ctx, commandEnv.option.GrpcDialOption, collection, volumeId, rebuilder.info.Id) if err != nil { return err } + rebuilder.freeEcSlot -= len(generatedShardIds) // mount the generated shards err = mountEcShards(ctx, commandEnv.option.GrpcDialOption, collection, volumeId, rebuilder.info.Id, generatedShardIds) @@ -205,14 +200,14 @@ func prepareDataToRecover(ctx context.Context, commandEnv *commandEnv, rebuilder continue } - if localShardBits.HasShardId(erasure_coding.ShardId(shardId)){ + if localShardBits.HasShardId(erasure_coding.ShardId(shardId)) { localShardIds = append(localShardIds, uint32(shardId)) fmt.Fprintf(writer, "use existing shard %d.%d\n", volumeId, shardId) continue } var copyErr error - if applyBalancing{ + if applyBalancing { copyErr = operation.WithVolumeServerClient(rebuilder.info.Id, commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error { _, copyErr := volumeServerClient.VolumeEcShardsCopy(ctx, &volume_server_pb.VolumeEcShardsCopyRequest{ VolumeId: uint32(volumeId), |
