diff --git a/cmd/site-replication.go b/cmd/site-replication.go index db724b32f..279185331 100644 --- a/cmd/site-replication.go +++ b/cmd/site-replication.go @@ -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 } diff --git a/docs/bucket/replication/setup_ilm_expiry_replication.sh b/docs/bucket/replication/setup_ilm_expiry_replication.sh index 256277400..1830f3b94 100755 --- a/docs/bucket/replication/setup_ilm_expiry_replication.sh +++ b/docs/bucket/replication/setup_ilm_expiry_replication.sh @@ -109,6 +109,25 @@ if [ $count -ne 1 ]; then exit 1 fi +## Check replication of rules content +expDays=$(./mc ilm rule list siteb/bucket --json | jq '.config.Rules[0].Expiration.Days') +noncurrentDays=$(./mc ilm rule list siteb/bucket --json | jq '.config.Rules[0].NoncurrentVersionExpiration.NoncurrentDays') +if [ $expDays -ne 3 ]; then + echo "BUG: Incorrect expiry days '${expDays}' set for 'siteb'" + exit 1 +fi +if [ $noncurrentDays -ne 2 ]; then + echo "BUG: Incorrect non current expiry days '${noncurrentDays}' set for siteb" + exit 1 +fi + +## Make sure transition rule not replicated to siteb +tranDays=$(./mc ilm rule list siteb/bucket --json | jq '.config.Rules[0].Transition.Days') +if [ "${tranDays}" != "null" ]; then + echo "BUG: Transition rules as well copied to siteb" + exit 1 +fi + ## Check replication of rules prefix and tags prefix=$(./mc ilm rule list siteb/bucket --json | jq '.config.Rules[0].Filter.And.Prefix' | sed 's/"//g') tagName1=$(./mc ilm rule list siteb/bucket --json | jq '.config.Rules[0].Filter.And.Tags[0].Key' | sed 's/"//g') @@ -183,6 +202,13 @@ if [ $count2 -ne 888 ]; then exit 1 fi +## Check to make sure sitea transition rule is not overwritten +transDays=$(./mc ilm rule list sitea/bucket --json | jq '.config.Rules[0].Transition.Days') +if [ $transDays -ne 0 ] || [ "${transDays}" == "null" ]; then + echo "BUG: Transition rule on sitea seems to be overwritten" + exit 1 +fi + ## Check replication of edit of prefix, tags and status of ILM Expiry Rules ./mc ilm rule edit --id "${id}" --prefix "newprefix" --tags "ntag1=nval1&ntag2=nval2" --disable sitea/bucket sleep 30