Fixed transition rules getting overwritten while healing (#18542)

While healing the latest changes of expiry rules across sites
if target had pre existing transition rules, they were getting
overwritten as cloned latest expiry rules from remote site were
getting written as is. Fixed the same and added test cases as
well.

Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
This commit is contained in:
Shubhendu
2023-11-29 00:08:35 +05:30
committed by GitHub
parent dc88865908
commit ce62980d4e
2 changed files with 31 additions and 2 deletions

View File

@@ -6095,8 +6095,11 @@ func mergeWithCurrentLCConfig(ctx context.Context, bucket string, expLCCfg *stri
// else simply add to the map. This may happen if ILM expiry replication
// was disabled for sometime and rules were updated independently in different
// sites. Latest changes would get applied but merge only the non transition details
if _, ok := rMap[id]; ok {
rMap[id] = rl.CloneNonTransition()
if existingRl, ok := rMap[id]; ok {
clonedRl := rl.CloneNonTransition()
clonedRl.Transition = existingRl.Transition
clonedRl.NoncurrentVersionTransition = existingRl.NoncurrentVersionTransition
rMap[id] = clonedRl
} else {
rMap[id] = rl
}