From 4237cafb21273c9b9376ff676aa37bfb345772c1 Mon Sep 17 00:00:00 2001 From: "benguang.zhao" Date: Tue, 1 Nov 2022 17:19:33 +0800 Subject: [PATCH] enh: rename walRecoverSizeLimit to walFsyncDataSizeLimit --- include/common/tglobal.h | 2 +- source/common/src/tglobal.c | 7 ++++--- source/libs/wal/src/walMeta.c | 4 ++-- source/libs/wal/src/walWrite.c | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index f277eea219..f12f03499f 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -126,7 +126,7 @@ extern char tsSmlTagName[]; extern bool tsSmlDataFormat; // wal -extern int64_t tsWalRecoverSizeLimit; +extern int64_t tsWalFsyncDataSizeLimit; // internal extern int32_t tsTransPullupInterval; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index f1a0fa1145..3bfd10f687 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -157,7 +157,7 @@ char tsCompressor[32] = "ZSTD_COMPRESSOR"; // ZSTD_COMPRESSOR or GZIP_COMPR bool tsStartUdfd = true; // wal -int64_t tsWalRecoverSizeLimit = (600 * 1024 * 1024L); +int64_t tsWalFsyncDataSizeLimit = (100 * 1024 * 1024L); // internal int32_t tsTransPullupInterval = 2; @@ -425,7 +425,8 @@ static int32_t taosAddServerCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "uptimeInterval", tsUptimeInterval, 1, 100000, 1) != 0) return -1; if (cfgAddInt32(pCfg, "queryRsmaTolerance", tsQueryRsmaTolerance, 0, 900000, 0) != 0) return -1; - if (cfgAddInt64(pCfg, "walRecoverSizeLimit", tsWalRecoverSizeLimit, 3 * 1024 * 1024, INT64_MAX, 0) != 0) return -1; + if (cfgAddInt64(pCfg, "walFsyncDataSizeLimit", tsWalFsyncDataSizeLimit, 100 * 1024 * 1024, INT64_MAX, 0) != 0) + return -1; if (cfgAddBool(pCfg, "udf", tsStartUdfd, 0) != 0) return -1; if (cfgAddString(pCfg, "udfdResFuncs", tsUdfdResFuncs, 0) != 0) return -1; @@ -725,7 +726,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) { tsUptimeInterval = cfgGetItem(pCfg, "uptimeInterval")->i32; tsQueryRsmaTolerance = cfgGetItem(pCfg, "queryRsmaTolerance")->i32; - tsWalRecoverSizeLimit = cfgGetItem(pCfg, "walRecoverSizeLimit")->i64; + tsWalFsyncDataSizeLimit = cfgGetItem(pCfg, "walFsyncDataSizeLimit")->i64; tsStartUdfd = cfgGetItem(pCfg, "udf")->bval; tstrncpy(tsUdfdResFuncs, cfgGetItem(pCfg, "udfdResFuncs")->str, sizeof(tsUdfdResFuncs)); diff --git a/source/libs/wal/src/walMeta.c b/source/libs/wal/src/walMeta.c index f52b80d1d3..4f8846d0ec 100644 --- a/source/libs/wal/src/walMeta.c +++ b/source/libs/wal/src/walMeta.c @@ -80,10 +80,10 @@ static FORCE_INLINE int64_t walScanLogGetLastVer(SWal* pWal, int32_t fileIdx) { int64_t offsetBackward = offset; int64_t recoverSize = end - offset; - if (tsWalRecoverSizeLimit < recoverSize) { + if (2 * tsWalFsyncDataSizeLimit < recoverSize) { wError("vgId:%d, possibly corrupted WAL range exceeds size limit (i.e. %" PRId64 " bytes). offset:%" PRId64 ", end:%" PRId64 ", file:%s", - pWal->cfg.vgId, tsWalRecoverSizeLimit, offset, end, fnameStr); + pWal->cfg.vgId, 2 * tsWalFsyncDataSizeLimit, offset, end, fnameStr); terrno = TSDB_CODE_WAL_SIZE_LIMIT; goto _err; } diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 005450a267..b5e9346b65 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -253,7 +253,7 @@ static FORCE_INLINE int32_t walCheckAndRoll(SWal *pWal) { } } - if (walGetLastFileCachedSize(pWal) > tsWalRecoverSizeLimit / 2) { + if (walGetLastFileCachedSize(pWal) > tsWalFsyncDataSizeLimit) { if (walSaveMeta(pWal) < 0) { return -1; } -- GitLab