Project

General

Profile

Actions

Bug #62760

closed

versioned bucket stats can be incorrect after reshard or radosgw-admin bucket check --fix

Added by Cory Snyder 8 months ago. Updated 6 months ago.

Status:
Resolved
Priority:
High
Assignee:
Target version:
-
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
Regression:
No
Severity:
2 - major
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

When a S3 PUT operation creates a new object in a versioned bucket, the bucket index instance entry is created and bucket stats are incremented prior to the object being "linked" into the index via the creation of an associated plain-versioned index entry. When a S3 DELETE operation deletes an object from a versioned bucket, the process happens in reverse; the object is "unlinked" from the index, via the deletion of the associated plain-versioned index entry, prior to the instance entry being removed and the bucket stats being decremented. The instance entries are therefore the "source of truth" for bucket stats with respect to these operations.

When a bucket is resharded, the bucket stats for each shard must be recomputed since each shard stores its own stats in the header. The current code that performs the accounting for stats on new index shards during the resharding process uses only plain index entries. Likewise, the code that implements the `radosgw-admin bucket check --fix` operation also uses only plain index entries. The plain entries are therefore the "source of truth" for bucket stats with respect to these operations.

This dichotomy between how the stats are derived permits inaccuracies. For example, consider the case where a PUT operation is already in progress when a reshard starts on the relevant bucket. The reshard starts after the PUT operation had created the object and accounted for the new object version in the "old" bucket header stats, but hadn't yet "linked" the object into the index by creating the associated plain entry. Because the plain-versioned entry is not yet created, the reshard would not include this object in the new bucket shard's stats - the stats now show an object count and bucket size that are less than the true values. Let's say the reshard completes, the PUT operation finishes, and we subsequently delete all objects in the bucket. The bucket stats will roll under zero because the DELETE operation will decrement the size of our subject object despite the fact that it wasn't accounted for in the stats. We end up with bucket stats reporting usage just under 2^64. The same scenario can happen with a DELETE request that is in progress during a reshard or with other "unlinked" objects that can be created as a result of errors that interrupt bucket index transactions.

To solve the issue, we should consistently use instance entries as the "source of truth" for bucket stat accounting, across all relevant operations.


Related issues 1 (0 open1 closed)

Related to rgw - Bug #62075: New radosgw-admin commands to cleanup leftover OLH index entries and unlinked instance objectsResolvedCory Snyder

Actions
Actions #1

Updated by Casey Bodley 7 months ago

  • Status changed from New to In Progress
  • Backport changed from reef quincy pacific to reef quincy

i haven't seen a PR for this yet, but there is some work in progress in https://github.com/cfsnyder/ceph/commits/wip-62760

Actions #2

Updated by Cory Snyder 6 months ago

  • Status changed from In Progress to Resolved
  • Backport deleted (reef quincy)
  • Pull request ID set to 52576

The fix for this was included as part of the fix for https://tracker.ceph.com/issues/62075. It was already backported to pacific, quincy, and reef.

Actions #3

Updated by Cory Snyder 6 months ago

  • Related to Bug #62075: New radosgw-admin commands to cleanup leftover OLH index entries and unlinked instance objects added
Actions

Also available in: Atom PDF