From 12f0856b5e371036520599ed56736e48ba7e5716 Mon Sep 17 00:00:00 2001 From: Andriy Tkachuk Date: Tue, 5 Jul 2022 15:02:36 +0100 Subject: [PATCH] CORTX-33537: disable alternative pvers by default In case of some failure, we want the I/O to be done in the base pool version in the degraded mode always without switching to the alternative pool version. Later, when we introduce the side pool versions, we will do the degraded I/O in them and use them for faster SNS-recovery, which will try to recover only the objects which have the side pool versions instead of traversing all objects in the cluster. Closes #1958. Signed-off-by: Andriy Tkachuk --- conf/pvers.c | 14 ++++++++++++++ conf/pvers.h | 2 ++ configure.ac | 9 ++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/conf/pvers.c b/conf/pvers.c index 53dfeb66ee5..4a4b6bffa08 100644 --- a/conf/pvers.c +++ b/conf/pvers.c @@ -63,8 +63,10 @@ struct arr_int_pos { uint32_t ap_pos; }; +#ifdef ENABLE_ALT_PVERS static int conf_pver_formulate(const struct m0_conf_pver *fpver, struct m0_conf_pver **out); +#endif static int conf_pver_formulaic_base(const struct m0_conf_pver *fpver, struct m0_conf_pver **out); static int conf_pver_objvs_count(struct m0_conf_pver *base, uint32_t *out); @@ -73,7 +75,9 @@ static int conf_pver_virtual_create(const struct m0_fid *fid, const uint32_t *allowance, struct arr_int *failed, struct m0_conf_pver **out); +#ifdef ENABLE_ALT_PVERS static int conf_pver_failures_cid(struct m0_conf_pver *base, uint64_t *out); +#endif static void conf_pver_subtree_delete(struct m0_conf_obj *obj); static int conf_pver_recd_build(struct m0_conf_obj *obj, void *args); @@ -145,13 +149,17 @@ static int conf_pver_find_locked(const struct m0_conf_pool *pool, M0_LOG(M0_INFO, "Skipping "FID_F, FID_P(pver_to_skip)); continue; } +#ifdef ENABLE_ALT_PVERS if (!m0_conf_pver_is_clean(pver)) continue; +#endif if (pver->pv_kind == M0_CONF_PVER_ACTUAL) { *out = pver; return M0_RC(0); } +#ifdef ENABLE_ALT_PVERS return M0_RC(conf_pver_formulate(pver, out)); +#endif } m0_tl_endfor; return M0_ERR_INFO(-ENOENT, "No suitable pver is found at pool "FID_F, FID_P(&pool->pl_obj.co_id)); @@ -278,6 +286,7 @@ static int conf_pver_formulaic_base(const struct m0_conf_pver *fpver, return M0_RC(0); } +#ifdef ENABLE_ALT_PVERS M0_INTERNAL bool m0_conf_pver_is_clean(const struct m0_conf_pver *pver) { struct m0_conf_pver *base = NULL; @@ -302,6 +311,7 @@ M0_INTERNAL bool m0_conf_pver_is_clean(const struct m0_conf_pver *pver) return M0_RC(m0_forall(i, M0_CONF_PVER_HEIGHT, recd[i] == allowance[i])); } +#endif enum { CONF_PVER_FID_MASK = 0x003fffffffffffffULL }; @@ -414,6 +424,7 @@ M0_INTERNAL unsigned m0_conf_pver_level(const struct m0_conf_obj *obj) } /* page break */ +#ifdef ENABLE_ALT_PVERS /** Finds or creates virtual pool version, described by a formulaic one. */ static int conf_pver_formulate(const struct m0_conf_pver *fpver, struct m0_conf_pver **out) @@ -441,6 +452,7 @@ conf_pver_formulate(const struct m0_conf_pver *fpver, struct m0_conf_pver **out) &virt_fid, base, fpver->pv_u.formulaic.pvf_allowance, NULL, out)); } +#endif struct conf_pver_enumerate_st { int est_counter; @@ -534,6 +546,7 @@ static int conf_pver_recd_build(struct m0_conf_obj *obj, void *args) return M0_CW_CONTINUE; } +#ifdef ENABLE_ALT_PVERS static int conf_objv_failed_fill(struct m0_conf_obj *obj, void *args) { struct arr_int_pos *a = args; @@ -591,6 +604,7 @@ static int conf_pver_failures_cid(struct m0_conf_pver *base, uint64_t *out) m0_free(a.ap_arr.ai_elems); return M0_RC(0); } +#endif struct conf_pver_base_walk_st { uint32_t bws_allowance[M0_CONF_PVER_HEIGHT]; diff --git a/conf/pvers.h b/conf/pvers.h index 053b832fce4..61f0fe4475d 100644 --- a/conf/pvers.h +++ b/conf/pvers.h @@ -182,6 +182,7 @@ m0_conf_pver_formulaic_from_virtual(const struct m0_conf_pver *virtual, const struct m0_conf_root *root, const struct m0_conf_pver **out); +#ifdef ENABLE_ALT_PVERS /** * Returns true iff pver consists of online elements only or can be * used to generate such a pver. @@ -189,6 +190,7 @@ m0_conf_pver_formulaic_from_virtual(const struct m0_conf_pver *virtual, * @pre pver is not virtual */ M0_INTERNAL bool m0_conf_pver_is_clean(const struct m0_conf_pver *pver); +#endif /** * Returns m0_conf_pver fid. diff --git a/configure.ac b/configure.ac index 54909ecbca6..8e4d76b6c89 100644 --- a/configure.ac +++ b/configure.ac @@ -200,6 +200,7 @@ AH_TEMPLATE([M0_TRACE_HIGHEST_ALLOWED_LEVEL],[Highest trace level that is allowe AH_TEMPLATE([M0_DEFAULT_NETWORK], [Default network transport type.]) AH_TEMPLATE([M0_LUSTRE_VERSION], [Autodetected Lustre version represented as integer]) AH_TEMPLATE([ENABLE_USER_MODE_ONLY], [Enabling user mode shall avoid kernel deps]) +AH_TEMPLATE([ENABLE_ALT_PVERS], [Enable alternative pool versions.]) AH_TEMPLATE([HAVE_JOURNAL_ABORT], [Have journal_abort() function]) AH_TEMPLATE([HAVE_FILE_READV], [Have fops->readv function]) AH_TEMPLATE([HAVE_FILE_AIO_READ], [Have fops->aio_read function]) @@ -544,7 +545,13 @@ AC_ARG_WITH([user-mode-only], AS_IF([test "x$with_user_mode_only" = xyes], [AC_DEFINE([ENABLE_USER_MODE_ONLY])]) - +# alternative-pvers {{{3 +AC_ARG_ENABLE([alternative_pvers], + AS_HELP_STRING([--enable-alternative-pvers], [enable alternative pvers]), + [], [enable_alternative_pvers=no] +) +AS_IF([test x$enable_alternative_pvers = xyes], + AC_DEFINE([ENABLE_ALT_PVERS], 1)) # linux {{{3 AC_ARG_WITH([linux],