From ffc3b7b27acd831d5d363ced1464ff20fbc6f47a Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Sat, 25 Mar 2023 11:03:23 +0800 Subject: [PATCH] enh: add the errorcode TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO --- include/util/taoserror.h | 1 + source/dnode/mnode/impl/src/mndDb.c | 2 +- source/dnode/mnode/impl/src/mndTopic.c | 2 +- source/util/src/terror.c | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 75b71409a8..ad8d4244b5 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -288,6 +288,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0389) // internal #define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x038A) // #define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x038B) +#define TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO TAOS_DEF_ERROR_CODE(0, 0x038C) // #define TSDB_CODE_MND_INVALID_DB_OPTION_DAYS TAOS_DEF_ERROR_CODE(0, 0x0390) // 2.x // #define TSDB_CODE_MND_INVALID_DB_OPTION_KEEP TAOS_DEF_ERROR_CODE(0, 0x0391) // 2.x // #define TSDB_CODE_MND_INVALID_TOPIC TAOS_DEF_ERROR_CODE(0, 0x0392) // 2.x diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 27813826ba..65516781fc 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -855,7 +855,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) { } if (numOfTopics != 0 && alterReq.walRetentionPeriod == 0) { - terrno = TSDB_CODE_MND_INVALID_DB_OPTION; + terrno = TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO; mError("db:%s, not allowed to set WAL_RETENTION_PERIOD 0 when there are topics defined. numOfTopics:%d", pDb->name, numOfTopics); goto _OVER; diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index de2aee6dcc..f6da370916 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -606,7 +606,7 @@ static int32_t mndProcessCreateTopicReq(SRpcMsg *pReq) { } if (pDb->cfg.walRetentionPeriod == 0) { - terrno = TSDB_CODE_MND_INVALID_DB_OPTION; + terrno = TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO; mError("db:%s, not allowed to create topic when WAL_RETENTION_PERIOD is zero", pDb->name); goto _OVER; } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 1f49f8f8b5..f586e54491 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -224,6 +224,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB, "Invalid database name TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_DATABASES, "Too many databases for account") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_IN_DROPPING, "Database in dropping status") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_NOT_EXIST, "Database not exist") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_RETENTION_PERIOD_ZERO, "WAL retention period is zero") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_ACCT, "Invalid database account") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_OPTION_UNCHANGED, "Database options not changed") TAOS_DEFINE_ERROR(TSDB_CODE_MND_DB_INDEX_NOT_EXIST, "Index not exist") -- GitLab