From 4898cd7281611e98f48be629e0327f2f7938b253 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 21 May 2020 03:57:05 +0000 Subject: [PATCH] [TD-374] change some defs --- src/common/src/tglobal.c | 1 - src/inc/taosdef.h | 15 ++++++++------- src/kit/taosdump/taosdump.c | 6 ++++-- src/mnode/src/mgmtAcct.c | 2 +- src/mnode/src/mgmtDb.c | 2 +- src/mnode/src/mgmtDnode.c | 2 +- src/mnode/src/mgmtMnode.c | 2 +- src/mnode/src/mgmtTable.c | 2 +- src/mnode/src/mgmtUser.c | 2 +- src/mnode/src/mgmtVgroup.c | 2 +- 10 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index ac7bc31c3d..f444b7b5c8 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -107,7 +107,6 @@ int32_t tsReplications = TSDB_DEFAULT_REPLICA_NUM; int16_t tsAffectedRowsMod = 0; int32_t tsNumOfMPeers = 3; int32_t tsMaxShellConns = 2000; -int32_t tsMaxTables = 100000; char tsDefaultDB[TSDB_DB_NAME_LEN] = {0}; char tsDefaultUser[64] = "root"; diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index aeccd92d9a..b6a37d85a2 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -340,13 +340,14 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_SESSIONS_PER_VNODE (300) #define TSDB_SESSIONS_PER_DNODE (TSDB_SESSIONS_PER_VNODE * TSDB_MAX_VNODES) -#define TSDB_MAX_MNODES 5 -#define TSDB_MAX_DNODES 10 -#define TSDB_MAX_ACCOUNTS 10 -#define TSDB_MAX_USERS 20 -#define TSDB_MAX_DBS 100 -#define TSDB_MAX_VGROUPS 1000 -#define TSDB_MAX_SUPER_TABLES 100 +#define TSDB_DEFAULT_MNODES_HASH_SIZE 5 +#define TSDB_DEFAULT_DNODES_HASH_SIZE 10 +#define TSDB_DEFAULT_ACCOUNTS_HASH_SIZE 10 +#define TSDB_DEFAULT_USERS_HASH_SIZE 20 +#define TSDB_DEFAULT_DBS_HASH_SIZE 100 +#define TSDB_DEFAULT_VGROUPS_HASH_SIZE 100 +#define TSDB_DEFAULT_STABLES_HASH_SIZE 100 +#define TSDB_DEFAULT_CTABLES_HASH_SIZE 10000 #define TSDB_PORT_DNODESHELL 0 #define TSDB_PORT_DNODEDNODE 5 diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c index 06ee09943a..5ea75a1cde 100644 --- a/src/kit/taosdump/taosdump.c +++ b/src/kit/taosdump/taosdump.c @@ -37,6 +37,8 @@ #define COMMAND_SIZE 65536 #define DEFAULT_DUMP_FILE "taosdump.sql" +#define MAX_DBS 100 + int converStringToReadable(char *str, int size, char *buf, int bufsize); int convertNCharToReadable(char *str, int size, char *buf, int bufsize); void taosDumpCharset(FILE *fp); @@ -359,7 +361,7 @@ int main(int argc, char *argv[]) { void taosFreeDbInfos() { if (dbInfos == NULL) return; - for (int i = 0; i < TSDB_MAX_DBS; i++) tfree(dbInfos[i]); + for (int i = 0; i < MAX_DBS; i++) tfree(dbInfos[i]); tfree(dbInfos); } @@ -437,7 +439,7 @@ int taosDumpOut(SDumpArguments *arguments) { return -1; } - dbInfos = (SDbInfo **)calloc(TSDB_MAX_DBS, sizeof(SDbInfo *)); + dbInfos = (SDbInfo **)calloc(MAX_DBS, sizeof(SDbInfo *)); if (dbInfos == NULL) { fprintf(stderr, "failed to allocate memory\n"); goto _exit_failure; diff --git a/src/mnode/src/mgmtAcct.c b/src/mnode/src/mgmtAcct.c index 27beff8944..a35591382c 100644 --- a/src/mnode/src/mgmtAcct.c +++ b/src/mnode/src/mgmtAcct.c @@ -94,7 +94,7 @@ int32_t mgmtInitAccts() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_ACCOUNT, .tableName = "accounts", - .hashSessions = TSDB_MAX_ACCOUNTS, + .hashSessions = TSDB_DEFAULT_ACCOUNTS_HASH_SIZE, .maxRowSize = tsAcctUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_STRING, diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index fbc22e5642..df18fe8786 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -128,7 +128,7 @@ int32_t mgmtInitDbs() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_DB, .tableName = "dbs", - .hashSessions = TSDB_MAX_DBS, + .hashSessions = TSDB_DEFAULT_DBS_HASH_SIZE, .maxRowSize = tsDbUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_STRING, diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index c3ae8b5ab1..1189da92e2 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -130,7 +130,7 @@ int32_t mgmtInitDnodes() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_DNODE, .tableName = "dnodes", - .hashSessions = TSDB_MAX_DNODES, + .hashSessions = TSDB_DEFAULT_DNODES_HASH_SIZE, .maxRowSize = tsDnodeUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_AUTO, diff --git a/src/mnode/src/mgmtMnode.c b/src/mnode/src/mgmtMnode.c index 0bb4895e36..5b2a5c40a8 100644 --- a/src/mnode/src/mgmtMnode.c +++ b/src/mnode/src/mgmtMnode.c @@ -133,7 +133,7 @@ int32_t mgmtInitMnodes() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_MNODE, .tableName = "mnodes", - .hashSessions = TSDB_MAX_MNODES, + .hashSessions = TSDB_DEFAULT_MNODES_HASH_SIZE, .maxRowSize = tsMnodeUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_INT, diff --git a/src/mnode/src/mgmtTable.c b/src/mnode/src/mgmtTable.c index 3dfea2ade8..05cf88f828 100644 --- a/src/mnode/src/mgmtTable.c +++ b/src/mnode/src/mgmtTable.c @@ -507,7 +507,7 @@ static int32_t mgmtInitSuperTables() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_STABLE, .tableName = "stables", - .hashSessions = TSDB_MAX_SUPER_TABLES, + .hashSessions = TSDB_DEFAULT_STABLES_HASH_SIZE, .maxRowSize = sizeof(SSuperTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16) + TSDB_TABLE_ID_LEN, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_VAR_STRING, diff --git a/src/mnode/src/mgmtUser.c b/src/mnode/src/mgmtUser.c index cc22ed2169..62a98c4170 100644 --- a/src/mnode/src/mgmtUser.c +++ b/src/mnode/src/mgmtUser.c @@ -117,7 +117,7 @@ int32_t mgmtInitUsers() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_USER, .tableName = "users", - .hashSessions = TSDB_MAX_USERS, + .hashSessions = TSDB_DEFAULT_USERS_HASH_SIZE, .maxRowSize = tsUserUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_STRING, diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index 168fd9f634..fea8108698 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -200,7 +200,7 @@ int32_t mgmtInitVgroups() { SSdbTableDesc tableDesc = { .tableId = SDB_TABLE_VGROUP, .tableName = "vgroups", - .hashSessions = TSDB_MAX_VGROUPS, + .hashSessions = TSDB_DEFAULT_VGROUPS_HASH_SIZE, .maxRowSize = tsVgUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .keyType = SDB_KEY_AUTO, -- GitLab