From 0652d7c9d91fa84cfe17f1d14c96fe9fe594654e Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Thu, 13 Mar 2025 11:12:21 +0100 Subject: [PATCH 01/15] test: add unit test for sds_check Signed-off-by: Oksana Salyk --- src/common/pmemcommon.inc | 2 + src/common/shutdown_state.c | 26 +-- src/common/shutdown_state.h | 10 ++ src/common/shutdown_state_helper.c | 28 ++++ src/test/Makefile | 1 + src/test/Makefile.inc | 2 + src/test/util_sds/Makefile | 2 + src/test/util_sds_check/.gitignore | 1 + src/test/util_sds_check/Makefile | 18 +++ src/test/util_sds_check/TEST0 | 23 +++ src/test/util_sds_check/TEST1 | 23 +++ src/test/util_sds_check/TEST2 | 23 +++ src/test/util_sds_check/TEST3 | 23 +++ src/test/util_sds_check/TEST4 | 23 +++ src/test/util_sds_check/TEST5 | 23 +++ src/test/util_sds_check/TEST6 | 23 +++ src/test/util_sds_check/TEST7 | 23 +++ src/test/util_sds_check/util_sds_check.c | 192 +++++++++++++++++++++++ src/test/util_sds_check/util_sds_check.h | 35 +++++ 19 files changed, 478 insertions(+), 23 deletions(-) create mode 100644 src/common/shutdown_state_helper.c create mode 100644 src/test/util_sds_check/.gitignore create mode 100644 src/test/util_sds_check/Makefile create mode 100755 src/test/util_sds_check/TEST0 create mode 100755 src/test/util_sds_check/TEST1 create mode 100755 src/test/util_sds_check/TEST2 create mode 100755 src/test/util_sds_check/TEST3 create mode 100755 src/test/util_sds_check/TEST4 create mode 100755 src/test/util_sds_check/TEST5 create mode 100755 src/test/util_sds_check/TEST6 create mode 100755 src/test/util_sds_check/TEST7 create mode 100644 src/test/util_sds_check/util_sds_check.c create mode 100644 src/test/util_sds_check/util_sds_check.h diff --git a/src/common/pmemcommon.inc b/src/common/pmemcommon.inc index 93b14eab47..3e124c1cf3 100644 --- a/src/common/pmemcommon.inc +++ b/src/common/pmemcommon.inc @@ -1,5 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2017-2023, Intel Corporation +# Copyright 2025, Hewlett Packard Enterprise Development LP # # src/pmemcommon.inc -- common SOURCE definitions for PMDK libraries # @@ -21,6 +22,7 @@ SOURCE +=\ $(COMMON)/rand.c\ $(COMMON)/set.c\ $(COMMON)/shutdown_state.c\ + $(COMMON)/shutdown_state_helper.c\ $(COMMON)/uuid.c\ $(COMMON)/uuid_linux.c\ $(PMEM2)/pmem2_utils.c\ diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index 8dd6cf533b..d6b8979f7c 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause /* Copyright 2017-2024, Intel Corporation */ +/* Copyright 2025, Hewlett Packard Enterprise Development LP */ /* * shutdown_state.c -- unsafe shudown detection @@ -17,13 +18,10 @@ #include "bad_blocks.h" #include "../libpmem2/pmem2_utils.h" -#define FLUSH_SDS(sds, rep) \ - if ((rep) != NULL) os_part_deep_common(rep, 0, sds, sizeof(*(sds)), 1) - /* - * shutdown_state_checksum -- (internal) counts SDS checksum and flush it + * shutdown_state_checksum -- counts SDS checksum and flush it */ -static void +void shutdown_state_checksum(struct shutdown_state *sds, struct pool_replica *rep) { LOG(3, "sds %p", sds); @@ -159,24 +157,6 @@ shutdown_state_clear_dirty(struct shutdown_state *sds, struct pool_replica *rep) shutdown_state_checksum(sds, rep); } -/* - * shutdown_state_reinit -- (internal) reinitializes shutdown_state struct - */ -static void -shutdown_state_reinit(struct shutdown_state *curr_sds, - struct shutdown_state *pool_sds, struct pool_replica *rep) -{ - LOG(3, "curr_sds %p, pool_sds %p", curr_sds, pool_sds); - shutdown_state_init(pool_sds, rep); - pool_sds->uuid = htole64(curr_sds->uuid); - pool_sds->usc = htole64(curr_sds->usc); - pool_sds->dirty = 0; - - FLUSH_SDS(pool_sds, rep); - - shutdown_state_checksum(pool_sds, rep); -} - /* * shutdown_state_check -- compares and fixes shutdown state */ diff --git a/src/common/shutdown_state.h b/src/common/shutdown_state.h index 1f9fa4ce8b..4267e60f0e 100644 --- a/src/common/shutdown_state.h +++ b/src/common/shutdown_state.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause */ /* Copyright 2017-2020, Intel Corporation */ +/* Copyright 2025, Hewlett Packard Enterprise Development LP */ /* * shutdown_state.h -- unsafe shudown detection @@ -23,6 +24,9 @@ struct shutdown_state { uint64_t checksum; }; +#define FLUSH_SDS(sds, rep) \ + if ((rep) != NULL) os_part_deep_common(rep, 0, sds, sizeof(*(sds)), 1) + int shutdown_state_init(struct shutdown_state *sds, struct pool_replica *rep); int shutdown_state_add_part(struct shutdown_state *sds, int fd, struct pool_replica *rep); @@ -34,6 +38,12 @@ void shutdown_state_clear_dirty(struct shutdown_state *sds, int shutdown_state_check(struct shutdown_state *curr_sds, struct shutdown_state *pool_sds, struct pool_replica *rep); +void shutdown_state_reinit(struct shutdown_state *curr_sds, + struct shutdown_state *pool_sds, struct pool_replica *rep); + +void shutdown_state_checksum(struct shutdown_state *sds, + struct pool_replica *rep); + #ifdef __cplusplus } #endif diff --git a/src/common/shutdown_state_helper.c b/src/common/shutdown_state_helper.c new file mode 100644 index 0000000000..2bf5322895 --- /dev/null +++ b/src/common/shutdown_state_helper.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* Copyright 2025, Hewlett Packard Enterprise Development LP */ + +/* + * shutdown_state_helper.c -- implementation of shutdown_state_reinit + */ + +#include "out.h" +#include "os_deep.h" +#include "set.h" + +/* + * shutdown_state_reinit -- reinitializes shutdown_state struct + */ +void +shutdown_state_reinit(struct shutdown_state *curr_sds, + struct shutdown_state *pool_sds, struct pool_replica *rep) +{ + LOG(3, "curr_sds %p, pool_sds %p", curr_sds, pool_sds); + shutdown_state_init(pool_sds, rep); + pool_sds->uuid = htole64(curr_sds->uuid); + pool_sds->usc = htole64(curr_sds->usc); + pool_sds->dirty = 0; + + FLUSH_SDS(pool_sds, rep); + + shutdown_state_checksum(pool_sds, rep); +} diff --git a/src/test/Makefile b/src/test/Makefile index 5d39101d81..c3bd32990e 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -148,6 +148,7 @@ OTHER_TESTS = \ util_poolset_size\ util_ravl\ util_sds\ + util_sds_check\ util_uuid_generate\ util_vec\ util_vecq\ diff --git a/src/test/Makefile.inc b/src/test/Makefile.inc index dc07375cb4..875bbfe672 100644 --- a/src/test/Makefile.inc +++ b/src/test/Makefile.inc @@ -246,6 +246,7 @@ OBJS +=\ $(TOP)/src/nondebug/common/pool_hdr.o\ $(TOP)/src/nondebug/common/set.o\ $(TOP)/src/nondebug/common/shutdown_state.o\ + $(TOP)/src/nondebug/common/shutdown_state_helper.o\ $(TOP)/src/nondebug/common/util.o\ $(TOP)/src/nondebug/common/util_posix.o\ $(TOP)/src/nondebug/common/uuid.o\ @@ -287,6 +288,7 @@ OBJS +=\ $(TOP)/src/debug/common/pool_hdr.o\ $(TOP)/src/debug/common/set.o\ $(TOP)/src/debug/common/shutdown_state.o\ + $(TOP)/src/debug/common/shutdown_state_helper.o\ $(TOP)/src/debug/common/uuid.o\ $(TOP)/src/debug/common/uuid_linux.o\ $(TOP)/src/debug/libpmem2/pmem2_utils.o\ diff --git a/src/test/util_sds/Makefile b/src/test/util_sds/Makefile index 67adab7622..9ed8af0a6d 100644 --- a/src/test/util_sds/Makefile +++ b/src/test/util_sds/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright 2015-2020, Intel Corporation +# Copyright 2025, Hewlett Packard Enterprise Development LP # # src/test/util_sds/Makefile -- shutdown_tests unit test @@ -11,6 +12,7 @@ vpath %.c $(TOP)/src/common/ TARGET = util_sds OBJS = util_sds.o\ shutdown_state.o\ + shutdown_state_helper.o\ ut_pmem2_config.o\ ut_pmem2_source.o\ ut_pmem2_utils.o diff --git a/src/test/util_sds_check/.gitignore b/src/test/util_sds_check/.gitignore new file mode 100644 index 0000000000..e9b41bcd7f --- /dev/null +++ b/src/test/util_sds_check/.gitignore @@ -0,0 +1 @@ +util_sds_check diff --git a/src/test/util_sds_check/Makefile b/src/test/util_sds_check/Makefile new file mode 100644 index 0000000000..6ee516cfaf --- /dev/null +++ b/src/test/util_sds_check/Makefile @@ -0,0 +1,18 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/Makefile -- shutdown_state_check unit test +# +BUILD_STATIC_DEBUG=n +BUILD_STATIC_NONDEBUG=n + +TARGET = util_sds_check +OBJS = util_sds_check.o + +LIBPMEM=internal-debug +LIBPMEMCOMMON=internal-debug + +include ../Makefile.inc + +LDFLAGS += $(call extract_funcs, util_sds_check.c) diff --git a/src/test/util_sds_check/TEST0 b/src/test/util_sds_check/TEST0 new file mode 100755 index 0000000000..14ff63eb3c --- /dev/null +++ b/src/test/util_sds_check/TEST0 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/TEST0 -- unittest for shutdown_state_check +# + +. ../unittest/unittest.sh + +require_test_type short + +require_fs_type none + +require_build_type debug + +setup + +expect_normal_exit ./util_sds_check test_dirty_clear + +check + +pass diff --git a/src/test/util_sds_check/TEST1 b/src/test/util_sds_check/TEST1 new file mode 100755 index 0000000000..f2417575af --- /dev/null +++ b/src/test/util_sds_check/TEST1 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/TEST1 -- unittest for shutdown_state_check +# + +. ../unittest/unittest.sh + +require_test_type short + +require_fs_type none + +require_build_type debug + +setup + +expect_normal_exit ./util_sds_check test_invalid_checksum + +check + +pass diff --git a/src/test/util_sds_check/TEST2 b/src/test/util_sds_check/TEST2 new file mode 100755 index 0000000000..54cc7aeceb --- /dev/null +++ b/src/test/util_sds_check/TEST2 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/TEST2 -- unittest for shutdown_state_check +# + +. ../unittest/unittest.sh + +require_test_type short + +require_fs_type none + +require_build_type debug + +setup + +expect_normal_exit ./util_sds_check test_dirty_set + +check + +pass diff --git a/src/test/util_sds_check/TEST3 b/src/test/util_sds_check/TEST3 new file mode 100755 index 0000000000..958df6eb8b --- /dev/null +++ b/src/test/util_sds_check/TEST3 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/TEST3 -- unittest for shutdown_state_check +# + +. ../unittest/unittest.sh + +require_test_type short + +require_fs_type none + +require_build_type debug + +setup + +expect_normal_exit ./util_sds_check test_invalid_uuid + +check + +pass diff --git a/src/test/util_sds_check/TEST4 b/src/test/util_sds_check/TEST4 new file mode 100755 index 0000000000..79d1e9acc8 --- /dev/null +++ b/src/test/util_sds_check/TEST4 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/TEST4 -- unittest for shutdown_state_check +# + +. ../unittest/unittest.sh + +require_test_type short + +require_fs_type none + +require_build_type debug + +setup + +expect_normal_exit ./util_sds_check test_invalid_uuid_set_dirty + +check + +pass diff --git a/src/test/util_sds_check/TEST5 b/src/test/util_sds_check/TEST5 new file mode 100755 index 0000000000..ccf7de34d6 --- /dev/null +++ b/src/test/util_sds_check/TEST5 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/TEST5 -- unittest for shutdown_state_check +# + +. ../unittest/unittest.sh + +require_test_type short + +require_fs_type none + +require_build_type debug + +setup + +expect_normal_exit ./util_sds_check test_invalid_usc + +check + +pass diff --git a/src/test/util_sds_check/TEST6 b/src/test/util_sds_check/TEST6 new file mode 100755 index 0000000000..aa9038ec35 --- /dev/null +++ b/src/test/util_sds_check/TEST6 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/TEST6 -- unittest for shutdown_state_check +# + +. ../unittest/unittest.sh + +require_test_type short + +require_fs_type none + +require_build_type debug + +setup + +expect_normal_exit ./util_sds_check test_invalid_usc_set_dirty + +check + +pass diff --git a/src/test/util_sds_check/TEST7 b/src/test/util_sds_check/TEST7 new file mode 100755 index 0000000000..beed80e62d --- /dev/null +++ b/src/test/util_sds_check/TEST7 @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025, Hewlett Packard Enterprise Development LP + +# +# src/test/util_sds_check/TEST7 -- unittest for shutdown_state_check +# + +. ../unittest/unittest.sh + +require_test_type short + +require_fs_type none + +require_build_type debug + +setup + +expect_normal_exit ./util_sds_check test_happy_day + +check + +pass diff --git a/src/test/util_sds_check/util_sds_check.c b/src/test/util_sds_check/util_sds_check.c new file mode 100644 index 0000000000..83a7f67224 --- /dev/null +++ b/src/test/util_sds_check/util_sds_check.c @@ -0,0 +1,192 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* Copyright 2025, Hewlett Packard Enterprise Development LP */ + +/* + * util_sds_check.c -- unit test for the shutdown_state_check() function + */ + +#include "util_sds_check.h" + +/* pool_sds - SDS read from the pool header (persistent) */ +static struct shutdown_state Pool_sds; +/* + * curr_sds - SDS calculated ad hoc considering all the involved PMem DIMMs + * their UUIDs and USCs (volatile) + */ +static struct shutdown_state Curr_sds; +static struct pool_replica Rep; + +FUNC_MOCK(shutdown_state_reinit, void, struct shutdown_state *curr_sds, + struct shutdown_state *pool_sds, struct pool_replica *rep) +FUNC_MOCK_RUN_DEFAULT { + UT_ASSERTeq(curr_sds, &Curr_sds); + UT_ASSERTeq(pool_sds, &Pool_sds); + UT_ASSERTeq(rep, &Rep); +} +FUNC_MOCK_END + +/* + * The persistent SDS turned out to be zeroed out + * whereas based on the pool structure it should be not. + */ +static int +test_dirty_clear() +{ + SET_SDS(Pool_sds, SDS_ZERO); + SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + + int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); + UT_ASSERTeq(ret, 0); + UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); + + return ret; +} + +/* Pool_sds having an invalid checksum. */ +static int +test_invalid_checksum() +{ + SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Curr_sds, &Rep); + + int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); + UT_ASSERTeq(ret, 0); + UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); + + return ret; +} + +/* + * Test with curr_sds and pool_sds having the same values + * except for the dirty field. + */ +static int +test_dirty_set() +{ + SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID, DIRTY_SET)); + shutdown_state_checksum(&Pool_sds, &Rep); + SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Curr_sds, &Rep); + + int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); + UT_ASSERTeq(ret, 0); + UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); + + return ret; +} + +/* Pool_sds and Curr_sds having different uuid. */ +static int +test_invalid_uuid() +{ + SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID ^ INVALID_VALUE, DIRTY_CLEAR)); + shutdown_state_checksum(&Pool_sds, &Rep); + SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Curr_sds, &Rep); + + int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); + UT_ASSERTeq(ret, 0); + UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); + + return ret; +} + +/* + * Pool_sds and Curr_sds having different uuid and + * Pool_sds.dirty is set. + */ +static int +test_invalid_uuid_set_dirty() +{ + SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID ^ INVALID_VALUE, DIRTY_SET)); + shutdown_state_checksum(&Pool_sds, &Rep); + SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Curr_sds, &Rep); + + int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); + UT_ASSERTeq(ret, 1); + UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 0); + + return ret; +} + +/* Pool_sds and Curr_sds having different USC and the same UUID. */ +static int +test_invalid_usc() +{ + SET_SDS(Pool_sds, SDS_CUSTOM(USC ^ INVALID_VALUE, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Pool_sds, &Rep); + SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Curr_sds, &Rep); + + int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); + UT_ASSERTeq(ret, 0); + UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); + + return ret; +} + +/* + * Pool_sds and Curr_sds having different USC, the same UUID and + * Pool_sds.dirty is set. + */ +static int +test_invalid_usc_set_dirty() +{ + SET_SDS(Pool_sds, SDS_CUSTOM(USC ^ INVALID_VALUE, UUID, DIRTY_SET)); + shutdown_state_checksum(&Pool_sds, &Rep); + SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Curr_sds, &Rep); + + int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); + UT_ASSERTeq(ret, 1); + UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 0); + + return ret; +} + +/* Pool_sds and Curr_sds having identical values (dirty==0). */ +static int +test_happy_day() +{ + SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Pool_sds, &Rep); + SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + shutdown_state_checksum(&Curr_sds, &Rep); + + int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); + UT_ASSERTeq(ret, 0); + UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 0); + + return ret; +} + +static struct test_case test_cases[] = { + TEST_CASE(test_dirty_clear), + TEST_CASE(test_invalid_checksum), + TEST_CASE(test_dirty_set), + TEST_CASE(test_invalid_uuid), + TEST_CASE(test_invalid_uuid_set_dirty), + TEST_CASE(test_invalid_usc), + TEST_CASE(test_invalid_usc_set_dirty), + TEST_CASE(test_happy_day), +}; + +#define NTESTS ARRAY_SIZE(test_cases) + +static void +log_function(enum core_log_level level, const char *file_name, + unsigned line_no, const char *function_name, const char *message) +{ + UT_OUT("%s", message); +} + +int +main(int argc, char *argv[]) +{ + START(argc, argv, "util_sds_check"); + core_log_set_function(log_function); + TEST_CASE_PROCESS(argc, argv, test_cases, NTESTS); + DONE(NULL); +} diff --git a/src/test/util_sds_check/util_sds_check.h b/src/test/util_sds_check/util_sds_check.h new file mode 100644 index 0000000000..7b62a1ee67 --- /dev/null +++ b/src/test/util_sds_check/util_sds_check.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Copyright 2025, Hewlett Packard Enterprise Development LP */ + +/* + * util_sds_check.h -- header for unit test + */ + +#include "unittest.h" +#include "shutdown_state.h" +#include "set.h" + +#define DIRTY_SET 1 +#define DIRTY_CLEAR 0 + +/* Invalid value for all test cases */ +#define INVALID_VALUE 0x60bab3f082b07f57 +#define UUID 0xbe4919b3edce624a +#define USC 0x14796ef67d593c7b + +#define SDS_CUSTOM(my_usc, my_uuid, my_dirty) \ +{ \ + .usc = my_usc, \ + .uuid = my_uuid, \ + .dirty = my_dirty, \ + .reserved = {0}, \ + .checksum = 0 \ +} + +#define SDS_ZERO {0} + +#define SET_SDS(DST, VALUE) \ +do { \ + struct shutdown_state sds_src = VALUE; \ + memcpy(&DST, &sds_src, sizeof(struct shutdown_state)); \ +} while (0) From 3f155fb99993b03d786a1e6590dd31054e2441df Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Tue, 6 May 2025 10:37:28 +0200 Subject: [PATCH 02/15] test: update return value Signed-off-by: Oksana Salyk --- src/test/util_sds_check/util_sds_check.c | 16 ++++++++-------- src/test/util_sds_check/util_sds_check.h | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/test/util_sds_check/util_sds_check.c b/src/test/util_sds_check/util_sds_check.c index 83a7f67224..435c7bc0e7 100644 --- a/src/test/util_sds_check/util_sds_check.c +++ b/src/test/util_sds_check/util_sds_check.c @@ -39,7 +39,7 @@ test_dirty_clear() UT_ASSERTeq(ret, 0); UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); - return ret; + return NO_ARGS_CONSUMED; } /* Pool_sds having an invalid checksum. */ @@ -54,7 +54,7 @@ test_invalid_checksum() UT_ASSERTeq(ret, 0); UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); - return ret; + return NO_ARGS_CONSUMED; } /* @@ -73,7 +73,7 @@ test_dirty_set() UT_ASSERTeq(ret, 0); UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); - return ret; + return NO_ARGS_CONSUMED; } /* Pool_sds and Curr_sds having different uuid. */ @@ -89,7 +89,7 @@ test_invalid_uuid() UT_ASSERTeq(ret, 0); UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); - return ret; + return NO_ARGS_CONSUMED; } /* @@ -108,7 +108,7 @@ test_invalid_uuid_set_dirty() UT_ASSERTeq(ret, 1); UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 0); - return ret; + return NO_ARGS_CONSUMED; } /* Pool_sds and Curr_sds having different USC and the same UUID. */ @@ -124,7 +124,7 @@ test_invalid_usc() UT_ASSERTeq(ret, 0); UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 1); - return ret; + return NO_ARGS_CONSUMED; } /* @@ -143,7 +143,7 @@ test_invalid_usc_set_dirty() UT_ASSERTeq(ret, 1); UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 0); - return ret; + return NO_ARGS_CONSUMED; } /* Pool_sds and Curr_sds having identical values (dirty==0). */ @@ -159,7 +159,7 @@ test_happy_day() UT_ASSERTeq(ret, 0); UT_ASSERTeq(RCOUNTER(shutdown_state_reinit), 0); - return ret; + return NO_ARGS_CONSUMED; } static struct test_case test_cases[] = { diff --git a/src/test/util_sds_check/util_sds_check.h b/src/test/util_sds_check/util_sds_check.h index 7b62a1ee67..8a03d61975 100644 --- a/src/test/util_sds_check/util_sds_check.h +++ b/src/test/util_sds_check/util_sds_check.h @@ -9,6 +9,8 @@ #include "shutdown_state.h" #include "set.h" +#define NO_ARGS_CONSUMED 0 + #define DIRTY_SET 1 #define DIRTY_CLEAR 0 From 49f65fa98bc7806d178ae4020ad4be55fda5057f Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Tue, 6 May 2025 11:39:19 +0200 Subject: [PATCH 03/15] test: apply comments to review Signed-off-by: Oksana Salyk --- src/test/util_sds_check/Makefile | 2 +- src/test/util_sds_check/util_sds_check.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/util_sds_check/Makefile b/src/test/util_sds_check/Makefile index 6ee516cfaf..4299abdc80 100644 --- a/src/test/util_sds_check/Makefile +++ b/src/test/util_sds_check/Makefile @@ -10,7 +10,7 @@ BUILD_STATIC_NONDEBUG=n TARGET = util_sds_check OBJS = util_sds_check.o -LIBPMEM=internal-debug +LIBPMEM=y LIBPMEMCOMMON=internal-debug include ../Makefile.inc diff --git a/src/test/util_sds_check/util_sds_check.c b/src/test/util_sds_check/util_sds_check.c index 435c7bc0e7..712e559f0b 100644 --- a/src/test/util_sds_check/util_sds_check.c +++ b/src/test/util_sds_check/util_sds_check.c @@ -47,8 +47,8 @@ static int test_invalid_checksum() { SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); + /* Pool_sds.checksum left zeroed out (invalid) */ SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); - shutdown_state_checksum(&Curr_sds, &Rep); int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); UT_ASSERTeq(ret, 0); From cf5ed83844296d6c1e6f7dcd8c3cb3637c698c53 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Tue, 6 May 2025 11:49:48 +0200 Subject: [PATCH 04/15] test: minor adjustments Signed-off-by: Oksana Salyk --- src/test/util_sds_check/util_sds_check.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/test/util_sds_check/util_sds_check.c b/src/test/util_sds_check/util_sds_check.c index 712e559f0b..2ae4926891 100644 --- a/src/test/util_sds_check/util_sds_check.c +++ b/src/test/util_sds_check/util_sds_check.c @@ -67,7 +67,6 @@ test_dirty_set() SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID, DIRTY_SET)); shutdown_state_checksum(&Pool_sds, &Rep); SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); - shutdown_state_checksum(&Curr_sds, &Rep); int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); UT_ASSERTeq(ret, 0); @@ -83,7 +82,6 @@ test_invalid_uuid() SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID ^ INVALID_VALUE, DIRTY_CLEAR)); shutdown_state_checksum(&Pool_sds, &Rep); SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); - shutdown_state_checksum(&Curr_sds, &Rep); int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); UT_ASSERTeq(ret, 0); @@ -102,7 +100,6 @@ test_invalid_uuid_set_dirty() SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID ^ INVALID_VALUE, DIRTY_SET)); shutdown_state_checksum(&Pool_sds, &Rep); SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); - shutdown_state_checksum(&Curr_sds, &Rep); int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); UT_ASSERTeq(ret, 1); @@ -118,7 +115,6 @@ test_invalid_usc() SET_SDS(Pool_sds, SDS_CUSTOM(USC ^ INVALID_VALUE, UUID, DIRTY_CLEAR)); shutdown_state_checksum(&Pool_sds, &Rep); SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); - shutdown_state_checksum(&Curr_sds, &Rep); int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); UT_ASSERTeq(ret, 0); @@ -137,7 +133,6 @@ test_invalid_usc_set_dirty() SET_SDS(Pool_sds, SDS_CUSTOM(USC ^ INVALID_VALUE, UUID, DIRTY_SET)); shutdown_state_checksum(&Pool_sds, &Rep); SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); - shutdown_state_checksum(&Curr_sds, &Rep); int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); UT_ASSERTeq(ret, 1); @@ -153,7 +148,6 @@ test_happy_day() SET_SDS(Pool_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); shutdown_state_checksum(&Pool_sds, &Rep); SET_SDS(Curr_sds, SDS_CUSTOM(USC, UUID, DIRTY_CLEAR)); - shutdown_state_checksum(&Curr_sds, &Rep); int ret = shutdown_state_check(&Curr_sds, &Pool_sds, &Rep); UT_ASSERTeq(ret, 0); From d2b3993ea4c0a85e548237d6de5ec4a70f9b1775 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Wed, 7 May 2025 07:41:35 -0400 Subject: [PATCH 05/15] test: add match files Signed-off-by: Oksana Salyk --- src/test/util_sds_check/out0.log.match | 6 ++++++ src/test/util_sds_check/out1.log.match | 7 +++++++ src/test/util_sds_check/out2.log.match | 7 +++++++ src/test/util_sds_check/out3.log.match | 7 +++++++ src/test/util_sds_check/out4.log.match | 7 +++++++ src/test/util_sds_check/out5.log.match | 7 +++++++ src/test/util_sds_check/out6.log.match | 7 +++++++ src/test/util_sds_check/out7.log.match | 6 ++++++ 8 files changed, 54 insertions(+) create mode 100644 src/test/util_sds_check/out0.log.match create mode 100644 src/test/util_sds_check/out1.log.match create mode 100644 src/test/util_sds_check/out2.log.match create mode 100644 src/test/util_sds_check/out3.log.match create mode 100644 src/test/util_sds_check/out4.log.match create mode 100644 src/test/util_sds_check/out5.log.match create mode 100644 src/test/util_sds_check/out6.log.match create mode 100644 src/test/util_sds_check/out7.log.match diff --git a/src/test/util_sds_check/out0.log.match b/src/test/util_sds_check/out0.log.match new file mode 100644 index 0000000000..d90d8e2dcd --- /dev/null +++ b/src/test/util_sds_check/out0.log.match @@ -0,0 +1,6 @@ +util_sds_check$(nW)TEST0: START: util_sds_check + $(nW)util_sds_check test_dirty_clear +src version: $(nW) +compiled with support for shutdown state +compiled with libndctl $(nW) +util_sds_check$(nW)TEST0: DONE diff --git a/src/test/util_sds_check/out1.log.match b/src/test/util_sds_check/out1.log.match new file mode 100644 index 0000000000..2864fc4a1c --- /dev/null +++ b/src/test/util_sds_check/out1.log.match @@ -0,0 +1,7 @@ +util_sds_check$(nW)TEST1: START: util_sds_check + $(nW)util_sds_check test_invalid_checksum +src version: $(nW) +compiled with support for shutdown state +compiled with libndctl $(nW) +incorrect checksum - SDS will be reinitialized +util_sds_check$(nW)TEST1: DONE diff --git a/src/test/util_sds_check/out2.log.match b/src/test/util_sds_check/out2.log.match new file mode 100644 index 0000000000..226778be52 --- /dev/null +++ b/src/test/util_sds_check/out2.log.match @@ -0,0 +1,7 @@ +util_sds_check$(nW)TEST2: START: util_sds_check + $(nW)util_sds_check test_dirty_set +src version: $(nW) +compiled with support for shutdown state +compiled with libndctl $(nW) +the pool was not closed - SDS will be reinitialized +util_sds_check$(nW)TEST2: DONE diff --git a/src/test/util_sds_check/out3.log.match b/src/test/util_sds_check/out3.log.match new file mode 100644 index 0000000000..44e6fc63db --- /dev/null +++ b/src/test/util_sds_check/out3.log.match @@ -0,0 +1,7 @@ +util_sds_check$(nW)TEST3: START: util_sds_check + $(nW)util_sds_check test_invalid_uuid +src version: $(nW) +compiled with support for shutdown state +compiled with libndctl $(nW) +an ADR failure was detected but the pool was closed - SDS will be reinitialized +util_sds_check$(nW)TEST3: DONE diff --git a/src/test/util_sds_check/out4.log.match b/src/test/util_sds_check/out4.log.match new file mode 100644 index 0000000000..59317cbbf2 --- /dev/null +++ b/src/test/util_sds_check/out4.log.match @@ -0,0 +1,7 @@ +util_sds_check$(nW)TEST4: START: util_sds_check + $(nW)util_sds_check test_invalid_uuid_set_dirty +src version: $(nW) +compiled with support for shutdown state +compiled with libndctl $(nW) +an ADR failure was detected, the pool might be corrupted +util_sds_check$(nW)TEST4: DONE diff --git a/src/test/util_sds_check/out5.log.match b/src/test/util_sds_check/out5.log.match new file mode 100644 index 0000000000..f68bbc3b83 --- /dev/null +++ b/src/test/util_sds_check/out5.log.match @@ -0,0 +1,7 @@ +util_sds_check$(nW)TEST5: START: util_sds_check + $(nW)util_sds_check test_invalid_usc +src version: $(nW) +compiled with support for shutdown state +compiled with libndctl $(nW) +an ADR failure was detected but the pool was closed - SDS will be reinitialized +util_sds_check$(nW)TEST5: DONE diff --git a/src/test/util_sds_check/out6.log.match b/src/test/util_sds_check/out6.log.match new file mode 100644 index 0000000000..8020be36a2 --- /dev/null +++ b/src/test/util_sds_check/out6.log.match @@ -0,0 +1,7 @@ +util_sds_check$(nW)TEST6: START: util_sds_check + $(nW)util_sds_check test_invalid_usc_set_dirty +src version: $(nW) +compiled with support for shutdown state +compiled with libndctl $(nW) +an ADR failure was detected, the pool might be corrupted +util_sds_check$(nW)TEST6: DONE diff --git a/src/test/util_sds_check/out7.log.match b/src/test/util_sds_check/out7.log.match new file mode 100644 index 0000000000..b6ea82698e --- /dev/null +++ b/src/test/util_sds_check/out7.log.match @@ -0,0 +1,6 @@ +util_sds_check$(nW)TEST7: START: util_sds_check + $(nW)util_sds_check test_happy_day +src version: $(nW) +compiled with support for shutdown state +compiled with libndctl $(nW) +util_sds_check$(nW)TEST7: DONE From 99818ca6e71e200f58075a5b5c89bb75c5a4533e Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Thu, 8 May 2025 07:35:42 -0400 Subject: [PATCH 06/15] utils: add more logs Signed-off-by: Oksana Salyk --- src/common/shutdown_state.c | 25 ++++++++++++++++++++----- src/test/util_sds_check/out0.log.match | 1 + src/test/util_sds_check/out3.log.match | 2 +- src/test/util_sds_check/out4.log.match | 2 +- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index d6b8979f7c..41d2ea25db 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -166,15 +166,25 @@ shutdown_state_check(struct shutdown_state *curr_sds, { LOG(3, "curr_sds %p, pool_sds %p", curr_sds, pool_sds); + /* + * This is likely to occur only when the pool is being opened for + * the first time after the SHUTDOWN_STATE feature has been enabled on + * the pool, for example, via (lib)pmempool. + * Please do not confuse this with establishing SDS during creation. + */ if (util_is_zeroed(pool_sds, sizeof(*pool_sds)) && !util_is_zeroed(curr_sds, sizeof(*curr_sds))) { + CORE_LOG_WARNING("zeroed out - SDS will be reinitialized"); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } + bool is_uuid_correct = + le64toh(pool_sds->uuid) == le64toh(curr_sds->uuid); + bool is_uuid_usc_correct = le64toh(pool_sds->usc) == le64toh(curr_sds->usc) && - le64toh(pool_sds->uuid) == le64toh(curr_sds->uuid); + is_uuid_correct; bool is_checksum_correct = util_checksum(pool_sds, sizeof(*pool_sds), &pool_sds->checksum, 0, 0); @@ -202,14 +212,19 @@ shutdown_state_check(struct shutdown_state *curr_sds, return 0; } if (dirty == 0) { - /* an ADR failure but the pool was closed */ CORE_LOG_WARNING( - "an ADR failure was detected but the pool was closed - SDS will be reinitialized"); + is_uuid_correct ? + "the pool has moved to a new location but it was closed properly - SDS will be reinitialized" : + "an ADR failure was detected but the pool was closed - SDS will be reinitialized" + ); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } - /* an ADR failure - the pool might be corrupted */ + ERR_WO_ERRNO( - "an ADR failure was detected, the pool might be corrupted"); + is_uuid_correct ? + "the pool has moved to a new location while it was not closed properly, the pool might be corrupted" : + "an ADR failure was detected, the pool might be corrupted" + ); return 1; } diff --git a/src/test/util_sds_check/out0.log.match b/src/test/util_sds_check/out0.log.match index d90d8e2dcd..ab1353ca4b 100644 --- a/src/test/util_sds_check/out0.log.match +++ b/src/test/util_sds_check/out0.log.match @@ -3,4 +3,5 @@ util_sds_check$(nW)TEST0: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) +zeroed out - SDS will be reinitialized util_sds_check$(nW)TEST0: DONE diff --git a/src/test/util_sds_check/out3.log.match b/src/test/util_sds_check/out3.log.match index 44e6fc63db..b907998eef 100644 --- a/src/test/util_sds_check/out3.log.match +++ b/src/test/util_sds_check/out3.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST3: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -an ADR failure was detected but the pool was closed - SDS will be reinitialized +the pool has moved to a new location but it was closed properly - SDS will be reinitialized util_sds_check$(nW)TEST3: DONE diff --git a/src/test/util_sds_check/out4.log.match b/src/test/util_sds_check/out4.log.match index 59317cbbf2..2a14ecce1b 100644 --- a/src/test/util_sds_check/out4.log.match +++ b/src/test/util_sds_check/out4.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST4: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -an ADR failure was detected, the pool might be corrupted +the pool has moved to a new location while it was not closed properly, the pool might be corrupted util_sds_check$(nW)TEST4: DONE From 1540b54a6f9919021ea2d3fd0cadff6fbab284e2 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Thu, 8 May 2025 07:56:50 -0400 Subject: [PATCH 07/15] common: improve cstyle Signed-off-by: Oksana Salyk --- src/common/shutdown_state.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index 41d2ea25db..c3d2f4ff6d 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -214,17 +214,15 @@ shutdown_state_check(struct shutdown_state *curr_sds, if (dirty == 0) { CORE_LOG_WARNING( is_uuid_correct ? - "the pool has moved to a new location but it was closed properly - SDS will be reinitialized" : - "an ADR failure was detected but the pool was closed - SDS will be reinitialized" - ); + "an ADR failure was detected but the pool was closed - SDS will be reinitialized" : + "the pool has moved to a new location but it was closed properly - SDS will be reinitialized"); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } - + ERR_WO_ERRNO( is_uuid_correct ? - "the pool has moved to a new location while it was not closed properly, the pool might be corrupted" : - "an ADR failure was detected, the pool might be corrupted" - ); + "an ADR failure was detected, the pool might be corrupted" : + "the pool has moved to a new location while it was not closed properly, the pool might be corrupted"); return 1; } From 1c3cea6041ee0728f36dd41c29e6beacb97b035f Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Thu, 8 May 2025 08:21:56 -0400 Subject: [PATCH 08/15] test: update util_sds tests Signed-off-by: Oksana Salyk --- src/test/util_sds/grep1.log.match | 1 + src/test/util_sds/grep2.log.match | 1 + src/test/util_sds/grep3.log.match | 2 +- src/test/util_sds/grep6.log.match | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/util_sds/grep1.log.match b/src/test/util_sds/grep1.log.match index e69de29bb2..125f467fa1 100644 --- a/src/test/util_sds/grep1.log.match +++ b/src/test/util_sds/grep1.log.match @@ -0,0 +1 @@ +: <2> [shutdown_state.c:$(N) shutdown_state_check] zeroed out - SDS will be reinitialized diff --git a/src/test/util_sds/grep2.log.match b/src/test/util_sds/grep2.log.match index e69de29bb2..125f467fa1 100644 --- a/src/test/util_sds/grep2.log.match +++ b/src/test/util_sds/grep2.log.match @@ -0,0 +1 @@ +: <2> [shutdown_state.c:$(N) shutdown_state_check] zeroed out - SDS will be reinitialized diff --git a/src/test/util_sds/grep3.log.match b/src/test/util_sds/grep3.log.match index aa153f3b5d..6efc00f1a0 100644 --- a/src/test/util_sds/grep3.log.match +++ b/src/test/util_sds/grep3.log.match @@ -1 +1 @@ -: <2> [shutdown_state.c:$(N) shutdown_state_check] an ADR failure was detected but the pool was closed - SDS will be reinitialized +: <2> [shutdown_state.c:$(N) shutdown_state_check] the pool has moved to a new location but it was closed properly - SDS will be reinitialized diff --git a/src/test/util_sds/grep6.log.match b/src/test/util_sds/grep6.log.match index 8d26418c32..4a2dd89a3a 100644 --- a/src/test/util_sds/grep6.log.match +++ b/src/test/util_sds/grep6.log.match @@ -1 +1 @@ -: <1> [shutdown_state.c:$(N) shutdown_state_check] an ADR failure was detected, the pool might be corrupted +: <1> [shutdown_state.c:$(N) shutdown_state_check] the pool has moved to a new location while it was not closed properly, the pool might be corrupted From ab7906a3280f8aebb3381d6ad3ae69aa3a23f9e8 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Thu, 8 May 2025 10:17:18 -0400 Subject: [PATCH 09/15] common: improve logs Signed-off-by: Oksana Salyk --- src/common/shutdown_state.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index c3d2f4ff6d..d87cf538f3 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -212,17 +212,16 @@ shutdown_state_check(struct shutdown_state *curr_sds, return 0; } if (dirty == 0) { - CORE_LOG_WARNING( + CORE_LOG_WARNING("%s - SDS will be reinitialized", is_uuid_correct ? - "an ADR failure was detected but the pool was closed - SDS will be reinitialized" : - "the pool has moved to a new location but it was closed properly - SDS will be reinitialized"); + "an ADR failure was detected but the pool was closed" : + "the pool has moved to a new location but it was closed properly"); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } - ERR_WO_ERRNO( - is_uuid_correct ? - "an ADR failure was detected, the pool might be corrupted" : - "the pool has moved to a new location while it was not closed properly, the pool might be corrupted"); + ERR_WO_ERRNO("%s, the pool might be corrupted", is_uuid_correct ? + "an ADR failure was detected" : + "the pool has moved to a new location while it was not closed properly"); return 1; } From ddf54fcd0924888bc9bc61c0d14db918e6177588 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Thu, 8 May 2025 11:25:02 -0400 Subject: [PATCH 10/15] common: update call_all.c.generated Signed-off-by: Oksana Salyk --- src/test/core_log_max/call_all.c.generated | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/test/core_log_max/call_all.c.generated b/src/test/core_log_max/call_all.c.generated index 87024dfe7c..8976952987 100644 --- a/src/test/core_log_max/call_all.c.generated +++ b/src/test/core_log_max/call_all.c.generated @@ -181,13 +181,13 @@ call_all_ERR_WO_ERRNO(void) // src/common/set_badblocks.c ERR_WO_ERRNO("part file contains bad blocks -- '%s'", _s); // src/common/shutdown_state.c - ERR_WO_ERRNO("cannot read uuid of %d", _d); - // src/common/shutdown_state.c - ERR_WO_ERRNO("an ADR failure was detected, the pool might be corrupted"); + ERR_WO_ERRNO("%s, the pool might be corrupted", _s); // src/common/shutdown_state.c ERR_WO_ERRNO("Cannot read unsafe shutdown count. For more information please check https://github.com/pmem/pmdk/issues/4207"); // src/common/shutdown_state.c ERR_WO_ERRNO("cannot read uuid of %d", _d); + // src/common/shutdown_state.c + ERR_WO_ERRNO("cannot read uuid of %d", _d); // src/libpmem/libpmem.c ERR_WO_ERRNO("libpmem major version mismatch (need %u, found %u)", _u, _u); // src/libpmem/libpmem.c @@ -462,11 +462,13 @@ call_all_CORE_LOG_WARNING(void) // src/common/set.c CORE_LOG_WARNING("file permissions changed during pool initialization, file: %s (%o)", _s, _u); // src/common/shutdown_state.c + CORE_LOG_WARNING("zeroed out - SDS will be reinitialized"); + // src/common/shutdown_state.c CORE_LOG_WARNING("incorrect checksum - SDS will be reinitialized"); // src/common/shutdown_state.c CORE_LOG_WARNING("the pool was not closed - SDS will be reinitialized"); // src/common/shutdown_state.c - CORE_LOG_WARNING("an ADR failure was detected but the pool was closed - SDS will be reinitialized"); + CORE_LOG_WARNING("%s - SDS will be reinitialized", _s); // src/libpmemobj/heap.c CORE_LOG_WARNING("failed to allocate memory block runtime tracking info"); // src/libpmemobj/heap.c From c544f80af1b153860dbbb7e701cd128ec4c64589 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Fri, 9 May 2025 02:29:31 -0400 Subject: [PATCH 11/15] test: improve core_log_max test Signed-off-by: Oksana Salyk --- src/test/core_log_max/core_log_max.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/test/core_log_max/core_log_max.c b/src/test/core_log_max/core_log_max.c index 71ef599aac..33365ab2a0 100644 --- a/src/test/core_log_max/core_log_max.c +++ b/src/test/core_log_max/core_log_max.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause /* Copyright 2024, Intel Corporation */ +/* Copyright 2025, Hewlett Packard Enterprise Development LP */ /* * core_log_max.c -- unit test to verify max size of log buffers @@ -119,7 +120,7 @@ test_ERR_W_ERRNO(const struct test_case *tc, int argc, char *argv[]) return NO_ARGS_CONSUMED; } -#define TOTAL_MESSAGE_NUM_EXPECTED 213 +#define TOTAL_MESSAGE_NUM_EXPECTED 214 static int Max_message_len = 0; static int Total_message_num = 0; static char The_longest_message[BIG_BUF_SIZE]; From 4519d94b7845af9b1b757090ea258d4053336909 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Fri, 9 May 2025 08:59:38 -0400 Subject: [PATCH 12/15] common: update log messages Signed-off-by: Oksana Salyk --- src/common/shutdown_state.c | 23 ++++++++++++---------- src/test/core_log_max/call_all.c.generated | 10 +++++----- src/test/util_sds/grep1.log.match | 2 +- src/test/util_sds/grep2.log.match | 2 +- src/test/util_sds/grep3.log.match | 2 +- src/test/util_sds/grep5.log.match | 2 +- src/test/util_sds/grep6.log.match | 2 +- src/test/util_sds/grep7.log.match | 2 +- src/test/util_sds_check/out0.log.match | 2 +- src/test/util_sds_check/out1.log.match | 2 +- src/test/util_sds_check/out2.log.match | 2 +- src/test/util_sds_check/out3.log.match | 2 +- src/test/util_sds_check/out4.log.match | 2 +- src/test/util_sds_check/out5.log.match | 2 +- src/test/util_sds_check/out6.log.match | 2 +- 15 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index d87cf538f3..080812480e 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -174,7 +174,8 @@ shutdown_state_check(struct shutdown_state *curr_sds, */ if (util_is_zeroed(pool_sds, sizeof(*pool_sds)) && !util_is_zeroed(curr_sds, sizeof(*curr_sds))) { - CORE_LOG_WARNING("zeroed out - SDS will be reinitialized"); + CORE_LOG_WARNING( + "Enabling ADR failure detection, assuming pool consistency up to this point."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } @@ -194,7 +195,7 @@ shutdown_state_check(struct shutdown_state *curr_sds, if (!is_checksum_correct) { /* the program was killed during opening or closing the pool */ CORE_LOG_WARNING( - "incorrect checksum - SDS will be reinitialized"); + "Incorrect checksum - the ADR failure detection will be reinitialized."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } @@ -207,21 +208,23 @@ shutdown_state_check(struct shutdown_state *curr_sds, * but there wasn't an ADR failure */ CORE_LOG_WARNING( - "the pool was not closed - SDS will be reinitialized"); + "The pool was not closed - the ADR failure detection will be reinitialized."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } if (dirty == 0) { - CORE_LOG_WARNING("%s - SDS will be reinitialized", - is_uuid_correct ? - "an ADR failure was detected but the pool was closed" : - "the pool has moved to a new location but it was closed properly"); + if (is_uuid_correct) + CORE_LOG_WARNING( + "The ADR failure was detected but the pool was closed - the ADR failure detection will be reinitialized."); + else + CORE_LOG_HARK( + "The pool has moved to a new location but it was closed properly - the ADR failure detection will be reinitialized."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } - ERR_WO_ERRNO("%s, the pool might be corrupted", is_uuid_correct ? - "an ADR failure was detected" : - "the pool has moved to a new location while it was not closed properly"); + ERR_WO_ERRNO("%s, the pool might be corrupted.", is_uuid_correct ? + "The ADR failure was detected" : + "The pool has moved to a new location while it was not closed properly"); return 1; } diff --git a/src/test/core_log_max/call_all.c.generated b/src/test/core_log_max/call_all.c.generated index 8976952987..d1bad8a8cb 100644 --- a/src/test/core_log_max/call_all.c.generated +++ b/src/test/core_log_max/call_all.c.generated @@ -181,7 +181,7 @@ call_all_ERR_WO_ERRNO(void) // src/common/set_badblocks.c ERR_WO_ERRNO("part file contains bad blocks -- '%s'", _s); // src/common/shutdown_state.c - ERR_WO_ERRNO("%s, the pool might be corrupted", _s); + ERR_WO_ERRNO("%s, the pool might be corrupted.", _s); // src/common/shutdown_state.c ERR_WO_ERRNO("Cannot read unsafe shutdown count. For more information please check https://github.com/pmem/pmdk/issues/4207"); // src/common/shutdown_state.c @@ -462,13 +462,13 @@ call_all_CORE_LOG_WARNING(void) // src/common/set.c CORE_LOG_WARNING("file permissions changed during pool initialization, file: %s (%o)", _s, _u); // src/common/shutdown_state.c - CORE_LOG_WARNING("zeroed out - SDS will be reinitialized"); + CORE_LOG_WARNING("Enabling ADR failure detection, assuming pool consistency up to this point."); // src/common/shutdown_state.c - CORE_LOG_WARNING("incorrect checksum - SDS will be reinitialized"); + CORE_LOG_WARNING("Incorrect checksum - the ADR failure detection will be reinitialized."); // src/common/shutdown_state.c - CORE_LOG_WARNING("the pool was not closed - SDS will be reinitialized"); + CORE_LOG_WARNING("The pool was not closed - the ADR failure detection will be reinitialized."); // src/common/shutdown_state.c - CORE_LOG_WARNING("%s - SDS will be reinitialized", _s); + CORE_LOG_WARNING("The ADR failure was detected but the pool was closed - the ADR failure detection will be reinitialized."); // src/libpmemobj/heap.c CORE_LOG_WARNING("failed to allocate memory block runtime tracking info"); // src/libpmemobj/heap.c diff --git a/src/test/util_sds/grep1.log.match b/src/test/util_sds/grep1.log.match index 125f467fa1..19a52cb124 100644 --- a/src/test/util_sds/grep1.log.match +++ b/src/test/util_sds/grep1.log.match @@ -1 +1 @@ -: <2> [shutdown_state.c:$(N) shutdown_state_check] zeroed out - SDS will be reinitialized +: <2> [shutdown_state.c:$(N) shutdown_state_check] Enabling ADR failure detection, assuming pool consistency up to this point. diff --git a/src/test/util_sds/grep2.log.match b/src/test/util_sds/grep2.log.match index 125f467fa1..19a52cb124 100644 --- a/src/test/util_sds/grep2.log.match +++ b/src/test/util_sds/grep2.log.match @@ -1 +1 @@ -: <2> [shutdown_state.c:$(N) shutdown_state_check] zeroed out - SDS will be reinitialized +: <2> [shutdown_state.c:$(N) shutdown_state_check] Enabling ADR failure detection, assuming pool consistency up to this point. diff --git a/src/test/util_sds/grep3.log.match b/src/test/util_sds/grep3.log.match index 6efc00f1a0..7abd048fb3 100644 --- a/src/test/util_sds/grep3.log.match +++ b/src/test/util_sds/grep3.log.match @@ -1 +1 @@ -: <2> [shutdown_state.c:$(N) shutdown_state_check] the pool has moved to a new location but it was closed properly - SDS will be reinitialized +: <1> [shutdown_state.c:$(N) shutdown_state_check] The pool has moved to a new location but it was closed properly - the ADR failure detection will be reinitialized. diff --git a/src/test/util_sds/grep5.log.match b/src/test/util_sds/grep5.log.match index 1926c20d1e..e788b27bbc 100644 --- a/src/test/util_sds/grep5.log.match +++ b/src/test/util_sds/grep5.log.match @@ -1 +1 @@ -: <2> [shutdown_state.c:$(N) shutdown_state_check] the pool was not closed - SDS will be reinitialized +: <2> [shutdown_state.c:$(N) shutdown_state_check] The pool was not closed - the ADR failure detection will be reinitialized. diff --git a/src/test/util_sds/grep6.log.match b/src/test/util_sds/grep6.log.match index 4a2dd89a3a..3b7821ca80 100644 --- a/src/test/util_sds/grep6.log.match +++ b/src/test/util_sds/grep6.log.match @@ -1 +1 @@ -: <1> [shutdown_state.c:$(N) shutdown_state_check] the pool has moved to a new location while it was not closed properly, the pool might be corrupted +: <1> [shutdown_state.c:$(N) shutdown_state_check] The pool has moved to a new location while it was not closed properly, the pool might be corrupted. diff --git a/src/test/util_sds/grep7.log.match b/src/test/util_sds/grep7.log.match index 8d26418c32..60fff6cfdd 100644 --- a/src/test/util_sds/grep7.log.match +++ b/src/test/util_sds/grep7.log.match @@ -1 +1 @@ -: <1> [shutdown_state.c:$(N) shutdown_state_check] an ADR failure was detected, the pool might be corrupted +: <1> [shutdown_state.c:$(N) shutdown_state_check] The ADR failure was detected, the pool might be corrupted. diff --git a/src/test/util_sds_check/out0.log.match b/src/test/util_sds_check/out0.log.match index ab1353ca4b..31270abc1b 100644 --- a/src/test/util_sds_check/out0.log.match +++ b/src/test/util_sds_check/out0.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST0: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -zeroed out - SDS will be reinitialized +Enabling ADR failure detection, assuming pool consistency up to this point. util_sds_check$(nW)TEST0: DONE diff --git a/src/test/util_sds_check/out1.log.match b/src/test/util_sds_check/out1.log.match index 2864fc4a1c..ef37494127 100644 --- a/src/test/util_sds_check/out1.log.match +++ b/src/test/util_sds_check/out1.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST1: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -incorrect checksum - SDS will be reinitialized +Incorrect checksum - the ADR failure detection will be reinitialized. util_sds_check$(nW)TEST1: DONE diff --git a/src/test/util_sds_check/out2.log.match b/src/test/util_sds_check/out2.log.match index 226778be52..e858ac0504 100644 --- a/src/test/util_sds_check/out2.log.match +++ b/src/test/util_sds_check/out2.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST2: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -the pool was not closed - SDS will be reinitialized +The pool was not closed - the ADR failure detection will be reinitialized. util_sds_check$(nW)TEST2: DONE diff --git a/src/test/util_sds_check/out3.log.match b/src/test/util_sds_check/out3.log.match index b907998eef..64d14450c8 100644 --- a/src/test/util_sds_check/out3.log.match +++ b/src/test/util_sds_check/out3.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST3: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -the pool has moved to a new location but it was closed properly - SDS will be reinitialized +The pool has moved to a new location but it was closed properly - the ADR failure detection will be reinitialized. util_sds_check$(nW)TEST3: DONE diff --git a/src/test/util_sds_check/out4.log.match b/src/test/util_sds_check/out4.log.match index 2a14ecce1b..d2c1062320 100644 --- a/src/test/util_sds_check/out4.log.match +++ b/src/test/util_sds_check/out4.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST4: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -the pool has moved to a new location while it was not closed properly, the pool might be corrupted +The pool has moved to a new location while it was not closed properly, the pool might be corrupted. util_sds_check$(nW)TEST4: DONE diff --git a/src/test/util_sds_check/out5.log.match b/src/test/util_sds_check/out5.log.match index f68bbc3b83..6bf91d181e 100644 --- a/src/test/util_sds_check/out5.log.match +++ b/src/test/util_sds_check/out5.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST5: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -an ADR failure was detected but the pool was closed - SDS will be reinitialized +The ADR failure was detected but the pool was closed - the ADR failure detection will be reinitialized. util_sds_check$(nW)TEST5: DONE diff --git a/src/test/util_sds_check/out6.log.match b/src/test/util_sds_check/out6.log.match index 8020be36a2..f650dbbbb8 100644 --- a/src/test/util_sds_check/out6.log.match +++ b/src/test/util_sds_check/out6.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST6: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -an ADR failure was detected, the pool might be corrupted +The ADR failure was detected, the pool might be corrupted. util_sds_check$(nW)TEST6: DONE From 6e9e7a4520ecb7a1890835ec55e0790ce3961fd7 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Mon, 12 May 2025 02:44:45 -0400 Subject: [PATCH 13/15] common: update the logs Signed-off-by: Oksana Salyk --- src/common/shutdown_state.c | 4 ++-- src/test/core_log_max/call_all.c.generated | 4 ++-- src/test/util_sds/grep5.log.match | 2 +- src/test/util_sds_check/out2.log.match | 2 +- src/test/util_sds_check/out5.log.match | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index 080812480e..3669282cce 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -208,14 +208,14 @@ shutdown_state_check(struct shutdown_state *curr_sds, * but there wasn't an ADR failure */ CORE_LOG_WARNING( - "The pool was not closed - the ADR failure detection will be reinitialized."); + "The ADR failure was detected but the pool was closed properly - reinitializing the ADR failure detection."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } if (dirty == 0) { if (is_uuid_correct) CORE_LOG_WARNING( - "The ADR failure was detected but the pool was closed - the ADR failure detection will be reinitialized."); + "The ADR failure was detected but the pool was closed properly - the ADR failure detection will be reinitialized."); else CORE_LOG_HARK( "The pool has moved to a new location but it was closed properly - the ADR failure detection will be reinitialized."); diff --git a/src/test/core_log_max/call_all.c.generated b/src/test/core_log_max/call_all.c.generated index d1bad8a8cb..44699d5d60 100644 --- a/src/test/core_log_max/call_all.c.generated +++ b/src/test/core_log_max/call_all.c.generated @@ -466,9 +466,9 @@ call_all_CORE_LOG_WARNING(void) // src/common/shutdown_state.c CORE_LOG_WARNING("Incorrect checksum - the ADR failure detection will be reinitialized."); // src/common/shutdown_state.c - CORE_LOG_WARNING("The pool was not closed - the ADR failure detection will be reinitialized."); + CORE_LOG_WARNING("The ADR failure was detected but the pool was closed properly - reinitializing the ADR failure detection."); // src/common/shutdown_state.c - CORE_LOG_WARNING("The ADR failure was detected but the pool was closed - the ADR failure detection will be reinitialized."); + CORE_LOG_WARNING("The ADR failure was detected but the pool was closed properly - the ADR failure detection will be reinitialized."); // src/libpmemobj/heap.c CORE_LOG_WARNING("failed to allocate memory block runtime tracking info"); // src/libpmemobj/heap.c diff --git a/src/test/util_sds/grep5.log.match b/src/test/util_sds/grep5.log.match index e788b27bbc..374b0f220b 100644 --- a/src/test/util_sds/grep5.log.match +++ b/src/test/util_sds/grep5.log.match @@ -1 +1 @@ -: <2> [shutdown_state.c:$(N) shutdown_state_check] The pool was not closed - the ADR failure detection will be reinitialized. +: <2> [shutdown_state.c:$(N) shutdown_state_check] The ADR failure was detected but the pool was closed properly - reinitializing the ADR failure detection. diff --git a/src/test/util_sds_check/out2.log.match b/src/test/util_sds_check/out2.log.match index e858ac0504..bf2586d99a 100644 --- a/src/test/util_sds_check/out2.log.match +++ b/src/test/util_sds_check/out2.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST2: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -The pool was not closed - the ADR failure detection will be reinitialized. +The ADR failure was detected but the pool was closed properly - reinitializing the ADR failure detection. util_sds_check$(nW)TEST2: DONE diff --git a/src/test/util_sds_check/out5.log.match b/src/test/util_sds_check/out5.log.match index 6bf91d181e..dcec83cac8 100644 --- a/src/test/util_sds_check/out5.log.match +++ b/src/test/util_sds_check/out5.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST5: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -The ADR failure was detected but the pool was closed - the ADR failure detection will be reinitialized. +The ADR failure was detected but the pool was closed properly - the ADR failure detection will be reinitialized. util_sds_check$(nW)TEST5: DONE From 258261ff94b9a7f8392574fd38661d3e8f7dddaf Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Mon, 12 May 2025 09:18:22 -0400 Subject: [PATCH 14/15] test: improve logs Signed-off-by: Oksana Salyk --- src/common/shutdown_state.c | 8 ++++---- src/test/core_log_max/call_all.c.generated | 6 +++--- src/test/util_sds/grep3.log.match | 2 +- src/test/util_sds/grep5.log.match | 2 +- src/test/util_sds_check/out1.log.match | 2 +- src/test/util_sds_check/out2.log.match | 2 +- src/test/util_sds_check/out3.log.match | 2 +- src/test/util_sds_check/out5.log.match | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index 3669282cce..fd7024e0e6 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -195,7 +195,7 @@ shutdown_state_check(struct shutdown_state *curr_sds, if (!is_checksum_correct) { /* the program was killed during opening or closing the pool */ CORE_LOG_WARNING( - "Incorrect checksum - the ADR failure detection will be reinitialized."); + "Incorrect checksum - reinitializing ADR failure detection."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } @@ -208,17 +208,17 @@ shutdown_state_check(struct shutdown_state *curr_sds, * but there wasn't an ADR failure */ CORE_LOG_WARNING( - "The ADR failure was detected but the pool was closed properly - reinitializing the ADR failure detection."); + "The ADR failure was detected but the pool was closed properly - reinitializing ADR failure detection."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } if (dirty == 0) { if (is_uuid_correct) CORE_LOG_WARNING( - "The ADR failure was detected but the pool was closed properly - the ADR failure detection will be reinitialized."); + "The ADR failure was detected but the pool was closed properly - reinitializing ADR failure detection."); else CORE_LOG_HARK( - "The pool has moved to a new location but it was closed properly - the ADR failure detection will be reinitialized."); + "The pool has moved to a new location but it was closed properly - reinitializing ADR failure detection."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } diff --git a/src/test/core_log_max/call_all.c.generated b/src/test/core_log_max/call_all.c.generated index 44699d5d60..38fa8646c8 100644 --- a/src/test/core_log_max/call_all.c.generated +++ b/src/test/core_log_max/call_all.c.generated @@ -464,11 +464,11 @@ call_all_CORE_LOG_WARNING(void) // src/common/shutdown_state.c CORE_LOG_WARNING("Enabling ADR failure detection, assuming pool consistency up to this point."); // src/common/shutdown_state.c - CORE_LOG_WARNING("Incorrect checksum - the ADR failure detection will be reinitialized."); + CORE_LOG_WARNING("Incorrect checksum - reinitializing ADR failure detection."); // src/common/shutdown_state.c - CORE_LOG_WARNING("The ADR failure was detected but the pool was closed properly - reinitializing the ADR failure detection."); + CORE_LOG_WARNING("The ADR failure was detected but the pool was closed properly - reinitializing ADR failure detection."); // src/common/shutdown_state.c - CORE_LOG_WARNING("The ADR failure was detected but the pool was closed properly - the ADR failure detection will be reinitialized."); + CORE_LOG_WARNING("The ADR failure was detected but the pool was closed properly - reinitializing ADR failure detection."); // src/libpmemobj/heap.c CORE_LOG_WARNING("failed to allocate memory block runtime tracking info"); // src/libpmemobj/heap.c diff --git a/src/test/util_sds/grep3.log.match b/src/test/util_sds/grep3.log.match index 7abd048fb3..65fdd3a5a2 100644 --- a/src/test/util_sds/grep3.log.match +++ b/src/test/util_sds/grep3.log.match @@ -1 +1 @@ -: <1> [shutdown_state.c:$(N) shutdown_state_check] The pool has moved to a new location but it was closed properly - the ADR failure detection will be reinitialized. +: <1> [shutdown_state.c:$(N) shutdown_state_check] The pool has moved to a new location but it was closed properly - reinitializing ADR failure detection. diff --git a/src/test/util_sds/grep5.log.match b/src/test/util_sds/grep5.log.match index 374b0f220b..64f8dea763 100644 --- a/src/test/util_sds/grep5.log.match +++ b/src/test/util_sds/grep5.log.match @@ -1 +1 @@ -: <2> [shutdown_state.c:$(N) shutdown_state_check] The ADR failure was detected but the pool was closed properly - reinitializing the ADR failure detection. +: <2> [shutdown_state.c:$(N) shutdown_state_check] The ADR failure was detected but the pool was closed properly - reinitializing ADR failure detection. diff --git a/src/test/util_sds_check/out1.log.match b/src/test/util_sds_check/out1.log.match index ef37494127..2cbac636da 100644 --- a/src/test/util_sds_check/out1.log.match +++ b/src/test/util_sds_check/out1.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST1: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -Incorrect checksum - the ADR failure detection will be reinitialized. +Incorrect checksum - reinitializing ADR failure detection. util_sds_check$(nW)TEST1: DONE diff --git a/src/test/util_sds_check/out2.log.match b/src/test/util_sds_check/out2.log.match index bf2586d99a..8e878eb850 100644 --- a/src/test/util_sds_check/out2.log.match +++ b/src/test/util_sds_check/out2.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST2: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -The ADR failure was detected but the pool was closed properly - reinitializing the ADR failure detection. +The ADR failure was detected but the pool was closed properly - reinitializing ADR failure detection. util_sds_check$(nW)TEST2: DONE diff --git a/src/test/util_sds_check/out3.log.match b/src/test/util_sds_check/out3.log.match index 64d14450c8..6b65326c5b 100644 --- a/src/test/util_sds_check/out3.log.match +++ b/src/test/util_sds_check/out3.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST3: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -The pool has moved to a new location but it was closed properly - the ADR failure detection will be reinitialized. +The pool has moved to a new location but it was closed properly - reinitializing ADR failure detection. util_sds_check$(nW)TEST3: DONE diff --git a/src/test/util_sds_check/out5.log.match b/src/test/util_sds_check/out5.log.match index dcec83cac8..7a7f21f0d1 100644 --- a/src/test/util_sds_check/out5.log.match +++ b/src/test/util_sds_check/out5.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST5: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -The ADR failure was detected but the pool was closed properly - the ADR failure detection will be reinitialized. +The ADR failure was detected but the pool was closed properly - reinitializing ADR failure detection. util_sds_check$(nW)TEST5: DONE From e9ce146721e4e7e71954746fdc90d1b5066f7913 Mon Sep 17 00:00:00 2001 From: Oksana Salyk Date: Tue, 13 May 2025 09:18:13 -0400 Subject: [PATCH 15/15] common: update tests --- src/common/shutdown_state.c | 2 +- src/test/core_log_max/call_all.c.generated | 2 +- src/test/util_sds_check/out1.log.match | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/shutdown_state.c b/src/common/shutdown_state.c index fd7024e0e6..49e9caad9a 100644 --- a/src/common/shutdown_state.c +++ b/src/common/shutdown_state.c @@ -195,7 +195,7 @@ shutdown_state_check(struct shutdown_state *curr_sds, if (!is_checksum_correct) { /* the program was killed during opening or closing the pool */ CORE_LOG_WARNING( - "Incorrect checksum - reinitializing ADR failure detection."); + "The pool was not opened/closed properly - reinitializing ADR failure detection."); shutdown_state_reinit(curr_sds, pool_sds, rep); return 0; } diff --git a/src/test/core_log_max/call_all.c.generated b/src/test/core_log_max/call_all.c.generated index 38fa8646c8..b18eae048c 100644 --- a/src/test/core_log_max/call_all.c.generated +++ b/src/test/core_log_max/call_all.c.generated @@ -464,7 +464,7 @@ call_all_CORE_LOG_WARNING(void) // src/common/shutdown_state.c CORE_LOG_WARNING("Enabling ADR failure detection, assuming pool consistency up to this point."); // src/common/shutdown_state.c - CORE_LOG_WARNING("Incorrect checksum - reinitializing ADR failure detection."); + CORE_LOG_WARNING("The pool was not opened/closed properly - reinitializing ADR failure detection."); // src/common/shutdown_state.c CORE_LOG_WARNING("The ADR failure was detected but the pool was closed properly - reinitializing ADR failure detection."); // src/common/shutdown_state.c diff --git a/src/test/util_sds_check/out1.log.match b/src/test/util_sds_check/out1.log.match index 2cbac636da..c9575de573 100644 --- a/src/test/util_sds_check/out1.log.match +++ b/src/test/util_sds_check/out1.log.match @@ -3,5 +3,5 @@ util_sds_check$(nW)TEST1: START: util_sds_check src version: $(nW) compiled with support for shutdown state compiled with libndctl $(nW) -Incorrect checksum - reinitializing ADR failure detection. +The pool was not opened/closed properly - reinitializing ADR failure detection. util_sds_check$(nW)TEST1: DONE