Skip to content

rgw/multisite: retry radosgw-admin sync status on endpoint connection failures - #52812

Closed
jzhu116-bloomberg wants to merge 1 commit into
ceph:mainfrom
jzhu116-bloomberg:wip-53029
Closed

jzhu116-bloomberg wants to merge 1 commit into
ceph:mainfrom
jzhu116-bloomberg:wip-53029

Conversation

@jzhu116-bloomberg

Copy link
Copy Markdown
Contributor

Maintain endpoint connectable status in RGWRESTConn, and retry getting remote shard info upon endpoint IO failures while running radosgw-admin (data) sync status commands.

Fixes: https://tracker.ceph.com/issues/53029
Signed-off-by: Jane Zhu [email protected]

Contribution Guidelines

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
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 dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

Comment thread src/rgw/driver/rados/rgw_data_sync.cc Outdated
Comment on lines +724 to +725
for (int i = 0; i < MAX_RETRIES; i++) {
ret = run(dpp, new RGWReadRemoteDataLogInfoCR(&sc, &shards, shards_info));

@cbodley cbodley Aug 14, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i feel like these retries would be better handled at the shard level in RGWReadRemoteDataLogShardInfoCR. we shouldn't need to wait for all completions before attempting any retries

then RGWReadRemoteDataLogInfoCR doesn't need to track the set of completed shards, nor would the RGWShardCollectCR changes be needed to map errors back to their shards

same goes for the RGWReadRemoteMDLogInfoCR changes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup agree that it's the better place to handle it.
This original commit was to limit the changes only to the radosgw-admin command part so I wouldn't inadvertently introduce inappropriate logic to other workflows, until some experienced rgw developers suggested otherwise, which I got here. Thanks!
I'll make the changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wouldn't inadvertently introduce inappropriate logic to other workflows

i see what you mean. for the sync logic, i do think it's much better to handle these retries locally instead of relying on sync's higher-level retry mechanisms. those tend to be a lot more expensive, potentially requiring writes to the data sync error repo, and re-reads of sync status and replication logs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changes have been committed to move the retry logic down to RGWReadRemoteDataLogShardInfoCR and RGWReadRemoteMDLogShardInfoCR. And also add the retry to RGWListRemoteDataLogShardCR and RGWListRemoteMDLogShardCR as well. Ready to be reviewed again.

Comment thread src/rgw/rgw_rest_conn.h Outdated

CephContext *cct;
std::vector<std::string> endpoints;
std::unordered_map<std::string, conn_status> endpoints_status;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

currently, at least some of the RGWRESTConn instances are global to RGWSI_Zone and rely on the atomic counter for thread-safety. if we're adding additional state here, that would require a mutex. i'd really prefer to avoid that

is this RGWRESTConn change necessary to resolve the radosgw-admin case, or might we discuss this part in a separate pr?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This RGWRESTConn change is not necessary to resolve the radosgw-admin case, but make the logic (not only in radosgw-admin case) more efficient by avoiding some unnecessary retries.

This extra endpoints_status is only populated in the constructor of RGWRESTConn and the map won't be manipulated afterward. It's true that the status of each endpoint would be updated but I understood that it would be handled asyncly via coroutine and would not be accessed simultaneously in multi-thread env for each endpoint? I haven't dug thoroughly into the bottom of the code yet so my understanding might be wrong here..

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't dug thoroughly into the bottom of the code yet so my understanding might be wrong here..

i think you're right here. i was worried that metadata sync and data sync may share the same RGWRESTConn instance for the master zone, but i see that RGWSI_Zone creates a separate rest_master_conn for metadata sync

that said, i think it would be better for each sync thread to manage its own RGWRESTConn instance explicitly. these could be member variables of RGWDataSyncStatusManager and RGWMetaSyncStatusManager/RGWRemoteMetaLog instead of pointers; they'd only need to read the 'global' list of zone endpoints from RGWSI_Zone on construction

that encapsulation would help to prevent us from adding other thread-unsafe accesses to the members of RGWSI_Zone, and we could avoid the use of atomics in RGWRESTConn by documenting that it's not thread-safe

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yup this makes sense to me. I'll make the changes in a separate PR (as you suggested in an earlier comment) since it's not a necessary change to solve this radosgw-admin sync status issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After reading the code more carefully, I do notice that rest_master_conn is actually accessed by multiple threads: metadata sync thread, data sync thread, sync log trim thread, and rgw requests handling threads. And RGWRESTConn instance for each zone is accessed by multiple threads too.
I'll put this part in a separate PR and discuss what's the best way to handle this there.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

review of the RGWRESTConn changes

Comment thread src/rgw/rgw_rest_conn.h Outdated
Comment on lines +70 to +73
struct conn_status {
bool connectable;
ceph::real_time last_status_update;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

endpoints_status could probably just be a std::map<std::string, ceph::real_time> that only stores the failed endpoints. std::unordered_map is probably overkill when we only expect a handful of endpoints per zone. boost::container::flat_map could be a good alternative to reduce memory allocations

Comment thread src/rgw/rgw_rest_conn.cc Outdated
Comment on lines +427 to +428
if (ret == -EIO)
set_url_unconnectable(url);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread src/rgw/rgw_rest_conn.cc Outdated
Comment on lines +472 to +473
if (ret == -EIO)
set_url_unconnectable(url);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

would errors from send_request() ever indicate a connection error? my understanding is that just signs the request and enqueues it for sending. i think we should only handle the errors from complete_request()

Comment thread src/rgw/rgw_rest_conn.cc Outdated
Comment on lines +510 to +514
RGWRESTReadResource::~RGWRESTReadResource()
{
if (req_ret == -EIO) {
conn->set_url_unconnectable(url);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i'm guessing you're using destructors this way just to avoid duplicating the checks for send_request() and complete_request()? i'm hoping that we don't need the checks for send_request(), and i think it would be clearer if was in the error path itself

Comment thread src/rgw/rgw_coroutine.cc
yield return state_init();
yield return state_send_request(dpp);
yield return state_request_complete();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The reason why I added the retry logic here instead of RGWListRemoteMDLogShardCR and RGWListRemoteDataLogShardCR is that we may need this retry logic for more child classes of RGWSimpleCoroutine in the fix for https://tracker.ceph.com/issues/62710.

@jzhu116-bloomberg

Copy link
Copy Markdown
Contributor Author

all the changes in this PR have been covered in #53320. Close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants