From 89b913c2bc17ce8730a53fd18a6a74a758a1a990 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sat, 20 Mar 2021 19:16:12 +0800 Subject: [PATCH] TD-3310 --- src/inc/taoserror.h | 2 ++ src/util/src/terror.c | 2 ++ tests/script/general/db/topic1.sim | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index e069d0295a..8daccee1f2 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -187,6 +187,8 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_INVALID_TOPIC TAOS_DEF_ERROR_CODE(0, 0x0392) //"Invalid topic name) #define TSDB_CODE_MND_INVALID_TOPIC_OPTION TAOS_DEF_ERROR_CODE(0, 0x0393) //"Invalid topic option) +#define TSDB_CODE_MND_INVALID_TOPIC_PARTITONS TAOS_DEF_ERROR_CODE(0, 0x0394) //"Invalid topic partitons num, valid range: [1, 1000]) +#define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0395) //"Topic already exists) // dnode #define TSDB_CODE_DND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0400) //"Message not processed") diff --git a/src/util/src/terror.c b/src/util/src/terror.c index 221e618390..918ccc4935 100644 --- a/src/util/src/terror.c +++ b/src/util/src/terror.c @@ -199,6 +199,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_DB_OPTION_KEEP, "Invalid database opti TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TOPIC, "Invalid topic name") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TOPIC_OPTION, "Invalid topic option") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TOPIC_PARTITONS, "Invalid topic partitons num, valid range: [1, 1000]") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOPIC_ALREADY_EXIST, "Topic already exists") // dnode TAOS_DEFINE_ERROR(TSDB_CODE_DND_MSG_NOT_PROCESSED, "Message not processed") diff --git a/tests/script/general/db/topic1.sim b/tests/script/general/db/topic1.sim index cdfb8ea2ec..55349fd925 100644 --- a/tests/script/general/db/topic1.sim +++ b/tests/script/general/db/topic1.sim @@ -842,4 +842,28 @@ if $rows != 10 then return -1 endi +sql drop topic t1 + +print ============== create same name topic +sql create database d2 +sql create topic t2 + +sql_error create topic d2 +sql_error create topic if not exists d2 +sql_error create topic t2 +sql create topic if not exists t2 +sql_error create topic t2 partitions 5; +sql_error create topic t2 partitions 6; +sql_error create topic t2 partitions 3; + +sql_error alter topic t3 partitions 1 +sql_error alter topic d2 partitions 1 +sql_error alter topic t2 partitions 0 +sql_error alter topic t2 partitions 10000 + +sql_error drop topic d2 +sql_error drop topic d3 +sql drop database d2 +sql drop database t2 + system sh/exec.sh -n dnode1 -s stop -x SIGINT -- GitLab