Skip to content

Commit

Permalink
Revert "DAOS-11406 rdb: Use VOS local TXs (#12330)"
Browse files Browse the repository at this point in the history
This reverts commit b9b4f29.

Test-tag: test_daos_vol_mpich test_ior_small test_mdtest_small test_osa_online_drain_oclass test_create_pool_quantity test_aggregation_punching test_smallfilecount
Skip-func-hw-test-medium-md-on-ssd: false
Skip-func-hw-test-medium: true
Quick-Functional: true
Required-githooks: true

Signed-off-by: Mohamad Chaarawi <[email protected]>
Priority: 2
  • Loading branch information
mchaarawi committed Apr 19, 2024
1 parent 0c3e72f commit 03d30b3
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 339 deletions.
12 changes: 7 additions & 5 deletions src/rdb/rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
static int rdb_open_internal(daos_handle_t pool, daos_handle_t mc, const uuid_t uuid,
uint64_t caller_term, struct rdb_cbs *cbs, void *arg,
struct rdb **dbp);
static int
rdb_chkptd_start(struct rdb *db);
static void
rdb_chkptd_stop(struct rdb *db);

/**
* Create an RDB replica at \a path with \a uuid, \a size, and \a replicas, and
Expand Down Expand Up @@ -71,7 +75,8 @@ rdb_create(const char *path, const uuid_t uuid, uint64_t caller_term, size_t siz

/* Initialize the layout version. */
d_iov_set(&value, &version, sizeof(version));
rc = rdb_mc_update(mc, RDB_MC_ATTRS, 1 /* n */, &rdb_mc_version, &value, NULL /* vtx */);
rc = rdb_mc_update(mc, RDB_MC_ATTRS, 1 /* n */, &rdb_mc_version,
&value);
if (rc != 0)
goto out_mc_hdl;

Expand All @@ -85,7 +90,7 @@ rdb_create(const char *path, const uuid_t uuid, uint64_t caller_term, size_t siz
* rdb_start() checks this attribute when starting a DB.
*/
d_iov_set(&value, (void *)uuid, sizeof(uuid_t));
rc = rdb_mc_update(mc, RDB_MC_ATTRS, 1 /* n */, &rdb_mc_uuid, &value, NULL /* vtx */);
rc = rdb_mc_update(mc, RDB_MC_ATTRS, 1 /* n */, &rdb_mc_uuid, &value);
if (rc != 0)
goto out_mc_hdl;

Expand Down Expand Up @@ -224,9 +229,6 @@ rdb_lookup(const uuid_t uuid)
return rdb_obj(entry);
}

static int rdb_chkptd_start(struct rdb *db);
static void rdb_chkptd_stop(struct rdb *db);

/*
* If created successfully, the new DB handle will consume pool and mc, which
* the caller shall not close in this case.
Expand Down
46 changes: 21 additions & 25 deletions src/rdb/rdb_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ int rdb_send_raft_rpc(crt_rpc_t *rpc, struct rdb *db);
int rdb_abort_raft_rpcs(struct rdb *db);
void rdb_recvd(void *arg);

/* rdb_tx.c *******************************************************************/

int rdb_tx_apply(struct rdb *db, uint64_t index, const void *buf, size_t len,
void *result, bool *critp);

/* rdb_kvs.c ******************************************************************/

/* KVS cache entry */
Expand Down Expand Up @@ -347,11 +352,6 @@ void rdb_anchor_from_hashes(struct rdb_anchor *anchor,
daos_anchor_t *akey_anchor,
daos_anchor_t *ev_anchor, daos_anchor_t *sv_anchor);

struct dtx_handle;
typedef struct dtx_handle *rdb_vos_tx_t;

int rdb_vos_tx_begin(struct rdb *db, int nvops, rdb_vos_tx_t *vtx);
int rdb_vos_tx_end(struct rdb *db, rdb_vos_tx_t vtx, int err);
int rdb_vos_fetch(daos_handle_t cont, daos_epoch_t epoch, rdb_oid_t oid,
daos_key_t *akey, d_iov_t *value);
int rdb_vos_fetch_addr(daos_handle_t cont, daos_epoch_t epoch, rdb_oid_t oid,
Expand All @@ -362,10 +362,10 @@ int rdb_vos_iter_fetch(daos_handle_t cont, daos_epoch_t epoch, rdb_oid_t oid,
daos_key_t *akey_out, d_iov_t *value);
int rdb_vos_iterate(daos_handle_t cont, daos_epoch_t epoch, rdb_oid_t oid,
bool backward, rdb_iterate_cb_t cb, void *arg);
int rdb_vos_update(daos_handle_t cont, daos_epoch_t epoch, rdb_oid_t oid, bool crit, int n,
d_iov_t akeys[], d_iov_t values[], rdb_vos_tx_t vtx);
int rdb_vos_punch(daos_handle_t cont, daos_epoch_t epoch, rdb_oid_t oid, int n, d_iov_t akeys[],
rdb_vos_tx_t vtx);
int rdb_vos_update(daos_handle_t cont, daos_epoch_t epoch, rdb_oid_t oid,
bool crit, int n, d_iov_t akeys[], d_iov_t values[]);
int rdb_vos_punch(daos_handle_t cont, daos_epoch_t epoch, rdb_oid_t oid, int n,
d_iov_t akeys[]);
int rdb_vos_discard(daos_handle_t cont, daos_epoch_t low, daos_epoch_t high);
int rdb_vos_aggregate(daos_handle_t cont, daos_epoch_t high);

Expand All @@ -378,13 +378,14 @@ int rdb_vos_aggregate(daos_handle_t cont, daos_epoch_t high);

/* Update n (<= RDB_VOS_BATCH_MAX) a-keys atomically. */
static inline int
rdb_mc_update(daos_handle_t mc, rdb_oid_t oid, int n, d_iov_t akeys[], d_iov_t values[],
rdb_vos_tx_t vtx)
rdb_mc_update(daos_handle_t mc, rdb_oid_t oid, int n, d_iov_t akeys[],
d_iov_t values[])
{
D_DEBUG(DB_TRACE, "mc="DF_X64" oid="DF_X64" n=%d akeys[0]=<%p, %zd> "
"values[0]=<%p, %zd>\n", mc.cookie, oid, n, akeys[0].iov_buf,
akeys[0].iov_len, values[0].iov_buf, values[0].iov_len);
return rdb_vos_update(mc, RDB_MC_EPOCH, oid, true /* crit */, n, akeys, values, vtx);
return rdb_vos_update(mc, RDB_MC_EPOCH, oid, true /* crit */, n,
akeys, values);
}

static inline int
Expand All @@ -399,19 +400,19 @@ rdb_mc_lookup(daos_handle_t mc, rdb_oid_t oid, d_iov_t *akey,
}

static inline int
rdb_lc_update(daos_handle_t lc, uint64_t index, rdb_oid_t oid, bool crit, int n, d_iov_t akeys[],
d_iov_t values[], rdb_vos_tx_t vtx)
rdb_lc_update(daos_handle_t lc, uint64_t index, rdb_oid_t oid, bool crit,
int n, d_iov_t akeys[], d_iov_t values[])
{
D_DEBUG(DB_TRACE, "lc="DF_X64" index="DF_U64" oid="DF_X64
" n=%d akeys[0]=<%p, %zd> values[0]=<%p, %zd>\n", lc.cookie,
index, oid, n, akeys[0].iov_buf, akeys[0].iov_len,
values[0].iov_buf, values[0].iov_len);
return rdb_vos_update(lc, index, oid, crit, n, akeys, values, vtx);
return rdb_vos_update(lc, index, oid, crit, n, akeys, values);
}

static inline int
rdb_lc_punch(daos_handle_t lc, uint64_t index, rdb_oid_t oid, int n, d_iov_t akeys[],
rdb_vos_tx_t vtx)
rdb_lc_punch(daos_handle_t lc, uint64_t index, rdb_oid_t oid, int n,
d_iov_t akeys[])
{
if (n > 0)
D_DEBUG(DB_TRACE, "lc="DF_X64" index="DF_U64" oid="DF_X64
Expand All @@ -420,7 +421,7 @@ rdb_lc_punch(daos_handle_t lc, uint64_t index, rdb_oid_t oid, int n, d_iov_t ake
else
D_DEBUG(DB_TRACE, "lc="DF_X64" index="DF_U64" oid="DF_X64
" n=%d\n", lc.cookie, index, oid, n);
return rdb_vos_punch(lc, index, oid, n, akeys, vtx);
return rdb_vos_punch(lc, index, oid, n, akeys);
}

/* Discard index range [low, high]. */
Expand Down Expand Up @@ -488,12 +489,7 @@ rdb_lc_iterate(daos_handle_t lc, uint64_t index, rdb_oid_t oid, bool backward,
return rdb_vos_iterate(lc, index, oid, backward, cb, arg);
}

int rdb_scm_left(struct rdb *db, daos_size_t *scm_left_outp);

/* rdb_tx.c *******************************************************************/

int rdb_tx_count_vops(struct rdb *db, const void *buf, size_t len);
int rdb_tx_apply(struct rdb *db, uint64_t index, const void *buf, size_t len, void *result,
bool *critp, rdb_vos_tx_t vtx);
int
rdb_scm_left(struct rdb *db, daos_size_t *scm_left_outp);

#endif /* RDB_INTERNAL_H */
Loading

0 comments on commit 03d30b3

Please sign in to comment.