Commit Graph

131715 Commits

Author SHA1 Message Date
Adam C. Emerson
c2b2138e41 rgw: Compare log.gen to log.gen
And refuse to remove the only log.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:33 -04:00
Adam C. Emerson
010b3ad04a rgw: Don't erase bucket attributes on trim
Writing bucket instance info is surprising, as if you pass a null
pointer for the attributes, it just erases all the attributes.

To avoid disturbing users and other 'system objects', make a special
case that we can pass in explicitly.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2022-05-27 15:47:33 -04:00
Yuval Lifshitz
9eab2dbc97 rgw/reshard: resolve inconsistent cache warnings
use an API that does not check for cache inconsistency
hence, "WARNING: The bucket info cache is inconsistent" warnings is removed from reshard

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
c3ccb1adb4 test/rgw: test_bucket_reshard verifies that ACLs are preserved
Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
J. Eric Ivancich
f0080c24b3 rgw: save bucket instance xattrs when resharding cancelled
There appears to be a long-standing bug in RGW such that when
resharding is cancelled and the bucket instance is updated to reflect
the new resharding status, the xattrs were lost. The xattrs are used
to store metadata such as ACLs and LifeCycle policies.

This commit makes sure that all call paths that lead to a cancelled
reshard provide the xattrs, so they can be included when the bucket
instance info is updated.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
2022-05-27 15:47:33 -04:00
J. Eric Ivancich
267bd85e7d rgw: resharding causes bucket attributes to be lost
With the new resharding code, some bucket metadata that is stored as
xattrs (e.g., ACLs, life-cycle policies) were not sent with the
updated bucket instance data when resharding completed. As a result,
resharding has a regression where that metadata is lost after a
successful reshard.

This commit restores the variable in the RGWBucketReshard class that
maintains the bucket attributes, so they can be saved when the bucket
instance object is updated.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
2022-05-27 15:47:33 -04:00
J. Eric Ivancich
10b785816f rgw: add indexless bucket logic to "bucket radoslist"
The "bucket radoslist" sub-command of radosgw-admin is supposed to
list all rados objects tied to one or all directories and thereby
provide a way to determine orphaned rados objects.

But indexless buckets don't provide an index to employ for this
purpose. So warnings or errors should be provided depending on the
circumstances.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
2022-05-27 15:47:33 -04:00
J. Eric Ivancich
194b0de182 rgw: update indexless bucket check for bucket stats
The code for bucket stats was recently updated to check for an
indexless bucket before proceeding. The interface on RGWBucketInfo was
recently expanded to support these types of checks, so it is now used.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
2022-05-27 15:47:33 -04:00
J. Eric Ivancich
177bb80cd5 rgw: add streamlined ways to handle indexless buckets correctly
Determining whether a bucket is indexless starting with an
RGWBucketInfo object requires traversing multiple data structures and
"inside knowledge" blurring the line between interface and
implementation. The same applies for retrieving the current index for
non-indexless buckets.

This commit adds to the RGWBucketInfo interface to make this
information readily accessible.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
2022-05-27 15:47:33 -04:00
Yuval Lifshitz
98e72261ea rgw/multisite: add type to RGW_OP_SYNC_DATALOG_NOTIFY2
without that the following errors are happening during sync:

ERROR: AWS4 completion for operation: 0, NOT IMPLEMENTED
op->ERRORHANDLER: err_no=-2201 new_err_no=-2201

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
2022-05-27 15:47:33 -04:00
J. Eric Ivancich
e0eb3d8c22 rgw: radosgw-admin bucket stats on indexless bucket crashes
The new bucket layout code didn't check whether the bucket is
indexless prior to asking for the last entry in the layout log. The
layout log appears to be empty for an indexless bucket, thereby
putting the runtime in an undefined state that later may cause a
failed assertion.

This commit adds two safety checks and returns -EINVAL along with
putting useful information on stderr when either stats are requested
on an indexless bucket or when the layout log is empty.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
2022-05-27 15:47:33 -04:00
Yuval Lifshitz
030ec8e44d rgw: fix reshard cancelling race condition
this is happening when resharding while objects are uploaded
tests steps are here:
https://gist.github.com/yuvalif/060f66f03511bff881e952287df3087b

Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
bd72bc9903 rgw: preserve 'bucket sync disable' over reshard
if bucket sync is disabled, apply that flag to new index objects on
bucket reshard

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
aaf4bc134f rgw/multisite: handle shard_progress correctly in RunBucketSources
we run bucket sync on each of the sync pipes, so size the vector
accordingly

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
ae27b46d45 Revert "rgw: cr: add prealloc_stack()"
This reverts commit 7970f35549.

Signed-off-by: Casey Bodley <cbodley@redhat.com>
2022-05-27 15:47:33 -04:00
Casey Bodley
dee6278722 Revert "rgw: bucket sync: track progress by stack id"
This reverts commit c0baf3eb34.

Signed-off-by: Casey Bodley <cbodley@redhat.com>

Conflicts:
	src/rgw/rgw_data_sync.cc no longer loops over num_shards
2022-05-27 15:47:33 -04:00
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