Skip to content

Commit

Permalink
DAOS-16876 vos: skip DTX record when load partial committed DTX
Browse files Browse the repository at this point in the history
It is used to handle existing partial committed DTX records that were
generated when ran as DAOS-2.6.3-rc{1,2} to avoid repeated DTX commit
after engine restarted.

To be safe, it is required for the user/admin to explicitly set server
side environment variable "DAOS_SKIP_OLD_PARTIAL_DTX" when restart the
engine that has ever run as DAOS-2.6.3-rc{1,2}. If the user has never
used such version, such as directly upgrading from 2.6.1 to 2.6.3-rc3
or newer, then please do NOT set this environment variable.

Signed-off-by: Fan Yong <[email protected]>
  • Loading branch information
Nasf-Fan committed Feb 11, 2025
1 parent 708abf2 commit d8e55c4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/vos/vos_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,14 @@ vos_mod_init(void)
d_getenv_bool("DAOS_DKEY_PUNCH_PROPAGATE", &vos_dkey_punch_propagate);
D_INFO("DKEY punch propagation is %s\n", vos_dkey_punch_propagate ? "enabled" : "disabled");

/*
* NOTE: It is used to skip old partial committed DTX records that were generated when
* ran as DAOS-2.6.3-rc{1,2}. If the user has never used such version, please do
* NOT set this environment variable.
*/
d_getenv_bool("DAOS_SKIP_OLD_PARTIAL_DTX", &vos_skip_old_partial_dtx);
D_INFO("%s old partial committed DTX record\n", vos_skip_old_partial_dtx ? "Skip" : "Keep");

vos_agg_gap = VOS_AGG_GAP_DEF;
d_getenv_uint("DAOS_VOS_AGG_GAP", &vos_agg_gap);
if (vos_agg_gap < VOS_AGG_GAP_MIN || vos_agg_gap > VOS_AGG_GAP_MAX) {
Expand Down
7 changes: 6 additions & 1 deletion src/vos/vos_dtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
DAE_EPOCH(dae)); \
} while (0)

bool vos_skip_old_partial_dtx;

static inline uint32_t
dtx_umoff_flag2type(umem_off_t umoff)
{
Expand Down Expand Up @@ -706,7 +708,7 @@ dtx_rec_release(struct vos_container *cont, struct vos_dtx_act_ent *dae, bool ab
* If it is required to keep the active DTX entry, then it must be for partial
* commit. Let's mark it as DTE_PARTIAL_COMMITTED.
*/
if ((DAE_FLAGS(dae) & DTE_PARTIAL_COMMITTED))
if (DAE_FLAGS(dae) & DTE_PARTIAL_COMMITTED)
return 0;

rc = umem_tx_add_ptr(umm, &dae_df->dae_flags, sizeof(dae_df->dae_flags));
Expand Down Expand Up @@ -3235,6 +3237,9 @@ vos_dtx_act_reindex(struct vos_container *cont)
dae->dae_need_release = 1;
D_INIT_LIST_HEAD(&dae->dae_link);

if (vos_skip_old_partial_dtx && DAE_FLAGS(dae) & DTE_PARTIAL_COMMITTED)
DAE_REC_CNT(dae) = 0;

if (DAE_REC_CNT(dae) > DTX_INLINE_REC_CNT) {
size_t size;
int count;
Expand Down
1 change: 1 addition & 0 deletions src/vos/vos_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ extern uint32_t vos_agg_gap;

extern unsigned int vos_agg_nvme_thresh;
extern bool vos_dkey_punch_propagate;
extern bool vos_skip_old_partial_dtx;

static inline uint32_t vos_byte2blkcnt(uint64_t bytes)
{
Expand Down

0 comments on commit d8e55c4

Please sign in to comment.