correct count for free ec slots, avoid removing generated shards

This commit is contained in:
Chris Lu 2019-06-04 01:49:51 -07:00
parent 6cea23d091
commit 06133ae98f
2 changed files with 5 additions and 9 deletions

View File

@ -256,6 +256,7 @@ func pickOneEcNodeAndMoveOneShard(ctx context.Context, commandEnv *commandEnv, a
} }
destEcNode.freeEcSlot-- destEcNode.freeEcSlot--
existingLocation.freeEcSlot++
return nil return nil
} }

View File

@ -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) 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 { if !applyChanges {
return nil 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) generatedShardIds, err = generateMissingShards(ctx, commandEnv.option.GrpcDialOption, collection, volumeId, rebuilder.info.Id)
if err != nil { if err != nil {
return err return err
} }
rebuilder.freeEcSlot -= len(generatedShardIds)
// mount the generated shards // mount the generated shards
err = mountEcShards(ctx, commandEnv.option.GrpcDialOption, collection, volumeId, rebuilder.info.Id, generatedShardIds) err = mountEcShards(ctx, commandEnv.option.GrpcDialOption, collection, volumeId, rebuilder.info.Id, generatedShardIds)