Skip to content
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

DAOS-4698 vos: Report future object punch with iterator (#4854) #4891

Merged
merged 1 commit into from
Mar 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/include/daos_srv/vos_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ typedef struct {
struct {
/** Non-zero if punched */
daos_epoch_t ie_punch;
/** If applicable, non-zero if object is punched */
daos_epoch_t ie_obj_punch;
union {
/** key value */
daos_key_t ie_key;
Expand Down
32 changes: 20 additions & 12 deletions src/vos/tests/vts_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct counts {
int num_punched_objs;
int num_dkeys;
int num_punched_dkeys;
int num_punched_objs_dkey;
int num_akeys;
int num_punched_akeys;
int num_recx;
Expand All @@ -110,6 +111,8 @@ count_cb(daos_handle_t ih, vos_iter_entry_t *entry, vos_iter_type_t type,
counts->num_dkeys++;
if (entry->ie_punch)
counts->num_punched_dkeys++;
if (entry->ie_obj_punch)
counts->num_punched_objs_dkey++;
break;
case VOS_ITER_AKEY:
counts->num_akeys++;
Expand Down Expand Up @@ -150,12 +153,15 @@ vos_check(void **state, vos_iter_param_t *param, vos_iter_type_t type,
assert_int_equal(expected->num_punched_dkeys, counts.num_punched_dkeys);
assert_int_equal(expected->num_punched_akeys, counts.num_punched_akeys);
assert_int_equal(expected->num_punched_recx, counts.num_punched_recx);
assert_int_equal(expected->num_punched_objs_dkey,
counts.num_punched_objs_dkey);
}

static void
vos_check_obj(void **state, daos_epoch_t epoch, int flags, int objs,
int punched_objs, int dkeys, int punched_dkeys, int akeys,
int punched_akeys, int recxs, int punched_recx)
int punched_objs, int punched_objs_dkey, int dkeys,
int punched_dkeys, int akeys, int punched_akeys, int recxs,
int punched_recx)
{
struct io_test_args *arg = *state;
vos_iter_param_t param = {0};
Expand All @@ -171,6 +177,7 @@ vos_check_obj(void **state, daos_epoch_t epoch, int flags, int objs,
counts.num_akeys = akeys;
counts.num_recx = recxs;
counts.num_punched_objs = punched_objs;
counts.num_punched_objs_dkey = punched_objs_dkey;
counts.num_punched_dkeys = punched_dkeys;
counts.num_punched_akeys = punched_akeys;
counts.num_punched_recx = punched_recx;
Expand All @@ -180,8 +187,8 @@ vos_check_obj(void **state, daos_epoch_t epoch, int flags, int objs,

static void
vos_check_dkey(void **state, daos_epoch_t epoch, int flags, daos_unit_oid_t oid,
int dkeys, int punched_dkeys, int akeys, int punched_akeys,
int recxs, int punched_recx)
int punched_objs, int dkeys, int punched_dkeys, int akeys,
int punched_akeys, int recxs, int punched_recx)
{
struct io_test_args *arg = *state;
vos_iter_param_t param = {0};
Expand All @@ -199,6 +206,7 @@ vos_check_dkey(void **state, daos_epoch_t epoch, int flags, daos_unit_oid_t oid,
counts.num_punched_dkeys = punched_dkeys;
counts.num_punched_akeys = punched_akeys;
counts.num_punched_recx = punched_recx;
counts.num_punched_objs_dkey = punched_objs;

vos_check(state, &param, VOS_ITER_DKEY, &counts);
}
Expand Down Expand Up @@ -280,9 +288,9 @@ array_set_get_size(void **state)
assert_int_equal(size, 0);

flags = VOS_IT_EPC_RR | VOS_IT_RECX_VISIBLE;
vos_check_obj(state, 9, flags, 1, 0, 1, 0, 1, 0, 0, 0);
vos_check_obj(state, 3, flags, 1, 1, 2, 1, 2, 0, 1, 0);
vos_check_obj(state, 5, flags, 1, 1, 2, 0, 2, 0, 2, 1);
vos_check_obj(state, 9, flags, 1, 0, 0, 1, 0, 1, 0, 0, 0);
vos_check_obj(state, 3, flags, 1, 1, 2, 2, 1, 2, 0, 1, 0);
vos_check_obj(state, 5, flags, 1, 1, 2, 2, 0, 2, 0, 2, 1);
}

static void
Expand Down Expand Up @@ -701,19 +709,19 @@ punch_model_test(void **state)
(void)vos_check_akey; /* For now, unused. Reference to avoid warning */

/* Now recurse at an epoch prior to punches */
vos_check_dkey(state, 1, 0, oid, 1, 1, 1, 1, 1, 0);
vos_check_dkey(state, 1, 0, oid, 1, 1, 1, 1, 1, 1, 0);

/* Now recurse including punched entries */
vos_check_dkey(state, 8, VOS_IT_PUNCHED, oid, 1, 0, 1, 0, 4, 0);
vos_check_dkey(state, 8, VOS_IT_PUNCHED, oid, 1, 1, 0, 1, 0, 4, 0);

/* Now recurse after punch, not including punched entries */
vos_check_obj(state, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0);
vos_check_obj(state, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

/* Now recurse including punched entries after object punch */
vos_check_obj(state, 10, VOS_IT_PUNCHED, 1, 0, 1, 0, 1, 0, 5, 0);
vos_check_obj(state, 10, VOS_IT_PUNCHED, 1, 0, 0, 1, 0, 1, 0, 5, 0);

/* Now recurse visible entries at 11 */
vos_check_obj(state, 11, 0, 1, 0, 1, 0, 1, 0, 1, 0);
vos_check_obj(state, 11, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0);

/** Read the value at 11 */
memset(buf, 0, sizeof(buf));
Expand Down
1 change: 1 addition & 0 deletions src/vos/vos_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ key_iter_fetch(struct vos_obj_iter *oiter, vos_iter_entry_t *ent,

ent->ie_epoch = epr.epr_hi;
ent->ie_punch = oiter->it_ilog_info.ii_next_punch;
ent->ie_obj_punch = oiter->it_obj->obj_ilog_info.ii_next_punch;
ent->ie_vis_flags = VOS_VIS_FLAG_VISIBLE;
if (oiter->it_ilog_info.ii_create == 0) {
/* The key has no visible subtrees so mark it covered */
Expand Down
1 change: 1 addition & 0 deletions src/vos/vos_obj_index.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ oi_iter_fetch(struct vos_iterator *iter, vos_iter_entry_t *it_entry,

it_entry->ie_oid = obj->vo_id;
it_entry->ie_punch = oiter->oit_ilog_info.ii_next_punch;
it_entry->ie_obj_punch = it_entry->ie_punch;
it_entry->ie_epoch = epr.epr_hi;
it_entry->ie_vis_flags = VOS_VIS_FLAG_VISIBLE;
if (oiter->oit_ilog_info.ii_create == 0) {
Expand Down