-
Notifications
You must be signed in to change notification settings - Fork 349
DAOS-19173 pool: destroy timeout tiering and serialization #18518
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,11 +12,59 @@ | |
|
|
||
| #define D_LOGFAC DD_FAC(mgmt) | ||
|
|
||
| #include <daos_srv/bio.h> | ||
| #include <daos_srv/pool.h> | ||
| #include <daos_srv/smd.h> | ||
| #include <daos/rpc.h> | ||
|
|
||
| #include "srv_internal.h" | ||
|
|
||
| static size_t | ||
| pool_destroy_local_scm_size(uuid_t pool_uuid) | ||
| { | ||
| struct smd_pool_info *pool_info = NULL; | ||
| uint64_t eng_local_scm = 0; | ||
| int rc; | ||
|
|
||
| if (!bio_nvme_configured(SMD_DEV_TYPE_META)) | ||
| return 0; | ||
|
|
||
| rc = smd_pool_get_info(pool_uuid, &pool_info); | ||
| if (rc != 0 || pool_info == NULL) | ||
| return 0; | ||
|
|
||
| if (pool_info->spi_scm_sz > 0 && dss_tgt_nr > 0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [question] is it possible that dss_tgt_nr == 0? maybe not.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not aware of a code path in normal operation with |
||
| eng_local_scm = pool_info->spi_scm_sz * dss_tgt_nr; | ||
|
|
||
| smd_pool_free_info(pool_info); | ||
| return eng_local_scm; | ||
| } | ||
|
|
||
| static uint32_t | ||
| pool_destroy_rpc_timeout(crt_rpc_t *td_req, uuid_t pool_uuid) | ||
| { | ||
| uint32_t default_timeout; | ||
| uint32_t timeout; | ||
| size_t gib; | ||
| size_t eng_local_scm_size; | ||
| int rc; | ||
|
|
||
| rc = crt_req_get_timeout(td_req, &default_timeout); | ||
| D_ASSERTF(rc == 0, "crt_req_get_timeout: " DF_RC "\n", DP_RC(rc)); | ||
|
|
||
| eng_local_scm_size = pool_destroy_local_scm_size(pool_uuid); | ||
| if (eng_local_scm_size == 0) | ||
| return default_timeout; | ||
|
|
||
| gib = eng_local_scm_size / ((size_t)1024 * 1024 * 1024); | ||
| if (gib < 1024) | ||
| timeout = 90; | ||
| else | ||
| timeout = 180; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] probably define a macro is better.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense. If I refresh the patch, I can convert the values to named macros. It probably makes sense to do the same for SCM thresholds in |
||
| return max(timeout, default_timeout); | ||
| } | ||
|
|
||
| /** Destroy the pool on the specified ranks. */ | ||
| int | ||
| ds_mgmt_tgt_pool_destroy_ranks(uuid_t pool_uuid, d_rank_list_t *filter_ranks) | ||
|
|
@@ -27,6 +75,7 @@ ds_mgmt_tgt_pool_destroy_ranks(uuid_t pool_uuid, d_rank_list_t *filter_ranks) | |
| unsigned int opc; | ||
| int topo; | ||
| int rc; | ||
| uint32_t timeout; | ||
| uint8_t mgmt_ver; | ||
|
|
||
| rc = ds_mgmt_rpc_protocol(&mgmt_ver); | ||
|
|
@@ -45,6 +94,11 @@ ds_mgmt_tgt_pool_destroy_ranks(uuid_t pool_uuid, d_rank_list_t *filter_ranks) | |
| D_ASSERT(td_in != NULL); | ||
| uuid_copy(td_in->td_pool_uuid, pool_uuid); | ||
|
|
||
| timeout = pool_destroy_rpc_timeout(td_req, pool_uuid); | ||
| crt_req_set_timeout(td_req, timeout); | ||
| D_DEBUG(DB_MGMT, DF_UUID ": setting pool destroy CoRPC timeout: %u sec\n", | ||
| DP_UUID(pool_uuid), timeout); | ||
|
|
||
| rc = dss_rpc_send(td_req); | ||
| if (rc == 0 && DAOS_FAIL_CHECK(DAOS_POOL_DESTROY_FAIL_CORPC)) | ||
| rc = -DER_TIMEDOUT; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[minor] looks rc == 0, pool_info is always no NULL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Checking pool_info is unnecessarily defensive for the existing API. If I need to push another version of the patch I can simplify the check to be based on rc only.