Commit Graph

131699 Commits

Author SHA1 Message Date
Casey Bodley
91fe8d464a rgw/multisite: RunBucketSourcesSync no longer takes optional target
RGWDataSyncSingleEntryCR is the only caller of RGWRunBucketSourcesSyncCR

it always provides a source_bs, and never provides a target_bs. so remove
all the complexity related to target_bs, and the idea that we'd need to
sync several source bucket shards related to the target bucket

we now just have the single loop over the target buckets that use the
given bucket as a source

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
a0e9a59246 radosgw-admin: allow reshard commands in multisite on secondary
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
a50d6ad12d rgw: fix for uninitialized oldest_gen/latest_gen
when data sync queries RGWOp_BILog_Info from an un-upgraded gateway, it
doesn't include the oldest_gen/latest_gen fields. so initialize these
variables to 0 by default

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
60ecef0c8a rgw: enable RGWReshard thread on any zone that supports it
enable the background dynamic resharding thread based on
RGWSI_Zone::can_reshard(), which takes the zonegroup features into
account

Fixes: https://tracker.ceph.com/issues/52877

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
9b6a1a8e0b rgw: prevent reshard from creating too many log generations
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Shilpa Jagannath
6457a66b7a rgw: remove per-shard sync status object after incremental sync finishes
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
58b026965c radosgw-admin: bucket sync status guards against shard count mismatch
if the remote gives us more shards than we expect, just count those
shards as 'behind' and avoid out-of-bounds access of shard_status

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
99fe9eb7b7 radosgw-admin: bucket sync status handles missing full status
if the full sync status object is missing, it's possible that we just
haven't started syncing it again after upgrading from just the per-shard
status objects

in this case, as long as we have a log generation 0, assume that we just
haven't initialized the full status object and try to read the gen=0
per-shard incremental status for comparison

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
0ac4d7bb28 rgw: rgw_read_bucket_inc_sync_status doesn't need bucket info
all we need to construct the per-shard bucket sync status object names
are the bucket names themselves, which we already have from
rgw_sync_bucket_pipe

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
c2f707786f rgw: resize status vector before reading inc_sync_status
rgw_read_bucket_inc_sync_status() uses the size of this vector as the
'num_shards', so we need to resize it appropriately beforehand

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
6dbfe10306 rgw: RGWOp_BILog_Status reads full status unconditionally
the calls to rgw_read_bucket_inc_sync_status() depend on
sync_status.incremental_gen, which we need to read via
rgw_read_bucket_full_sync_status() regardless of whether
we're returning it to the client (version > 1)

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Adam C. Emerson
d50acd9296 rgw: RGWCollectBucketSyncStatusCR doesn't need the shard count
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:33 -04:00
Adam C. Emerson
b461c0d5b3 rgw: RunBucketSourceSync uses num_shards from remote bilog info
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:33 -04:00
Adam C. Emerson
718234f994 rgw: RGWListBucketIndexesCR only needs zero shard
We only need to check one shard, and everything has shard zero.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:33 -04:00
Adam C. Emerson
3877c35068 rgw: sync checkpoint gets num_shards from remote bilog info
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:33 -04:00
Adam C. Emerson
c2fd1bda79 rgw: RGWRemoteBucketManager constructor takes num_shards
The logic for getting it was moved to its caller.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:33 -04:00
Adam C. Emerson
c4dc861263 rgw: InitBucketFullSyncStatusCR gets num shards from remote
As specified in rgw_bucket_index_marker_info, unless we're doing the
compatibility check, in which case we look at generation 0.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:33 -04:00
Shilpa Jagannath
df730b5d34 rgw: read shard count using remote bilog info during bucket sync
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
24ecdeab1f doc/rgw: document zone features
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
ab964c5e0a rgw: RGWSI_Zone::can_reshard() respects zonegroup 'resharding' feature
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
fe991ba650 radosgw-admin: 'sync status' shows enabled/disabled zonegroup features
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
ab000c96a3 radosgw-admin: zone/zonegroup commands support --enable-feature=x --disable-feature=y
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
2dfa4747f2 rgw: add set of 'features' to zone and zonegroup
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
b2c6a30c21 json: encoding for flat_set accepts all template params
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Yuval Lifshitz
b44b71ab08 rgw/multisite: don't delete per shard status on init
and pass correct generation and num shards when deleting
per shard status objects when disabling during incremental sync

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
2022-05-27 15:47:32 -04:00
Yuval Lifshitz
d7c94b0112 rgw/multisite: support enable right after disable
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
2022-05-27 15:47:32 -04:00
Yuval Lifshitz
072220eecd rgw/multisite: remove the retry mechanism
when writign the sync status object

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
2022-05-27 15:47:32 -04:00
Yuval Lifshitz
9ebebc3c66 rgw/multisite: allow bucket sync disable/enable
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
2022-05-27 15:47:32 -04:00
Yuval Lifshitz
bfc1b7ec68 rgw/multisite: track shard sync status objects per generation
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
dc8ae698ad rgw: remove destination shard id from rgw_bucket_sync_pair_info
the sync_pair is used as input to RGWBucketPipeSyncStatusManager::status_oid()
to generate the per-shard sync status object names

this sync status tracks incremental bucket sync, which reads changes
from a source bucket's bilog shard, and copies objects from the remote
source bucket to the local destination bucket

this doesn't require sync to know anything about the destination bucket
shards, so rgw_bucket_sync_pair_info and status_oid() now only track the
the destination's rgw_bucket instead of rgw_bucket_shard

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
9ad677b965 rgw: Trim old generations in BucketTrimInstanceCR
Only one generation per call.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
899596f650 rgw: Add RGWRadosRemoveOidCR
A more generally applicable way of removing objects in coroutines.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
da525470fb rgw: Add RGWAsyncPutBucketInstanceInfoCR
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
485fa04fe8 rgw: Trim bilog with generation
From the REST interface and radosgw-admin. Assume Generation 0 if none
provided and error if it doesn't exist.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
55af2e10c7 rgw: Bilog trim takes markers as string view
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
826fe361fb common: get_str_vec takes std::string_view
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
cb033837a1 rgw: BucketInstanceTrimCR knows about generations
Fetch the current generation from remote peers and trim the minimum
marker on the minimum generation.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
817ddf8ea6 rgw: Add cast from bucket_index_log_layout
To bucket_index_layout_generation

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Adam C. Emerson
2362982b4e rgw: add sync_info to BILog_Status output
Needed so we can get the incremental generation.

Guard this behind a version check and return the original output if
less than 2.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:32 -04:00
Shilpa Jagannath
09e94be95f rgw: fix incremental sync by using the right generation for bilog listing
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
2022-05-27 15:47:32 -04:00
Shilpa Jagannath
0e2217a592 rgw: on bucket reshard, write datalog entries for each shard of the previous generation
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
8521fb2be0 qa/rgw: temporarily disable multisite reshard tests
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
da2655c5ef test/rgw: add multisite test for full sync after reshard
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
8166a4c7a0 test/rgw: add simple multisite reshard test
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
c62bfa9f4f radosgw-admin: 'bucket sync checkpoint' waits for generation to catch up
poll on rgw_read_bucket_full_sync_status() until
full_status.incremental_gen catches up to the latest_gen we got from
rgw_read_remote_bilog_info()

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
820c94b0fc rgw: get_bucket_instance_ids() uses num_shards from layout
knock out a TODO that was causing this assertion failure in
RGWRados::get_bucket_stats() after a reshard:

  ceph_assert(headers.size() == bucket_instance_ids.size());

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
8f264278fc rgw: rgw_read_remote_bilog_info() returns rgw_bucket_index_marker_info
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Shilpa Jagannath
5b8d2b881d rgw: adding generation number to async notification
Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
cf160da178 rgw: add custom json encode/decode for the v1 notify API
this adds wrapper structs rgw_data_notify_v1_encoder and
rgw_data_notify_v1_decoder that can encode/decode the v1 json format
directly on the v2 data structure

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00
Casey Bodley
1c2e290fbc test/rgw: fix python error on test failure
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:32 -04:00