From 28325c90807b1a605c0d07455e111cf11c11ee6e Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 26 Apr 2022 17:18:10 +0800 Subject: [PATCH] reject wal write if exceeds limit --- source/libs/wal/src/walWrite.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index d025ca3781..cbf77afe6f 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -251,11 +251,14 @@ static int walWriteIndex(SWal *pWal, int64_t ver, int64_t offset) { int64_t walWriteWithSyncInfo(SWal *pWal, int64_t index, tmsg_t msgType, SSyncLogMeta syncMeta, const void *body, int32_t bodyLen) { - if (pWal == NULL) return -1; int code = 0; // no wal if (pWal->cfg.level == TAOS_WAL_NOLOG) return 0; + if (bodyLen > WAL_MAX_SIZE) { + terrno = TSDB_CODE_WAL_SIZE_LIMIT; + return -1; + } if (index == pWal->vers.lastVer + 1) { if (taosArrayGetSize(pWal->fileInfoSet) == 0) { -- GitLab