cmd = ['bucket', 'sync', 'disable', '--bucket', bucket_name] + zone.zone_args()
zone.cluster.admin(cmd)
-def check_buckets_sync_status_obj_not_exist(zone, buckets):
+def check_buckets_sync_disabled(zonegroup, buckets):
+ """ verify that no zone is actively (full or incremental) syncing the
+ given buckets from any other zone, ie that bucket sync is disabled.
+ this polls because it can take a few seconds for the disabled state to
+ propagate via metadata sync """
+ active_states = ('full-sync', 'incremental-sync')
+ zones = zonegroup.zones
for _ in range(config.checkpoint_retries):
- cmd = ['log', 'list'] + zone.zone_arg()
- log_list, ret = zone.cluster.admin(cmd, check_retcode=False, read_only=True)
- for bucket in buckets:
- if log_list.find(':'+bucket+":") >= 0:
+ still_syncing = False
+ for zone in zones:
+ for source_zone in zones:
+ if source_zone == zone:
+ continue
+ for bucket_name in buckets:
+ state = get_bucket_sync_state(zone, source_zone, bucket_name)
+ if state in active_states:
+ still_syncing = True
+ break
+ if still_syncing:
+ break
+ if still_syncing:
break
- else:
+ if not still_syncing:
return
time.sleep(config.checkpoint_delay)
assert False
for bucket_name in buckets:
disable_bucket_sync(realm.meta_master_zone(), bucket_name)
+ zonegroup_meta_checkpoint(zonegroup)
- for zone in zonegroup.zones:
- check_buckets_sync_status_obj_not_exist(zone, buckets)
+ check_buckets_sync_disabled(zonegroup, buckets)
zonegroup_data_checkpoint(zonegroup_conns)