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-16001 placement: fix cases for delay_rebuild #14558

Merged
merged 1 commit into from
Jun 14, 2024
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
21 changes: 17 additions & 4 deletions src/include/daos/pool_map.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand All @@ -18,10 +18,10 @@
#define POOL_MAP_VER_2 (2)
#define POOL_MAP_VERSION POOL_MAP_VER_2

#define DF_TARGET "Target[%d] (rank %u idx %u status %u ver %u in/out ver %u fseq %u)"
#define DF_TARGET "Target[%d] (rank %u idx %u status %u flags %u ver %u in/out ver %u fseq %u)"
#define DP_TARGET(t) t->ta_comp.co_id, t->ta_comp.co_rank, t->ta_comp.co_index,\
t->ta_comp.co_status, t->ta_comp.co_ver, t->ta_comp.co_in_ver, \
t->ta_comp.co_fseq
t->ta_comp.co_status, t->ta_comp.co_flags, t->ta_comp.co_ver, \
t->ta_comp.co_in_ver, t->ta_comp.co_fseq

/**
* pool component types
Expand Down Expand Up @@ -373,6 +373,19 @@ pool_target_is_up_or_drain(struct pool_target *tgt)
return tgt->ta_comp.co_status & (PO_COMP_ST_UP | PO_COMP_ST_DRAIN);
}

static inline bool
pool_target_is_up(struct pool_target *tgt)
{
return (tgt->ta_comp.co_status == PO_COMP_ST_UP);
}

static inline bool
pool_target_is_down2up(struct pool_target *tgt)
{
return (tgt->ta_comp.co_status == PO_COMP_ST_UP) &&
(tgt->ta_comp.co_flags & PO_COMPF_DOWN2UP);
}

/** Check if the target is in PO_COMP_ST_DOWN status */
static inline bool
pool_target_down(struct pool_target *tgt)
Expand Down
3 changes: 2 additions & 1 deletion src/placement/pl_map.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -70,6 +70,7 @@ struct failed_shard {
uint32_t fs_fseq;
uint32_t fs_tgt_id;
uint8_t fs_status;
uint32_t fs_down2up:1;
};

#define DF_FAILEDSHARD "shard_idx: %d, fseq: %d, tgt_id: %d, status: %d"
Expand Down
20 changes: 14 additions & 6 deletions src/placement/pl_map_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ remap_alloc_one(d_list_t *remap_list, unsigned int shard_idx,
f_new->fs_fseq = tgt->ta_comp.co_fseq;
f_new->fs_status = tgt->ta_comp.co_status;
f_new->fs_data = data;
if (pool_target_is_down2up(tgt))
f_new->fs_down2up = 1;

D_DEBUG(DB_PL, "tgt %u status %u reint %s\n", tgt->ta_comp.co_id,
tgt->ta_comp.co_status, for_reint ? "yes" : "no");
D_DEBUG(DB_PL, "tgt %u status %u flags %u reint %s\n", tgt->ta_comp.co_id,
tgt->ta_comp.co_status, tgt->ta_comp.co_flags, for_reint ? "yes" : "no");
if (!for_reint) {
f_new->fs_tgt_id = -1;
remap_add_one(remap_list, f_new);
Expand Down Expand Up @@ -251,7 +253,13 @@ is_comp_avaible(struct pool_component *comp, uint32_t allow_version,
status = PO_COMP_ST_UPIN;
} else if (status == PO_COMP_ST_UP) {
if (comp->co_flags & PO_COMPF_DOWN2UP) {
status = PO_COMP_ST_UPIN;
/* PO_COMP_ST_UP status with PO_COMPF_DOWN2UP flag
* is the case of delay_rebuild exclude+reint.
* Cannot mark it as UPIN to avoid it be used for
* rebuild enumerate/fetch, as the data will be
* discarded in reintegrate.
*/
/* status = PO_COMP_ST_UPIN; */
} else {
if (comp->co_fseq <= 1)
status = PO_COMP_ST_NEW;
Expand Down Expand Up @@ -387,12 +395,12 @@ determine_valid_spares(struct pool_target *spare_tgt, struct daos_obj_md *md,
l_shard->po_fseq = f_shard->fs_fseq;

/*
* Mark the shard as 'rebuilding' so that read will
* skip this shard.
* Mark the shard as 'rebuilding' so that read will skip this shard.
* f_shard->fs_down2up is the case of delay_rebuild exclude+reint.
*/
if (f_shard->fs_status == PO_COMP_ST_DOWN ||
f_shard->fs_status == PO_COMP_ST_DRAIN ||
pool_target_down(spare_tgt))
f_shard->fs_down2up || pool_target_down(spare_tgt))
l_shard->po_rebuilding = 1;
} else {
l_shard->po_shard = -1;
Expand Down
Loading