return json.loads(bilog)
def bilog_autotrim(zone, args = None):
- zone.cluster.admin(['bilog', 'autotrim'] + (args or []))
+ cmd = ['bilog', 'autotrim'] + zone.zone_args()
+ zone.cluster.admin(cmd, read_only=True)
def bucket_layout(zone, bucket, args = None):
(bl_output,_) = zone.cluster.admin(['bucket', 'layout', '--bucket', bucket] + (args or []))
test_bilog = bilog_list(zone.zone, test_bucket.name)
assert(len(test_bilog) > 0)
-def test_bucket_log_trim_after_delete_bucket():
+@attr('bucket_trim')
+def test_bucket_log_trim_after_delete_bucket_primary_reshard():
+
zonegroup = realm.master_zonegroup()
zonegroup_conns = ZonegroupConns(zonegroup)
primary = zonegroup_conns.rw_zones[0]
- secondary = zonegroup_conns.rw_zones[1]
# create a test bucket, upload some objects, and wait for sync
def make_test_bucket():
test_bucket = make_test_bucket()
# Resharding the bucket
- secondary.zone.cluster.admin(['bucket', 'reshard',
+ primary.zone.cluster.admin(['bucket', 'reshard',
'--bucket', test_bucket.name,
- '--num-shards', '13',
- '--yes-i-really-mean-it'])
+ '--num-shards', '13'])
# Delete the objects
for obj in ('a', 'b', 'c', 'd'):
cmd += ['--object', obj]
primary.zone.cluster.admin(cmd)
-
# delete bucket and test bilog autotrim
primary.conn.delete_bucket(test_bucket.name)
-
zonegroup_data_checkpoint(zonegroup_conns)
- zonegroup_meta_checkpoint(zonegroup)
- # run bilog trim twice to clean up previous gen
- bilog_autotrim(secondary.zone)
+ bilog_autotrim(primary.zone)
time.sleep(config.checkpoint_delay)
- # trim bilog on primary
bilog_autotrim(primary.zone)
- time.sleep(config.checkpoint_delay)
+
+ for zonegroup in realm.current_period.zonegroups:
+ zonegroup_conns = ZonegroupConns(zonegroup)
+ zonegroup_meta_checkpoint(zonegroup)
+
+ for zone in zonegroup_conns.zones:
+ log.info('trimming on zone=%s', zone.name)
+ bilog_autotrim(zone.zone)
+ time.sleep(config.checkpoint_delay)
+
+ # run bilog trim twice on primary zone where the bucket was resharded
+ bilog_autotrim(primary.zone)
- bilog_autotrim(secondary.zone)
+ for zonegroup in realm.current_period.zonegroups:
+ for zone in zonegroup_conns.zones:
+ assert check_bucket_instance_metadata(zone.zone, test_bucket.name)
- # verify the bucket instance has been removed on both zones
- assert check_bucket_instance_metadata(secondary.zone, test_bucket.name)
- assert check_bucket_instance_metadata(primary.zone, test_bucket.name)
+@attr('bucket_trim')
+def test_bucket_log_trim_after_delete_bucket_secondary_reshard():
-def test_bucket_log_trim_after_delete_bucket_primary_reshard():
zonegroup = realm.master_zonegroup()
zonegroup_conns = ZonegroupConns(zonegroup)
# create a 'test' bucket
test_bucket = make_test_bucket()
- # Resharding the bucket
- primary.zone.cluster.admin(['bucket', 'reshard',
+ # Resharding the bucket on secondary
+ secondary.zone.cluster.admin(['bucket', 'reshard',
'--bucket', test_bucket.name,
- '--num-shards', '13'])
+ '--num-shards', '13',
+ '--yes-i-really-mean-it'])
# Delete the objects
for obj in ('a', 'b', 'c', 'd'):
# delete bucket and test bilog autotrim
primary.conn.delete_bucket(test_bucket.name)
-
zonegroup_data_checkpoint(zonegroup_conns)
- zonegroup_meta_checkpoint(zonegroup)
- # run bilog trim twice to clean up previous gen
- bilog_autotrim(primary.zone)
+ bilog_autotrim(secondary.zone)
time.sleep(config.checkpoint_delay)
-
- bilog_autotrim(primary.zone)
- # trim bilog on secondary
+ bilog_autotrim(secondary.zone)
+
+ for zonegroup in realm.current_period.zonegroups:
+ zonegroup_conns = ZonegroupConns(zonegroup)
+ zonegroup_meta_checkpoint(zonegroup)
+
+ for zone in zonegroup_conns.zones:
+ log.info('trimming on zone=%s', zone.name)
+ bilog_autotrim(zone.zone)
+ time.sleep(config.checkpoint_delay)
+
+ # run bilog trim twice on primary zone where the bucket was resharded
bilog_autotrim(secondary.zone)
time.sleep(config.checkpoint_delay)
- bilog_autotrim(primary.zone)
- # verify the bucket instance has been removed on both zones
- assert check_bucket_instance_metadata(primary.zone, test_bucket.name)
- assert check_bucket_instance_metadata(secondary.zone, test_bucket.name)
+ for zonegroup in realm.current_period.zonegroups:
+ for zone in zonegroup_conns.zones:
+ assert check_bucket_instance_metadata(zone.zone, test_bucket.name)
@attr('bucket_reshard')