From 53e870a36953d0e51d7619af35c91a062fca4d6a Mon Sep 17 00:00:00 2001 From: Jeff Olivier Date: Fri, 12 Jul 2024 15:32:51 -0600 Subject: [PATCH] DAOS-16211 vos: Ensure we delete exact entry 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 --- src/vos/evtree.c | 18 +++++++++--------- src/vos/tests/evt_ctl.sh | 3 +++ src/vos/vos_aggregate.c | 4 ++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/vos/evtree.c b/src/vos/evtree.c index 9f5b3e01f1d..a1675c677dd 100644 --- a/src/vos/evtree.c +++ b/src/vos/evtree.c @@ -1,5 +1,5 @@ /** - * (C) Copyright 2017-2023 Intel Corporation. + * (C) Copyright 2017-2024 Intel Corporation. * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -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; @@ -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. @@ -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; @@ -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; @@ -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); diff --git a/src/vos/tests/evt_ctl.sh b/src/vos/tests/evt_ctl.sh index 4191da8b585..0f7cc80221b 100755 --- a/src/vos/tests/evt_ctl.sh +++ b/src/vos/tests/evt_ctl.sh @@ -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]}" diff --git a/src/vos/vos_aggregate.c b/src/vos/vos_aggregate.c index ccc974a23af..6b4d4f77dfd 100644 --- a/src/vos/vos_aggregate.c +++ b/src/vos/vos_aggregate.c @@ -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++) {