From 1ae3cab1982431a01229a1718267504a4c1f8402 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 26 Oct 2022 10:56:50 +0800 Subject: [PATCH 1/4] refactor(sync): check pSyncTimer NULL --- source/libs/sync/src/syncMain.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 44c19f5431..f1c900de50 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -1645,7 +1645,9 @@ int32_t syncNodeStartHeartbeatTimer(SSyncNode* pSyncNode) { for (int i = 0; i < pSyncNode->peersNum; ++i) { SSyncTimer* pSyncTimer = syncNodeGetHbTimer(pSyncNode, &(pSyncNode->peersId[i])); - syncHbTimerStart(pSyncNode, pSyncTimer); + if (pSyncTimer != NULL) { + syncHbTimerStart(pSyncNode, pSyncTimer); + } } return ret; @@ -1662,7 +1664,9 @@ int32_t syncNodeStopHeartbeatTimer(SSyncNode* pSyncNode) { for (int i = 0; i < pSyncNode->peersNum; ++i) { SSyncTimer* pSyncTimer = syncNodeGetHbTimer(pSyncNode, &(pSyncNode->peersId[i])); - syncHbTimerStop(pSyncNode, pSyncTimer); + if (pSyncTimer != NULL) { + syncHbTimerStop(pSyncNode, pSyncTimer); + } } return ret; From 95d51891b925b23f682201ae8e7a3545fd994ea8 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 26 Oct 2022 13:55:30 +0800 Subject: [PATCH 2/4] refactor(sync): adjust multi replica wal retension size --- include/util/tdef.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index 936fbdf0d5..e298509ad6 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -234,9 +234,9 @@ typedef enum ELogicConditionType { * - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus * the final value is 65531-(4096-1)*4 = 49151. */ -#define TSDB_MAX_BYTES_PER_ROW 49151 -#define TSDB_MAX_TAGS_LEN 16384 -#define TSDB_MAX_TAGS 128 +#define TSDB_MAX_BYTES_PER_ROW 49151 +#define TSDB_MAX_TAGS_LEN 16384 +#define TSDB_MAX_TAGS 128 #define TSDB_MAX_COL_TAG_NUM (TSDB_MAX_COLUMNS + TSDB_MAX_TAGS) #define TSDB_MAX_JSON_TAG_LEN 16384 @@ -370,13 +370,13 @@ typedef enum ELogicConditionType { #define TSDB_DB_MIN_WAL_RETENTION_PERIOD -1 #define TSDB_REP_DEF_DB_WAL_RET_PERIOD 0 -#define TSDB_REPS_DEF_DB_WAL_RET_PERIOD (24 * 60 * 60 * 4) +#define TSDB_REPS_DEF_DB_WAL_RET_PERIOD 0 #define TSDB_DB_MIN_WAL_RETENTION_SIZE -1 #define TSDB_REP_DEF_DB_WAL_RET_SIZE 0 -#define TSDB_REPS_DEF_DB_WAL_RET_SIZE -1 +#define TSDB_REPS_DEF_DB_WAL_RET_SIZE 0 #define TSDB_DB_MIN_WAL_ROLL_PERIOD 0 #define TSDB_REP_DEF_DB_WAL_ROLL_PERIOD 0 -#define TSDB_REPS_DEF_DB_WAL_ROLL_PERIOD (24 * 60 * 60 * 1) +#define TSDB_REPS_DEF_DB_WAL_ROLL_PERIOD 0 #define TSDB_DB_MIN_WAL_SEGMENT_SIZE 0 #define TSDB_DEFAULT_DB_WAL_SEGMENT_SIZE 0 @@ -409,7 +409,7 @@ typedef enum ELogicConditionType { #define TSDB_MAX_RPC_THREADS 10 #endif -#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type +#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type #define TSDB_META_COMPACT_RATIO 0 // disable tsdb meta compact by default @@ -486,7 +486,7 @@ enum { #define MAX_NUM_STR_SIZE 40 -#define MAX_META_MSG_IN_BATCH 1048576 +#define MAX_META_MSG_IN_BATCH 1048576 #define MAX_META_BATCH_RSP_SIZE (1 * 1048576 * 1024) #ifdef __cplusplus From 169fd67ddb9ed59a043eb9a865fbd66e403a9079 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 26 Oct 2022 15:06:54 +0800 Subject: [PATCH 3/4] refactor(sync): adjust log retention size --- include/libs/sync/sync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libs/sync/sync.h b/include/libs/sync/sync.h index ff14e637d0..b6c4a58150 100644 --- a/include/libs/sync/sync.h +++ b/include/libs/sync/sync.h @@ -38,7 +38,7 @@ extern bool gRaftDetailLog; #define SYNC_DEL_WAL_MS (1000 * 60) #define SYNC_ADD_QUORUM_COUNT 3 #define SYNC_MNODE_LOG_RETENTION 10000 -#define SYNC_VNODE_LOG_RETENTION 500 +#define SYNC_VNODE_LOG_RETENTION 100 #define SYNC_APPEND_ENTRIES_TIMEOUT_MS 10000 From 913517f05a1545fe681bfae62cc217a432e43ce2 Mon Sep 17 00:00:00 2001 From: Minghao Li Date: Wed, 26 Oct 2022 19:49:12 +0800 Subject: [PATCH 4/4] fix(sync): modify case alter_option.sim, default value --- tests/script/tsim/db/alter_option.sim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index 3d260235f2..b6139cea13 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -111,13 +111,13 @@ endi if $data21_db != 1000 then # wal_level fsyncperiod return -1 endi -if $data22_db != 345600 then # wal_retention_period +if $data22_db != 0 then # wal_retention_period return -1 endi -if $data23_db != -1 then # wal_retention_size +if $data23_db != 0 then # wal_retention_size return -1 endi -if $data24_db != 86400 then # wal_roll_period +if $data24_db != 0 then # wal_roll_period return -1 endi if $data25_db != 0 then # wal_segment_size