forked from TrueCloudLab/frostfs-node
[#1337] shard: Disable background rebuild
Since `frostfs-cli control shards rebuild` command was added, there is no need for background rebuild now. For failover tests used used value 1 to rebuild only schema change. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
edb1747af7
commit
d3b209c8e1
16 changed files with 49 additions and 138 deletions
|
@ -60,7 +60,7 @@ func (b *Blobovniczas) Rebuild(ctx context.Context, prm common.RebuildPrm) (comm
|
|||
b.log.Debug(logs.BlobovniczaTreeCompletedPreviousRebuildSuccess)
|
||||
|
||||
b.log.Debug(logs.BlobovniczaTreeCollectingDBToRebuild)
|
||||
dbsToMigrate, err := b.getDBsToRebuild(ctx, prm.Action)
|
||||
dbsToMigrate, err := b.getDBsToRebuild(ctx, prm.FillPercent)
|
||||
if err != nil {
|
||||
b.log.Warn(logs.BlobovniczaTreeCollectingDBToRebuildFailed, zap.Error(err))
|
||||
success = false
|
||||
|
@ -94,27 +94,20 @@ func (b *Blobovniczas) migrateDBs(ctx context.Context, dbs []string, prm common.
|
|||
return res, nil
|
||||
}
|
||||
|
||||
func (b *Blobovniczas) getDBsToRebuild(ctx context.Context, action common.RebuildAction) ([]string, error) {
|
||||
schemaChange := make(map[string]struct{})
|
||||
fillPercent := make(map[string]struct{})
|
||||
var err error
|
||||
if action.SchemaChange {
|
||||
schemaChange, err = b.selectDBsDoNotMatchSchema(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
func (b *Blobovniczas) getDBsToRebuild(ctx context.Context, fillPercent int) ([]string, error) {
|
||||
withSchemaChange, err := b.selectDBsDoNotMatchSchema(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if action.FillPercent {
|
||||
fillPercent, err = b.selectDBsDoNotMatchFillPercent(ctx, action.FillPercentValue)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
withFillPercent, err := b.selectDBsDoNotMatchFillPercent(ctx, fillPercent)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for k := range fillPercent {
|
||||
schemaChange[k] = struct{}{}
|
||||
for k := range withFillPercent {
|
||||
withSchemaChange[k] = struct{}{}
|
||||
}
|
||||
result := make([]string, 0, len(schemaChange))
|
||||
for db := range schemaChange {
|
||||
result := make([]string, 0, len(withSchemaChange))
|
||||
for db := range withSchemaChange {
|
||||
result = append(result, db)
|
||||
}
|
||||
return result, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue