diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/test/rgw/test-rgw-meta-sync.sh | |
parent | Initial commit. (diff) | |
download | ceph-6d07fdb6bb33b1af39833b850bb6cf8af79fe293.tar.xz ceph-6d07fdb6bb33b1af39833b850bb6cf8af79fe293.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rgw/test-rgw-meta-sync.sh')
-rwxr-xr-x | src/test/rgw/test-rgw-meta-sync.sh | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/test/rgw/test-rgw-meta-sync.sh b/src/test/rgw/test-rgw-meta-sync.sh new file mode 100755 index 000000000..18f425298 --- /dev/null +++ b/src/test/rgw/test-rgw-meta-sync.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +. "`dirname $0`/test-rgw-common.sh" + +set -e + +function get_metadata_sync_status { + cid=$1 + realm=$2 + + meta_sync_status_json=`$(rgw_admin $cid) --rgw-realm=$realm metadata sync status` + + global_sync_status=$(json_extract sync_status.info.status $meta_sync_status_json) + num_shards=$(json_extract sync_status.info.num_shards $meta_sync_status_json) + + echo "sync_status: $global_sync_status" + + sync_markers=$(json_extract sync_status.markers $meta_sync_status_json) + + num_shards2=$(python_array_len $sync_markers) + + [ "$global_sync_status" == "sync" ] && $assert $num_shards2 -eq $num_shards + + sync_states=$(project_python_array_field val.state $sync_markers) + eval secondary_status=$(project_python_array_field val.marker $sync_markers) +} + +function get_metadata_log_status { + cid=$1 + realm=$2 + + master_mdlog_status_json=`$(rgw_admin $cid) --rgw-realm=$realm mdlog status` + master_meta_status=$(json_extract "" $master_mdlog_status_json) + + eval master_status=$(project_python_array_field marker $master_meta_status) +} + +function wait_for_meta_sync { + master_id=$1 + cid=$2 + realm=$3 + + get_metadata_log_status $master_id $realm + echo "master_status=${master_status[*]}" + + while true; do + get_metadata_sync_status $cid $realm + + echo "secondary_status=${secondary_status[*]}" + + fail=0 + for i in `seq 0 $((num_shards-1))`; do + if [ "${master_status[$i]}" \> "${secondary_status[$i]}" ]; then + echo "shard $i not done syncing (${master_status[$i]} > ${secondary_status[$i]})" + fail=1 + break + fi + done + + [ $fail -eq 0 ] && echo "Success" && return || echo "Sync not complete" + + sleep 5 + done +} + |