Skip to content

Commit

Permalink
DAOS-15431 vos: clear DTX in CoS cache for the one committed by other…
Browse files Browse the repository at this point in the history
… - b24

It is possible that the DTX is committed locally via commit-on-share
mechanism during some subsequent modification. But such modification
may get failure on some remote paraticipant. Then the DTX entry will
not be removed from CoS cache under such case because we do not know
whether such DTX has already been committed on remote participant(s)
successfully or not. Keeping it in CoS cache will allow us to re-try
the commit globally sometime later.

Next time, when we re-try to commit such DTX globally, if all remote
participants claim as done (return 0 or DER_NONEXIST or DER_ALREADY)
successfully, then even if local VOS calims as DER_ALREADY, we still
need to remove the DTX entry from CoS cache. Otherwise, we will find
such DTX entry in the CoS cache everytime for batched commit (or DTX
resync) as to block related process.

Signed-off-by: Fan Yong <[email protected]>
  • Loading branch information
Nasf-Fan committed May 7, 2024
1 parent 8d4a74b commit 7d1c5a5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/dtx/dtx_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,7 @@ dtx_end(struct dtx_handle *dth, struct ds_cont_child *cont, int result)
static void
dtx_flush_on_close(struct dss_module_info *dmi, struct dtx_batched_cont_args *dbca)
{
struct dss_xstream *dx = dss_current_xstream();
struct ds_cont_child *cont = dbca->dbca_cont;
struct dtx_stat stat = { 0 };
uint64_t total = 0;
Expand All @@ -1564,7 +1565,8 @@ dtx_flush_on_close(struct dss_module_info *dmi, struct dtx_batched_cont_args *db
dtx_stat(cont, &stat);

/* dbca->dbca_reg_gen != cont->sc_dtx_batched_gen means someone reopen the container. */
while (dbca->dbca_reg_gen == cont->sc_dtx_batched_gen && rc >= 0) {
while (!dss_xstream_exiting(dx) &&
dbca->dbca_reg_gen == cont->sc_dtx_batched_gen && rc >= 0) {
struct dtx_entry **dtes = NULL;
struct dtx_cos_key *dcks = NULL;

Expand Down Expand Up @@ -2197,10 +2199,11 @@ int
dtx_obj_sync(struct ds_cont_child *cont, daos_unit_oid_t *oid,
daos_epoch_t epoch)
{
int cnt;
int rc = 0;
struct dss_xstream *dx = dss_current_xstream();
int cnt;
int rc = 0;

while (dtx_cont_opened(cont)) {
while (!dss_xstream_exiting(dx) && (dtx_cont_opened(cont) || oid == NULL)) {
struct dtx_entry **dtes = NULL;
struct dtx_cos_key *dcks = NULL;

Expand Down
3 changes: 2 additions & 1 deletion src/vos/vos_dtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ vos_dtx_commit_one(struct vos_container *cont, struct dtx_id *dti, daos_epoch_t
if (rc != 0)
D_FREE(dce);

if (rm_cos != NULL && (rc == 0 || rc == -DER_NONEXIST))
if (rm_cos != NULL &&
(rc == 0 || rc == -DER_NONEXIST || (rc == -DER_ALREADY && dae == NULL)))
*rm_cos = true;

return rc;
Expand Down

0 comments on commit 7d1c5a5

Please sign in to comment.