config: fix duplication of replication priority key (#17014)

This commit is contained in:
Poorna 2023-04-11 19:22:10 -07:00 committed by GitHub
parent 6877578bbc
commit d350654aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -602,6 +602,17 @@ var renamedSubsys = map[string]string{
// Add future sub-system renames // Add future sub-system renames
} }
const ( // deprecated keys
apiReplicationWorkers = "replication_workers"
apiReplicationFailedWorkers = "replication_failed_workers"
)
// map of subsystem to deleted keys
var deletedSubSysKeys = map[string][]string{
APISubSys: {apiReplicationWorkers, apiReplicationFailedWorkers},
// Add future sub-system deleted keys
}
// Merge - merges a new config with all the // Merge - merges a new config with all the
// missing values for default configs, // missing values for default configs,
// returns a config. // returns a config.
@ -632,9 +643,16 @@ func (c Config) Merge() Config {
} }
subSys = rnSubSys subSys = rnSubSys
} }
// Delete deprecated keys for subsystem if any
if keys, ok := deletedSubSysKeys[subSys]; ok {
for _, key := range keys {
ckvs.Delete(key)
}
}
cp[subSys][tgt] = ckvs cp[subSys][tgt] = ckvs
} }
} }
return cp return cp
} }