Skip to content

Commit

Permalink
DAOS-16211 vos: Ensure we delete exact entry
Browse files Browse the repository at this point in the history
When the change was made to allow partial overwrite
for rebuild, it broke delete such that delete would
remove the newest extent rather than the exact one
we requested.

Also, don't ignore errors when processing removals

Required-githooks: true

Signed-off-by: Jeff Olivier <jeffolivier@google.com>
  • Loading branch information
jolivier23 committed Jul 12, 2024
1 parent 509745d commit 53e870a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/vos/evtree.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2017-2023 Intel Corporation.
* (C) Copyright 2017-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -158,7 +158,7 @@ evt_mbr_same(const struct evt_node *node, const struct evt_rect *rect)
}

static bool
time_cmp(uint64_t t1, uint64_t t2, int *out)
time_cmp(uint64_t t1, uint64_t t2, int *out, bool exact)
{
if (t1 == t2) {
*out = RT_OVERLAP_SAME;
Expand All @@ -170,7 +170,7 @@ time_cmp(uint64_t t1, uint64_t t2, int *out)
*out = RT_OVERLAP_OVER;
} else {
*out = RT_OVERLAP_UNDER;
if (t2 == EVT_REBUILD_MINOR_MIN) {
if (!exact && t2 == EVT_REBUILD_MINOR_MIN) {
/** If t1 is also a rebuild, we should return
* RT_OVERLAP_SAME to force adjustment of new rebuild
* minor epoch.
Expand All @@ -191,8 +191,8 @@ time_cmp(uint64_t t1, uint64_t t2, int *out)
* second rectangle \a rt2 should be the one being searched/inserted.
*/
static void
evt_rect_overlap(const struct evt_rect *rt1, const struct evt_rect *rt2,
int *range, int *time)
evt_rect_overlap(const struct evt_rect *rt1, const struct evt_rect *rt2, int *range, int *time,
bool exact)
{
*time = *range = RT_OVERLAP_NO;

Expand All @@ -204,8 +204,8 @@ evt_rect_overlap(const struct evt_rect *rt1, const struct evt_rect *rt2,
* updates are from epc to INF. Determine here what kind
* of overlap exists.
*/
if (time_cmp(rt1->rc_epc, rt2->rc_epc, time))
time_cmp(rt1->rc_minor_epc, rt2->rc_minor_epc, time);
if (time_cmp(rt1->rc_epc, rt2->rc_epc, time, exact))
time_cmp(rt1->rc_minor_epc, rt2->rc_minor_epc, time, exact);

if (evt_same_extent(&rt1->rc_ex, &rt2->rc_ex))
*range = RT_OVERLAP_SAME;
Expand Down Expand Up @@ -2639,8 +2639,8 @@ evt_ent_array_fill(struct evt_context *tcx, enum evt_find_opc find_opc,
if (find_opc == EVT_FIND_OVERWRITE)
has_agg = true;

evt_rect_overlap(&rtmp, rect, &range_overlap,
&time_overlap);
evt_rect_overlap(&rtmp, rect, &range_overlap, &time_overlap,
find_opc == EVT_FIND_SAME);
switch (range_overlap) {
default:
D_ASSERT(0);
Expand Down
3 changes: 3 additions & 0 deletions src/vos/tests/evt_ctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ cmd+=" -l0-10@0-10:c -r 7-9@0-1 -l0-10@0-10:C -b -2 -D"
cmd+=" -C o:15 -a 0-5@1.1:abcdef -a 1-2@1.2:ff -a 3-5@1.14:abc -a -3-4@1.14:ab"
cmd+=" -a 3-5@1.14:abc -a 2-4@1.16384:vab -a 3-4@1.16384:ab -a 3-3@1.16384:a"
cmd+=" -b -2 -D"
cmd+=" -C o:4 -a 0-1@1.16384:bc -a 0-1@1.16384:cd -a 2-3@1.16384:ef"
cmd+=" -a 2-3@1.16384:hi -a 1-1@1.16384:b -a 0-3@1.16383 -d 0-1@1.16384"
cmd+=" -d 2-3@1.16384 -d 0-1@1.16385 -b -2 -D"
echo "$cmd"
eval "$cmd"
result="${PIPESTATUS[0]}"
Expand Down
4 changes: 4 additions & 0 deletions src/vos/vos_aggregate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,10 @@ insert_segments(daos_handle_t ih, struct agg_merge_window *mw, bool last, unsign

/** Remove processed removal records */
rc = process_removals(mw, oiter, &mw->mw_rmv_ents, last, true);
if (rc != 0) {
DL_ERROR(rc, "Unable to process extent removals");
goto abort;
}

/* Insert new segments into EV tree */
for (i = 0; i < io->ic_seg_cnt; i++) {
Expand Down

0 comments on commit 53e870a

Please sign in to comment.