Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: cls_bucket_list_unordered() might return one redundent entry every time is_truncated is true #42151

Merged
merged 1 commit into from Oct 22, 2021

Conversation

chapche
Copy link

@chapche chapche commented Jul 2, 2021

cls_bucket_list_unordered() might return one redundent entry, which is returned last loop when number of incomplete multipart upload in index shards exceeds 1100. This is because when count == num_entries, last_added_entries is not updated. This is really easy to reproduce. And it could be observed in rgw's log that start_after entry for next loop is not the last entry returned last loop. Although this is not fatal but it still turns out that the code is not working as expected.

Fixes: https://tracker.ceph.com/issues/51466
Signed-off-by: Peng Zhang zhangpeng@vclusters.com

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

RGWRados::cls_bucket_list_unordered() will produce one redundent entry
every time is_truncated is true.The issue could be easily reproduced
when a bucket is filled with amounts of incomplete multipart upload.
To be more specific, the number of incomplete multipart upload objects
should be greater than 1100.

Signed-off-by: Peng Zhang <zhangpeng@vclusters.com>
@github-actions github-actions bot added the rgw label Jul 2, 2021
@chapche
Copy link
Author

chapche commented Jul 5, 2021

@ivancich Hello, please review when you have a moment, many thanks!

@cbodley cbodley requested a review from ivancich July 15, 2021 14:22
Copy link
Member

@ivancich ivancich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your point makes sense. I know it's a big ask, but would you be willing to add a test for this issue?

Comment on lines 8716 to 8728
string index_hash_source = obj_key.name;
if (obj_key.ns == RGW_OBJ_NS_MULTIPART) {
// Use obj_key.ns == RGW_OBJ_NS_MULTIPART instead of
// the implementation relying on MultipartMetaFilter
// because MultipartMetaFilter only checks .meta suffix, which may
// exclude data multiparts but include some regular objects with .meta suffix
// by mistake.
string index_hash_source;
r = parse_index_hash_source(obj_key.name, &index_hash_source);
if (r < 0) {
return r;
}
current_shard = svc.bi_rados->bucket_shard_index(index_hash_source, num_shards);
} else {
current_shard = svc.bi_rados->bucket_shard_index(obj_key.name, num_shards);
}
}
current_shard = svc.bi_rados->bucket_shard_index(index_hash_source, num_shards);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these changes actually modify the logic? My reading is that the logic is the same, except that the updated code can have an unnecessary string copy when iterating over multipart entries.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no,the logic is basically the same. There will be an unnecessary string copy.

@@ -8780,6 +8778,7 @@ int RGWRados::cls_bucket_list_unordered(const DoutPrefixProvider *dpp,
ent_list.emplace_back(std::move(dirent));
++count;
} else {
last_added_entry = dirent.key;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this alone is the solution, right?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely right!

@ivancich ivancich self-requested a review August 17, 2021 16:00
Copy link
Member

@ivancich ivancich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm going to request that you keep the solution on line 8781 and remove the other changes. I'd be happy to approve it then. I'd rather not include an unnecessary string copy, although I see where you were going with that.

Thanks for figuring this out!

@chapche
Copy link
Author

chapche commented Aug 23, 2021

So I'm going to request that you keep the solution on line 8781 and remove the other changes. I'd be happy to approve it then. I'd rather not include an unnecessary string copy, although I see where you were going with that.

Thanks for figuring this out!

Sorry for the late reply. After some struggling, it is obvious that this unnecessary string copy is inevitable for the purpose of reducing if-else blocks. So the commit introducing string copy is abandoned according to your request, and now there is only one commit which contains the solution left. Thank you very much for your professional suggestion!

@ivancich ivancich added needs-qa and removed core labels Aug 23, 2021
@ivancich ivancich added the wip-eric-testing-1 for ivancich testing label Sep 2, 2021
@ivancich ivancich merged commit 0deb744 into ceph:master Oct 22, 2021
@ivancich ivancich removed needs-qa wip-eric-testing-1 for ivancich testing labels Oct 22, 2021
@ivancich
Copy link
Member

@chapche Would you check to see if this needs backports? If so, we need to update the tracker appropriately. Thanks!

@chapche
Copy link
Author

chapche commented Oct 22, 2021

@chapche Would you check to see if this needs backports? If so, we need to update the tracker appropriately. Thanks!

Yes, backports are needed.

@ivancich
Copy link
Member

@chapche Would you check to see if this needs backports? If so, we need to update the tracker appropriately. Thanks!

Yes, backports are needed.

@chapche : You didn't update the tracker, so I did to say that octopus and pacific backports are required. We'll see if they're clean or not.

@ivancich
Copy link
Member

ivancich commented Aug 4, 2023

This commit needs to be reverted as it seems to have caused this issue: https://tracker.ceph.com/issues/59400 . And in taking a closer look at this commit, it clearly seems wrong.

@chapche , would you provide a minimal producer of the error you describe? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants