commit
89a2451af0
|
@ -16,6 +16,7 @@ SET(TD_GRANT FALSE)
|
||||||
SET(TD_MQTT FALSE)
|
SET(TD_MQTT FALSE)
|
||||||
SET(TD_TSDB_PLUGINS FALSE)
|
SET(TD_TSDB_PLUGINS FALSE)
|
||||||
SET(TD_STORAGE FALSE)
|
SET(TD_STORAGE FALSE)
|
||||||
|
SET(TD_TOPIC FALSE)
|
||||||
|
|
||||||
SET(TD_COVER FALSE)
|
SET(TD_COVER FALSE)
|
||||||
SET(TD_MEM_CHECK FALSE)
|
SET(TD_MEM_CHECK FALSE)
|
||||||
|
|
|
@ -25,6 +25,10 @@ IF (TD_STORAGE)
|
||||||
ADD_DEFINITIONS(-D_STORAGE)
|
ADD_DEFINITIONS(-D_STORAGE)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
IF (TD_TOPIC)
|
||||||
|
ADD_DEFINITIONS(-D_TOPIC)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
IF (TD_GODLL)
|
IF (TD_GODLL)
|
||||||
ADD_DEFINITIONS(-D_TD_GO_DLL_)
|
ADD_DEFINITIONS(-D_TD_GO_DLL_)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
|
@ -9,6 +9,14 @@ ELSEIF (${ACCOUNT} MATCHES "false")
|
||||||
MESSAGE(STATUS "Build without account plugins")
|
MESSAGE(STATUS "Build without account plugins")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
IF (${TOPIC} MATCHES "true")
|
||||||
|
SET(TD_TOPIC TRUE)
|
||||||
|
MESSAGE(STATUS "Build with topic plugins")
|
||||||
|
ELSEIF (${TOPIC} MATCHES "false")
|
||||||
|
SET(TD_TOPIC FALSE)
|
||||||
|
MESSAGE(STATUS "Build without topic plugins")
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
IF (${COVER} MATCHES "true")
|
IF (${COVER} MATCHES "true")
|
||||||
SET(TD_COVER TRUE)
|
SET(TD_COVER TRUE)
|
||||||
MESSAGE(STATUS "Build with test coverage")
|
MESSAGE(STATUS "Build with test coverage")
|
||||||
|
|
|
@ -5614,6 +5614,8 @@ static void setCreateDBOption(SCreateDbMsg* pMsg, SCreateDbInfo* pCreateDb) {
|
||||||
pMsg->ignoreExist = pCreateDb->ignoreExists;
|
pMsg->ignoreExist = pCreateDb->ignoreExists;
|
||||||
pMsg->update = pCreateDb->update;
|
pMsg->update = pCreateDb->update;
|
||||||
pMsg->cacheLastRow = pCreateDb->cachelast;
|
pMsg->cacheLastRow = pCreateDb->cachelast;
|
||||||
|
pMsg->dbType = pCreateDb->dbType;
|
||||||
|
pMsg->partitions = htons(pCreateDb->partitions);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDbInfo* pCreateDbSql) {
|
int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDbInfo* pCreateDbSql) {
|
||||||
|
@ -6244,6 +6246,15 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCreateDbMsg* pCreate) {
|
||||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val = (int16_t)htons(pCreate->partitions);
|
||||||
|
if (val != -1 &&
|
||||||
|
(val < TSDB_MIN_DB_PARTITON_OPTION || val > TSDB_MAX_DB_PARTITON_OPTION)) {
|
||||||
|
snprintf(msg, tListLen(msg), "invalid topic option partition: %d valid range: [%d, %d]", val,
|
||||||
|
TSDB_MIN_DB_PARTITON_OPTION, TSDB_MAX_DB_PARTITON_OPTION);
|
||||||
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1055,7 +1055,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
int32_t tscBuildCreateDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
int32_t tscBuildCreateDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
SSqlCmd *pCmd = &pSql->cmd;
|
SSqlCmd *pCmd = &pSql->cmd;
|
||||||
pCmd->payloadLen = sizeof(SCreateDbMsg);
|
pCmd->payloadLen = sizeof(SCreateDbMsg);
|
||||||
pCmd->msgType = TSDB_MSG_TYPE_CM_CREATE_DB;
|
|
||||||
|
pCmd->msgType = (pInfo->pMiscInfo->dbOpt.dbType == TSDB_DB_TYPE_DEFAULT) ? TSDB_MSG_TYPE_CM_CREATE_DB : TSDB_MSG_TYPE_CM_CREATE_TP;
|
||||||
|
|
||||||
SCreateDbMsg *pCreateDbMsg = (SCreateDbMsg *)pCmd->payload;
|
SCreateDbMsg *pCreateDbMsg = (SCreateDbMsg *)pCmd->payload;
|
||||||
|
|
||||||
|
@ -1187,7 +1188,7 @@ int32_t tscBuildDropDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
|
|
||||||
pDropDbMsg->ignoreNotExists = pInfo->pMiscInfo->existsCheck ? 1 : 0;
|
pDropDbMsg->ignoreNotExists = pInfo->pMiscInfo->existsCheck ? 1 : 0;
|
||||||
|
|
||||||
pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_DB;
|
pCmd->msgType = (pInfo->pMiscInfo->dbType == TSDB_DB_TYPE_DEFAULT) ? TSDB_MSG_TYPE_CM_DROP_DB : TSDB_MSG_TYPE_CM_DROP_TP;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1514,9 +1515,11 @@ int tscBuildUpdateTagMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
|
||||||
int tscAlterDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
int tscAlterDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
|
||||||
SSqlCmd *pCmd = &pSql->cmd;
|
SSqlCmd *pCmd = &pSql->cmd;
|
||||||
pCmd->payloadLen = sizeof(SAlterDbMsg);
|
pCmd->payloadLen = sizeof(SAlterDbMsg);
|
||||||
pCmd->msgType = TSDB_MSG_TYPE_CM_ALTER_DB;
|
pCmd->msgType = (pInfo->pMiscInfo->dbOpt.dbType == TSDB_DB_TYPE_DEFAULT) ? TSDB_MSG_TYPE_CM_ALTER_DB : TSDB_MSG_TYPE_CM_ALTER_TP;
|
||||||
|
|
||||||
SAlterDbMsg *pAlterDbMsg = (SAlterDbMsg* )pCmd->payload;
|
SAlterDbMsg *pAlterDbMsg = (SAlterDbMsg* )pCmd->payload;
|
||||||
|
pAlterDbMsg->dbType = -1;
|
||||||
|
|
||||||
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
|
||||||
tNameExtractFullName(&pTableMetaInfo->name, pAlterDbMsg->db);
|
tNameExtractFullName(&pTableMetaInfo->name, pAlterDbMsg->db);
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ extern int8_t tsCompression;
|
||||||
extern int8_t tsWAL;
|
extern int8_t tsWAL;
|
||||||
extern int32_t tsFsyncPeriod;
|
extern int32_t tsFsyncPeriod;
|
||||||
extern int32_t tsReplications;
|
extern int32_t tsReplications;
|
||||||
|
extern int16_t tsPartitons;
|
||||||
extern int32_t tsQuorum;
|
extern int32_t tsQuorum;
|
||||||
extern int8_t tsUpdate;
|
extern int8_t tsUpdate;
|
||||||
extern int8_t tsCacheLastRow;
|
extern int8_t tsCacheLastRow;
|
||||||
|
|
|
@ -126,8 +126,9 @@ int8_t tsWAL = TSDB_DEFAULT_WAL_LEVEL;
|
||||||
int32_t tsFsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD;
|
int32_t tsFsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD;
|
||||||
int32_t tsReplications = TSDB_DEFAULT_DB_REPLICA_OPTION;
|
int32_t tsReplications = TSDB_DEFAULT_DB_REPLICA_OPTION;
|
||||||
int32_t tsQuorum = TSDB_DEFAULT_DB_QUORUM_OPTION;
|
int32_t tsQuorum = TSDB_DEFAULT_DB_QUORUM_OPTION;
|
||||||
|
int16_t tsPartitons = TSDB_DEFAULT_DB_PARTITON_OPTION;
|
||||||
int8_t tsUpdate = TSDB_DEFAULT_DB_UPDATE_OPTION;
|
int8_t tsUpdate = TSDB_DEFAULT_DB_UPDATE_OPTION;
|
||||||
int8_t tsCacheLastRow = TSDB_DEFAULT_CACHE_BLOCK_SIZE;
|
int8_t tsCacheLastRow = TSDB_DEFAULT_CACHE_LAST_ROW;
|
||||||
int32_t tsMaxVgroupsPerDb = 0;
|
int32_t tsMaxVgroupsPerDb = 0;
|
||||||
int32_t tsMinTablePerVnode = TSDB_TABLES_STEP;
|
int32_t tsMinTablePerVnode = TSDB_TABLES_STEP;
|
||||||
int32_t tsMaxTablePerVnode = TSDB_DEFAULT_TABLES;
|
int32_t tsMaxTablePerVnode = TSDB_DEFAULT_TABLES;
|
||||||
|
@ -853,6 +854,16 @@ static void doInitGlobalConfig(void) {
|
||||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||||
taosInitConfigOption(cfg);
|
taosInitConfigOption(cfg);
|
||||||
|
|
||||||
|
cfg.option = "partitions";
|
||||||
|
cfg.ptr = &tsPartitons;
|
||||||
|
cfg.valType = TAOS_CFG_VTYPE_INT16;
|
||||||
|
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
|
||||||
|
cfg.minValue = TSDB_MIN_DB_PARTITON_OPTION;
|
||||||
|
cfg.maxValue = TSDB_MAX_DB_PARTITON_OPTION;
|
||||||
|
cfg.ptrLength = 0;
|
||||||
|
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||||
|
taosInitConfigOption(cfg);
|
||||||
|
|
||||||
cfg.option = "quorum";
|
cfg.option = "quorum";
|
||||||
cfg.ptr = &tsQuorum;
|
cfg.ptr = &tsQuorum;
|
||||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||||
|
|
|
@ -31,6 +31,10 @@ IF (TD_MQTT)
|
||||||
TARGET_LINK_LIBRARIES(taosd mqtt)
|
TARGET_LINK_LIBRARIES(taosd mqtt)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
IF (TD_TOPIC)
|
||||||
|
TARGET_LINK_LIBRARIES(taosd topic)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
SET(PREPARE_ENV_CMD "prepare_env_cmd")
|
SET(PREPARE_ENV_CMD "prepare_env_cmd")
|
||||||
SET(PREPARE_ENV_TARGET "prepare_env_target")
|
SET(PREPARE_ENV_TARGET "prepare_env_target")
|
||||||
ADD_CUSTOM_COMMAND(OUTPUT ${PREPARE_ENV_CMD}
|
ADD_CUSTOM_COMMAND(OUTPUT ${PREPARE_ENV_CMD}
|
||||||
|
|
|
@ -146,10 +146,10 @@ void dnodeSendRpcMWriteRsp(void *pMsg, int32_t code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dTrace("msg:%p, app:%p type:%s master:%p will be responsed", pWrite, pWrite->rpcMsg.ahandle,
|
dTrace("msg:%p, app:%p type:%s master:%p will be responsed", pWrite, pWrite->rpcMsg.ahandle,
|
||||||
taosMsg[pWrite->rpcMsg.msgType], pWrite->pBatchMasterMsg);
|
taosMsg[pWrite->rpcMsg.msgType], pWrite->pBatchMasterMsg);
|
||||||
if (pWrite->pBatchMasterMsg && pWrite != pWrite->pBatchMasterMsg) {
|
if (pWrite->pBatchMasterMsg && pWrite != pWrite->pBatchMasterMsg) {
|
||||||
dError("msg:%p, app:%p type:%s master:%p sub message should not response!", pWrite, pWrite->rpcMsg.ahandle,
|
dError("msg:%p, app:%p type:%s master:%p sub message should not response!", pWrite, pWrite->rpcMsg.ahandle,
|
||||||
taosMsg[pWrite->rpcMsg.msgType], pWrite->pBatchMasterMsg);
|
taosMsg[pWrite->rpcMsg.msgType], pWrite->pBatchMasterMsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,11 @@ int32_t dnodeInitShell() {
|
||||||
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_DNODE]= dnodeDispatchToMWriteQueue;
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_DNODE]= dnodeDispatchToMWriteQueue;
|
||||||
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_DNODE] = dnodeDispatchToMWriteQueue;
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_DNODE] = dnodeDispatchToMWriteQueue;
|
||||||
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_DB] = dnodeDispatchToMWriteQueue;
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_DB] = dnodeDispatchToMWriteQueue;
|
||||||
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_TP] = dnodeDispatchToMWriteQueue;
|
||||||
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_DB] = dnodeDispatchToMWriteQueue;
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_DB] = dnodeDispatchToMWriteQueue;
|
||||||
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_TP] = dnodeDispatchToMWriteQueue;
|
||||||
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_DB] = dnodeDispatchToMWriteQueue;
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_DB] = dnodeDispatchToMWriteQueue;
|
||||||
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_TP] = dnodeDispatchToMWriteQueue;
|
||||||
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_TABLE]= dnodeDispatchToMWriteQueue;
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_CREATE_TABLE]= dnodeDispatchToMWriteQueue;
|
||||||
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_TABLE] = dnodeDispatchToMWriteQueue;
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_DROP_TABLE] = dnodeDispatchToMWriteQueue;
|
||||||
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_TABLE] = dnodeDispatchToMWriteQueue;
|
dnodeProcessShellMsgFp[TSDB_MSG_TYPE_CM_ALTER_TABLE] = dnodeDispatchToMWriteQueue;
|
||||||
|
|
|
@ -222,6 +222,9 @@ do { \
|
||||||
#define TSDB_MQTT_TOPIC_LEN 64
|
#define TSDB_MQTT_TOPIC_LEN 64
|
||||||
#define TSDB_MQTT_CLIENT_ID_LEN 32
|
#define TSDB_MQTT_CLIENT_ID_LEN 32
|
||||||
|
|
||||||
|
#define TSDB_DB_TYPE_DEFAULT 0
|
||||||
|
#define TSDB_DB_TYPE_TOPIC 1
|
||||||
|
|
||||||
#define TSDB_DEFAULT_PKT_SIZE 65480 //same as RPC_MAX_UDP_SIZE
|
#define TSDB_DEFAULT_PKT_SIZE 65480 //same as RPC_MAX_UDP_SIZE
|
||||||
|
|
||||||
#define TSDB_PAYLOAD_SIZE TSDB_DEFAULT_PKT_SIZE
|
#define TSDB_PAYLOAD_SIZE TSDB_DEFAULT_PKT_SIZE
|
||||||
|
@ -306,6 +309,10 @@ do { \
|
||||||
#define TSDB_MAX_DB_REPLICA_OPTION 3
|
#define TSDB_MAX_DB_REPLICA_OPTION 3
|
||||||
#define TSDB_DEFAULT_DB_REPLICA_OPTION 1
|
#define TSDB_DEFAULT_DB_REPLICA_OPTION 1
|
||||||
|
|
||||||
|
#define TSDB_MIN_DB_PARTITON_OPTION 0
|
||||||
|
#define TSDB_MAX_DB_PARTITON_OPTION 1000
|
||||||
|
#define TSDB_DEFAULT_DB_PARTITON_OPTION 4
|
||||||
|
|
||||||
#define TSDB_MIN_DB_QUORUM_OPTION 1
|
#define TSDB_MIN_DB_QUORUM_OPTION 1
|
||||||
#define TSDB_MAX_DB_QUORUM_OPTION 2
|
#define TSDB_MAX_DB_QUORUM_OPTION 2
|
||||||
#define TSDB_DEFAULT_DB_QUORUM_OPTION 1
|
#define TSDB_DEFAULT_DB_QUORUM_OPTION 1
|
||||||
|
|
|
@ -185,6 +185,9 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_MND_INVALID_DB_OPTION_DAYS TAOS_DEF_ERROR_CODE(0, 0x0390) //"Invalid database option: days out of range")
|
#define TSDB_CODE_MND_INVALID_DB_OPTION_DAYS TAOS_DEF_ERROR_CODE(0, 0x0390) //"Invalid database option: days out of range")
|
||||||
#define TSDB_CODE_MND_INVALID_DB_OPTION_KEEP TAOS_DEF_ERROR_CODE(0, 0x0391) //"Invalid database option: keep >= keep1 >= keep0 >= days")
|
#define TSDB_CODE_MND_INVALID_DB_OPTION_KEEP TAOS_DEF_ERROR_CODE(0, 0x0391) //"Invalid database option: keep >= keep1 >= keep0 >= days")
|
||||||
|
|
||||||
|
#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)
|
||||||
|
|
||||||
// dnode
|
// dnode
|
||||||
#define TSDB_CODE_DND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0400) //"Message not processed")
|
#define TSDB_CODE_DND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0400) //"Message not processed")
|
||||||
#define TSDB_CODE_DND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0401) //"Dnode out of memory")
|
#define TSDB_CODE_DND_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0401) //"Dnode out of memory")
|
||||||
|
|
|
@ -107,6 +107,12 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY13, "dummy13" )
|
||||||
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY14, "dummy14" )
|
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY14, "dummy14" )
|
||||||
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_NETWORK_TEST, "nettest" )
|
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_NETWORK_TEST, "nettest" )
|
||||||
|
|
||||||
|
// message for topic
|
||||||
|
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_CREATE_TP, "create-tp" )
|
||||||
|
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_DROP_TP, "drop-tp" )
|
||||||
|
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_USE_TP, "use-tp" )
|
||||||
|
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_CM_ALTER_TP, "alter-tp" )
|
||||||
|
|
||||||
#ifndef TAOS_MESSAGE_C
|
#ifndef TAOS_MESSAGE_C
|
||||||
TSDB_MSG_TYPE_MAX // 105
|
TSDB_MSG_TYPE_MAX // 105
|
||||||
#endif
|
#endif
|
||||||
|
@ -141,6 +147,7 @@ enum _mgmt_table {
|
||||||
TSDB_MGMT_TABLE_VNODES,
|
TSDB_MGMT_TABLE_VNODES,
|
||||||
TSDB_MGMT_TABLE_STREAMTABLES,
|
TSDB_MGMT_TABLE_STREAMTABLES,
|
||||||
TSDB_MGMT_TABLE_CLUSTER,
|
TSDB_MGMT_TABLE_CLUSTER,
|
||||||
|
TSDB_MGMT_TABLE_TP,
|
||||||
TSDB_MGMT_TABLE_MAX,
|
TSDB_MGMT_TABLE_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -555,7 +562,9 @@ typedef struct {
|
||||||
int8_t ignoreExist;
|
int8_t ignoreExist;
|
||||||
int8_t update;
|
int8_t update;
|
||||||
int8_t cacheLastRow;
|
int8_t cacheLastRow;
|
||||||
int8_t reserve[8];
|
int8_t dbType;
|
||||||
|
int16_t partitions;
|
||||||
|
int8_t reserve[5];
|
||||||
} SCreateDbMsg, SAlterDbMsg;
|
} SCreateDbMsg, SAlterDbMsg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -674,7 +683,8 @@ typedef struct {
|
||||||
int8_t cacheLastRow;
|
int8_t cacheLastRow;
|
||||||
int32_t vgCfgVersion;
|
int32_t vgCfgVersion;
|
||||||
int8_t dbReplica;
|
int8_t dbReplica;
|
||||||
int8_t reserved[9];
|
int8_t dbType;
|
||||||
|
int8_t reserved[8];
|
||||||
} SVnodeCfg;
|
} SVnodeCfg;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TDENGINE_TP
|
||||||
|
#define TDENGINE_TP
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int32_t tpInit();
|
||||||
|
void tpCleanUp();
|
||||||
|
void tpUpdateTs(int32_t *seq, void *pMsg);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -62,170 +62,176 @@
|
||||||
#define TK_BITNOT 43
|
#define TK_BITNOT 43
|
||||||
#define TK_SHOW 44
|
#define TK_SHOW 44
|
||||||
#define TK_DATABASES 45
|
#define TK_DATABASES 45
|
||||||
#define TK_MNODES 46
|
#define TK_TOPICS 46
|
||||||
#define TK_DNODES 47
|
#define TK_MNODES 47
|
||||||
#define TK_ACCOUNTS 48
|
#define TK_DNODES 48
|
||||||
#define TK_USERS 49
|
#define TK_ACCOUNTS 49
|
||||||
#define TK_MODULES 50
|
#define TK_USERS 50
|
||||||
#define TK_QUERIES 51
|
#define TK_MODULES 51
|
||||||
#define TK_CONNECTIONS 52
|
#define TK_QUERIES 52
|
||||||
#define TK_STREAMS 53
|
#define TK_CONNECTIONS 53
|
||||||
#define TK_VARIABLES 54
|
#define TK_STREAMS 54
|
||||||
#define TK_SCORES 55
|
#define TK_VARIABLES 55
|
||||||
#define TK_GRANTS 56
|
#define TK_SCORES 56
|
||||||
#define TK_VNODES 57
|
#define TK_GRANTS 57
|
||||||
#define TK_IPTOKEN 58
|
#define TK_VNODES 58
|
||||||
#define TK_DOT 59
|
#define TK_IPTOKEN 59
|
||||||
#define TK_CREATE 60
|
#define TK_DOT 60
|
||||||
#define TK_TABLE 61
|
#define TK_CREATE 61
|
||||||
#define TK_DATABASE 62
|
#define TK_TABLE 62
|
||||||
#define TK_TABLES 63
|
#define TK_DATABASE 63
|
||||||
#define TK_STABLES 64
|
#define TK_TABLES 64
|
||||||
#define TK_VGROUPS 65
|
#define TK_STABLES 65
|
||||||
#define TK_DROP 66
|
#define TK_VGROUPS 66
|
||||||
#define TK_STABLE 67
|
#define TK_DROP 67
|
||||||
#define TK_DNODE 68
|
#define TK_STABLE 68
|
||||||
#define TK_USER 69
|
#define TK_TOPIC 69
|
||||||
#define TK_ACCOUNT 70
|
#define TK_DNODE 70
|
||||||
#define TK_USE 71
|
#define TK_USER 71
|
||||||
#define TK_DESCRIBE 72
|
#define TK_ACCOUNT 72
|
||||||
#define TK_ALTER 73
|
#define TK_USE 73
|
||||||
#define TK_PASS 74
|
#define TK_DESCRIBE 74
|
||||||
#define TK_PRIVILEGE 75
|
#define TK_ALTER 75
|
||||||
#define TK_LOCAL 76
|
#define TK_PASS 76
|
||||||
#define TK_IF 77
|
#define TK_PRIVILEGE 77
|
||||||
#define TK_EXISTS 78
|
#define TK_LOCAL 78
|
||||||
#define TK_PPS 79
|
#define TK_IF 79
|
||||||
#define TK_TSERIES 80
|
#define TK_EXISTS 80
|
||||||
#define TK_DBS 81
|
#define TK_PPS 81
|
||||||
#define TK_STORAGE 82
|
#define TK_TSERIES 82
|
||||||
#define TK_QTIME 83
|
#define TK_DBS 83
|
||||||
#define TK_CONNS 84
|
#define TK_STORAGE 84
|
||||||
#define TK_STATE 85
|
#define TK_QTIME 85
|
||||||
#define TK_KEEP 86
|
#define TK_CONNS 86
|
||||||
#define TK_CACHE 87
|
#define TK_STATE 87
|
||||||
#define TK_REPLICA 88
|
#define TK_KEEP 88
|
||||||
#define TK_QUORUM 89
|
#define TK_CACHE 89
|
||||||
#define TK_DAYS 90
|
#define TK_REPLICA 90
|
||||||
#define TK_MINROWS 91
|
#define TK_QUORUM 91
|
||||||
#define TK_MAXROWS 92
|
#define TK_DAYS 92
|
||||||
#define TK_BLOCKS 93
|
#define TK_MINROWS 93
|
||||||
#define TK_CTIME 94
|
#define TK_MAXROWS 94
|
||||||
#define TK_WAL 95
|
#define TK_BLOCKS 95
|
||||||
#define TK_FSYNC 96
|
#define TK_CTIME 96
|
||||||
#define TK_COMP 97
|
#define TK_WAL 97
|
||||||
#define TK_PRECISION 98
|
#define TK_FSYNC 98
|
||||||
#define TK_UPDATE 99
|
#define TK_COMP 99
|
||||||
#define TK_CACHELAST 100
|
#define TK_PRECISION 100
|
||||||
#define TK_LP 101
|
#define TK_UPDATE 101
|
||||||
#define TK_RP 102
|
#define TK_CACHELAST 102
|
||||||
#define TK_UNSIGNED 103
|
#define TK_PARTITIONS 103
|
||||||
#define TK_TAGS 104
|
#define TK_LP 104
|
||||||
#define TK_USING 105
|
#define TK_RP 105
|
||||||
#define TK_COMMA 106
|
#define TK_UNSIGNED 106
|
||||||
#define TK_AS 107
|
#define TK_TAGS 107
|
||||||
#define TK_NULL 108
|
#define TK_USING 108
|
||||||
#define TK_SELECT 109
|
#define TK_COMMA 109
|
||||||
#define TK_UNION 110
|
#define TK_AS 110
|
||||||
#define TK_ALL 111
|
#define TK_NULL 111
|
||||||
#define TK_DISTINCT 112
|
#define TK_SELECT 112
|
||||||
#define TK_FROM 113
|
#define TK_UNION 113
|
||||||
#define TK_VARIABLE 114
|
#define TK_ALL 114
|
||||||
#define TK_INTERVAL 115
|
#define TK_DISTINCT 115
|
||||||
#define TK_FILL 116
|
#define TK_FROM 116
|
||||||
#define TK_SLIDING 117
|
#define TK_VARIABLE 117
|
||||||
#define TK_ORDER 118
|
#define TK_INTERVAL 118
|
||||||
#define TK_BY 119
|
#define TK_FILL 119
|
||||||
#define TK_ASC 120
|
#define TK_SLIDING 120
|
||||||
#define TK_DESC 121
|
#define TK_ORDER 121
|
||||||
#define TK_GROUP 122
|
#define TK_BY 122
|
||||||
#define TK_HAVING 123
|
#define TK_ASC 123
|
||||||
#define TK_LIMIT 124
|
#define TK_DESC 124
|
||||||
#define TK_OFFSET 125
|
#define TK_GROUP 125
|
||||||
#define TK_SLIMIT 126
|
#define TK_HAVING 126
|
||||||
#define TK_SOFFSET 127
|
#define TK_LIMIT 127
|
||||||
#define TK_WHERE 128
|
#define TK_OFFSET 128
|
||||||
#define TK_NOW 129
|
#define TK_SLIMIT 129
|
||||||
#define TK_RESET 130
|
#define TK_SOFFSET 130
|
||||||
#define TK_QUERY 131
|
#define TK_WHERE 131
|
||||||
#define TK_ADD 132
|
#define TK_NOW 132
|
||||||
#define TK_COLUMN 133
|
#define TK_RESET 133
|
||||||
#define TK_TAG 134
|
#define TK_QUERY 134
|
||||||
#define TK_CHANGE 135
|
#define TK_ADD 135
|
||||||
#define TK_SET 136
|
#define TK_COLUMN 136
|
||||||
#define TK_KILL 137
|
#define TK_TAG 137
|
||||||
#define TK_CONNECTION 138
|
#define TK_CHANGE 138
|
||||||
#define TK_STREAM 139
|
#define TK_SET 139
|
||||||
#define TK_COLON 140
|
#define TK_KILL 140
|
||||||
#define TK_ABORT 141
|
#define TK_CONNECTION 141
|
||||||
#define TK_AFTER 142
|
#define TK_STREAM 142
|
||||||
#define TK_ATTACH 143
|
#define TK_COLON 143
|
||||||
#define TK_BEFORE 144
|
#define TK_ABORT 144
|
||||||
#define TK_BEGIN 145
|
#define TK_AFTER 145
|
||||||
#define TK_CASCADE 146
|
#define TK_ATTACH 146
|
||||||
#define TK_CLUSTER 147
|
#define TK_BEFORE 147
|
||||||
#define TK_CONFLICT 148
|
#define TK_BEGIN 148
|
||||||
#define TK_COPY 149
|
#define TK_CASCADE 149
|
||||||
#define TK_DEFERRED 150
|
#define TK_CLUSTER 150
|
||||||
#define TK_DELIMITERS 151
|
#define TK_CONFLICT 151
|
||||||
#define TK_DETACH 152
|
#define TK_COPY 152
|
||||||
#define TK_EACH 153
|
#define TK_DEFERRED 153
|
||||||
#define TK_END 154
|
#define TK_DELIMITERS 154
|
||||||
#define TK_EXPLAIN 155
|
#define TK_DETACH 155
|
||||||
#define TK_FAIL 156
|
#define TK_EACH 156
|
||||||
#define TK_FOR 157
|
#define TK_END 157
|
||||||
#define TK_IGNORE 158
|
#define TK_EXPLAIN 158
|
||||||
#define TK_IMMEDIATE 159
|
#define TK_FAIL 159
|
||||||
#define TK_INITIALLY 160
|
#define TK_FOR 160
|
||||||
#define TK_INSTEAD 161
|
#define TK_IGNORE 161
|
||||||
#define TK_MATCH 162
|
#define TK_IMMEDIATE 162
|
||||||
#define TK_KEY 163
|
#define TK_INITIALLY 163
|
||||||
#define TK_OF 164
|
#define TK_INSTEAD 164
|
||||||
#define TK_RAISE 165
|
#define TK_MATCH 165
|
||||||
#define TK_REPLACE 166
|
#define TK_KEY 166
|
||||||
#define TK_RESTRICT 167
|
#define TK_OF 167
|
||||||
#define TK_ROW 168
|
#define TK_RAISE 168
|
||||||
#define TK_STATEMENT 169
|
#define TK_REPLACE 169
|
||||||
#define TK_TRIGGER 170
|
#define TK_RESTRICT 170
|
||||||
#define TK_VIEW 171
|
#define TK_ROW 171
|
||||||
#define TK_COUNT 172
|
#define TK_STATEMENT 172
|
||||||
#define TK_SUM 173
|
#define TK_TRIGGER 173
|
||||||
#define TK_AVG 174
|
#define TK_VIEW 174
|
||||||
#define TK_MIN 175
|
#define TK_COUNT 175
|
||||||
#define TK_MAX 176
|
#define TK_SUM 176
|
||||||
#define TK_FIRST 177
|
#define TK_AVG 177
|
||||||
#define TK_LAST 178
|
#define TK_MIN 178
|
||||||
#define TK_TOP 179
|
#define TK_MAX 179
|
||||||
#define TK_BOTTOM 180
|
#define TK_FIRST 180
|
||||||
#define TK_STDDEV 181
|
#define TK_LAST 181
|
||||||
#define TK_PERCENTILE 182
|
#define TK_TOP 182
|
||||||
#define TK_APERCENTILE 183
|
#define TK_BOTTOM 183
|
||||||
#define TK_LEASTSQUARES 184
|
#define TK_STDDEV 184
|
||||||
#define TK_HISTOGRAM 185
|
#define TK_PERCENTILE 185
|
||||||
#define TK_DIFF 186
|
#define TK_APERCENTILE 186
|
||||||
#define TK_SPREAD 187
|
#define TK_LEASTSQUARES 187
|
||||||
#define TK_TWA 188
|
#define TK_HISTOGRAM 188
|
||||||
#define TK_INTERP 189
|
#define TK_DIFF 189
|
||||||
#define TK_LAST_ROW 190
|
#define TK_SPREAD 190
|
||||||
#define TK_RATE 191
|
#define TK_TWA 191
|
||||||
#define TK_IRATE 192
|
#define TK_INTERP 192
|
||||||
#define TK_SUM_RATE 193
|
#define TK_LAST_ROW 193
|
||||||
#define TK_SUM_IRATE 194
|
#define TK_RATE 194
|
||||||
#define TK_AVG_RATE 195
|
#define TK_IRATE 195
|
||||||
#define TK_AVG_IRATE 196
|
#define TK_SUM_RATE 196
|
||||||
#define TK_TBID 197
|
#define TK_SUM_IRATE 197
|
||||||
#define TK_SEMI 198
|
#define TK_AVG_RATE 198
|
||||||
#define TK_NONE 199
|
#define TK_AVG_IRATE 199
|
||||||
#define TK_PREV 200
|
#define TK_TBID 200
|
||||||
#define TK_LINEAR 201
|
#define TK_SEMI 201
|
||||||
#define TK_IMPORT 202
|
#define TK_NONE 202
|
||||||
#define TK_METRIC 203
|
#define TK_PREV 203
|
||||||
#define TK_TBNAME 204
|
#define TK_LINEAR 204
|
||||||
#define TK_JOIN 205
|
#define TK_IMPORT 205
|
||||||
#define TK_METRICS 206
|
#define TK_METRIC 206
|
||||||
#define TK_INSERT 207
|
#define TK_TBNAME 207
|
||||||
#define TK_INTO 208
|
#define TK_JOIN 208
|
||||||
#define TK_VALUES 209
|
#define TK_METRICS 209
|
||||||
|
#define TK_INSERT 210
|
||||||
|
#define TK_INTO 211
|
||||||
|
#define TK_VALUES 212
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,9 @@ typedef struct {
|
||||||
int8_t quorum;
|
int8_t quorum;
|
||||||
int8_t update;
|
int8_t update;
|
||||||
int8_t cacheLastRow;
|
int8_t cacheLastRow;
|
||||||
int8_t reserved[10];
|
int8_t dbType;
|
||||||
|
int16_t partitions;
|
||||||
|
int8_t reserved[7];
|
||||||
} SDbCfg;
|
} SDbCfg;
|
||||||
|
|
||||||
typedef struct SDbObj {
|
typedef struct SDbObj {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "tname.h"
|
#include "tname.h"
|
||||||
#include "tbn.h"
|
#include "tbn.h"
|
||||||
#include "tdataformat.h"
|
#include "tdataformat.h"
|
||||||
|
#include "tp.h"
|
||||||
#include "mnode.h"
|
#include "mnode.h"
|
||||||
#include "mnodeDef.h"
|
#include "mnodeDef.h"
|
||||||
#include "mnodeInt.h"
|
#include "mnodeInt.h"
|
||||||
|
@ -38,8 +39,8 @@
|
||||||
#include "mnodeVgroup.h"
|
#include "mnodeVgroup.h"
|
||||||
|
|
||||||
#define VG_LIST_SIZE 8
|
#define VG_LIST_SIZE 8
|
||||||
int64_t tsDbRid = -1;
|
int64_t tsDbRid = -1;
|
||||||
static void * tsDbSdb = NULL;
|
void * tsDbSdb = NULL;
|
||||||
static int32_t tsDbUpdateSize;
|
static int32_t tsDbUpdateSize;
|
||||||
|
|
||||||
static int32_t mnodeCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate, SMnodeMsg *pMsg);
|
static int32_t mnodeCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate, SMnodeMsg *pMsg);
|
||||||
|
@ -48,8 +49,14 @@ static int32_t mnodeSetDbDropping(SDbObj *pDb);
|
||||||
static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
|
static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
|
||||||
static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void *pConn);
|
static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void *pConn);
|
||||||
static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg);
|
static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg);
|
||||||
static int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg);
|
|
||||||
static int32_t mnodeProcessDropDbMsg(SMnodeMsg *pMsg);
|
static int32_t mnodeProcessDropDbMsg(SMnodeMsg *pMsg);
|
||||||
|
int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg);
|
||||||
|
|
||||||
|
#ifndef _TOPIC
|
||||||
|
int32_t tpInit() { return 0; }
|
||||||
|
void tpCleanUp() {}
|
||||||
|
void tpUpdateTs(int32_t *seq, void *pMsg) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void mnodeDestroyDb(SDbObj *pDb) {
|
static void mnodeDestroyDb(SDbObj *pDb) {
|
||||||
pthread_mutex_destroy(&pDb->mutex);
|
pthread_mutex_destroy(&pDb->mutex);
|
||||||
|
@ -176,7 +183,7 @@ int32_t mnodeInitDbs() {
|
||||||
mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_DB, mnodeCancelGetNextDb);
|
mnodeAddShowFreeIterHandle(TSDB_MGMT_TABLE_DB, mnodeCancelGetNextDb);
|
||||||
|
|
||||||
mDebug("table:dbs table is created");
|
mDebug("table:dbs table is created");
|
||||||
return 0;
|
return tpInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void *mnodeGetNextDb(void *pIter, SDbObj **pDb) {
|
void *mnodeGetNextDb(void *pIter, SDbObj **pDb) {
|
||||||
|
@ -332,6 +339,17 @@ static int32_t mnodeCheckDbCfg(SDbCfg *pCfg) {
|
||||||
return TSDB_CODE_MND_INVALID_DB_OPTION;
|
return TSDB_CODE_MND_INVALID_DB_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pCfg->dbType < 0 || pCfg->dbType > 1) {
|
||||||
|
mError("invalid db option dbType:%d valid range: [%d, %d]", pCfg->dbType, 0, 1);
|
||||||
|
return TSDB_CODE_MND_INVALID_DB_OPTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCfg->partitions < TSDB_MIN_DB_PARTITON_OPTION || pCfg->partitions > TSDB_MAX_DB_PARTITON_OPTION) {
|
||||||
|
mError("invalid db option partitions:%d valid range: [%d, %d]", pCfg->partitions, TSDB_MIN_DB_PARTITON_OPTION,
|
||||||
|
TSDB_MAX_DB_PARTITON_OPTION);
|
||||||
|
return TSDB_CODE_MND_INVALID_DB_OPTION;
|
||||||
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,6 +372,8 @@ static void mnodeSetDefaultDbCfg(SDbCfg *pCfg) {
|
||||||
if (pCfg->quorum < 0) pCfg->quorum = tsQuorum;
|
if (pCfg->quorum < 0) pCfg->quorum = tsQuorum;
|
||||||
if (pCfg->update < 0) pCfg->update = tsUpdate;
|
if (pCfg->update < 0) pCfg->update = tsUpdate;
|
||||||
if (pCfg->cacheLastRow < 0) pCfg->cacheLastRow = tsCacheLastRow;
|
if (pCfg->cacheLastRow < 0) pCfg->cacheLastRow = tsCacheLastRow;
|
||||||
|
if (pCfg->dbType < 0) pCfg->dbType = 0;
|
||||||
|
if (pCfg->partitions < 0) pCfg->partitions = tsPartitons;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mnodeCreateDbCb(SMnodeMsg *pMsg, int32_t code) {
|
static int32_t mnodeCreateDbCb(SMnodeMsg *pMsg, int32_t code) {
|
||||||
|
@ -408,7 +428,9 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate, SMnodeMsg *
|
||||||
.replications = pCreate->replications,
|
.replications = pCreate->replications,
|
||||||
.quorum = pCreate->quorum,
|
.quorum = pCreate->quorum,
|
||||||
.update = pCreate->update,
|
.update = pCreate->update,
|
||||||
.cacheLastRow = pCreate->cacheLastRow
|
.cacheLastRow = pCreate->cacheLastRow,
|
||||||
|
.dbType = pCreate->dbType,
|
||||||
|
.partitions = pCreate->partitions
|
||||||
};
|
};
|
||||||
|
|
||||||
mnodeSetDefaultDbCfg(&pDb->cfg);
|
mnodeSetDefaultDbCfg(&pDb->cfg);
|
||||||
|
@ -501,6 +523,7 @@ void mnodeRemoveVgroupFromDb(SVgObj *pVgroup) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mnodeCleanupDbs() {
|
void mnodeCleanupDbs() {
|
||||||
|
tpCleanUp();
|
||||||
sdbCloseTable(tsDbRid);
|
sdbCloseTable(tsDbRid);
|
||||||
tsDbSdb = NULL;
|
tsDbSdb = NULL;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +683,7 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *mnodeGetDbStr(char *src) {
|
char *mnodeGetDbStr(char *src) {
|
||||||
char *pos = strstr(src, TS_PATH_DELIMITER);
|
char *pos = strstr(src, TS_PATH_DELIMITER);
|
||||||
if (pos != NULL) ++pos;
|
if (pos != NULL) ++pos;
|
||||||
|
|
||||||
|
@ -852,6 +875,7 @@ static int32_t mnodeProcessCreateDbMsg(SMnodeMsg *pMsg) {
|
||||||
pCreate->daysToKeep2 = htonl(pCreate->daysToKeep2);
|
pCreate->daysToKeep2 = htonl(pCreate->daysToKeep2);
|
||||||
pCreate->commitTime = htonl(pCreate->commitTime);
|
pCreate->commitTime = htonl(pCreate->commitTime);
|
||||||
pCreate->fsyncPeriod = htonl(pCreate->fsyncPeriod);
|
pCreate->fsyncPeriod = htonl(pCreate->fsyncPeriod);
|
||||||
|
pCreate->partitions = htons(pCreate->partitions);
|
||||||
pCreate->minRowsPerFileBlock = htonl(pCreate->minRowsPerFileBlock);
|
pCreate->minRowsPerFileBlock = htonl(pCreate->minRowsPerFileBlock);
|
||||||
pCreate->maxRowsPerFileBlock = htonl(pCreate->maxRowsPerFileBlock);
|
pCreate->maxRowsPerFileBlock = htonl(pCreate->maxRowsPerFileBlock);
|
||||||
|
|
||||||
|
@ -887,6 +911,8 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
|
||||||
int8_t precision = pAlter->precision;
|
int8_t precision = pAlter->precision;
|
||||||
int8_t update = pAlter->update;
|
int8_t update = pAlter->update;
|
||||||
int8_t cacheLastRow = pAlter->cacheLastRow;
|
int8_t cacheLastRow = pAlter->cacheLastRow;
|
||||||
|
int8_t dbType = pAlter->dbType;
|
||||||
|
int16_t partitions = htons(pAlter->partitions);
|
||||||
|
|
||||||
terrno = TSDB_CODE_SUCCESS;
|
terrno = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
@ -1004,6 +1030,16 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
|
||||||
newCfg.cacheLastRow = cacheLastRow;
|
newCfg.cacheLastRow = cacheLastRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dbType >= 0 && dbType != pDb->cfg.dbType) {
|
||||||
|
mDebug("db:%s, dbType:%d change to %d", pDb->name, pDb->cfg.dbType, dbType);
|
||||||
|
newCfg.dbType = dbType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (partitions >= 0 && partitions != pDb->cfg.partitions) {
|
||||||
|
mDebug("db:%s, partitions:%d change to %d", pDb->name, pDb->cfg.partitions, partitions);
|
||||||
|
newCfg.partitions = partitions;
|
||||||
|
}
|
||||||
|
|
||||||
return newCfg;
|
return newCfg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1031,6 +1067,8 @@ static int32_t mnodeAlterDbCb(SMnodeMsg *pMsg, int32_t code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
|
static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
|
||||||
|
mDebug("db:%s, type:%d do alter operation", pDb->name, pDb->cfg.dbType);
|
||||||
|
|
||||||
SDbCfg newCfg = mnodeGetAlterDbOption(pDb, pAlter);
|
SDbCfg newCfg = mnodeGetAlterDbOption(pDb, pAlter);
|
||||||
if (terrno != TSDB_CODE_SUCCESS) {
|
if (terrno != TSDB_CODE_SUCCESS) {
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -1061,9 +1099,9 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg) {
|
int32_t mnodeProcessAlterDbMsg(SMnodeMsg *pMsg) {
|
||||||
SAlterDbMsg *pAlter = pMsg->rpcMsg.pCont;
|
SAlterDbMsg *pAlter = pMsg->rpcMsg.pCont;
|
||||||
mDebug("db:%s, alter db msg is received from thandle:%p", pAlter->db, pMsg->rpcMsg.handle);
|
mDebug("db:%s, alter db msg is received from thandle:%p, dbType:%d", pAlter->db, pMsg->rpcMsg.handle, pAlter->dbType);
|
||||||
|
|
||||||
if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(pAlter->db);
|
if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(pAlter->db);
|
||||||
if (pMsg->pDb == NULL) {
|
if (pMsg->pDb == NULL) {
|
||||||
|
|
|
@ -109,6 +109,7 @@ static char *mnodeGetShowType(int32_t showType) {
|
||||||
case TSDB_MGMT_TABLE_VNODES: return "show vnodes";
|
case TSDB_MGMT_TABLE_VNODES: return "show vnodes";
|
||||||
case TSDB_MGMT_TABLE_CLUSTER: return "show clusters";
|
case TSDB_MGMT_TABLE_CLUSTER: return "show clusters";
|
||||||
case TSDB_MGMT_TABLE_STREAMTABLES : return "show streamtables";
|
case TSDB_MGMT_TABLE_STREAMTABLES : return "show streamtables";
|
||||||
|
case TSDB_MGMT_TABLE_TP: return "show topics";
|
||||||
default: return "undefined";
|
default: return "undefined";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,6 +367,11 @@ static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup) {
|
||||||
maxIdPoolSize = MAX(maxIdPoolSize, idPoolSize);
|
maxIdPoolSize = MAX(maxIdPoolSize, idPoolSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create one table each vnode
|
||||||
|
if (pDb->cfg.dbType == TSDB_DB_TYPE_TOPIC) {
|
||||||
|
maxIdPoolSize = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// new vgroup
|
// new vgroup
|
||||||
if (pInputVgroup->idPool == NULL) {
|
if (pInputVgroup->idPool == NULL) {
|
||||||
pInputVgroup->idPool = taosInitIdPool(maxIdPoolSize);
|
pInputVgroup->idPool = taosInitIdPool(maxIdPoolSize);
|
||||||
|
@ -379,6 +384,11 @@ static int32_t mnodeAllocVgroupIdPool(SVgObj *pInputVgroup) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create one table each vnode
|
||||||
|
if (pDb->cfg.dbType == TSDB_DB_TYPE_TOPIC) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// realloc all vgroups in db
|
// realloc all vgroups in db
|
||||||
int32_t newIdPoolSize;
|
int32_t newIdPoolSize;
|
||||||
if (minIdPoolSize * 4 < tsTableIncStepPerVnode) {
|
if (minIdPoolSize * 4 < tsTableIncStepPerVnode) {
|
||||||
|
@ -449,6 +459,10 @@ int32_t mnodeGetAvailableVgroup(SMnodeMsg *pMsg, SVgObj **ppVgroup, int32_t *pSi
|
||||||
maxVgroupsPerDb = MIN(maxVgroupsPerDb, TSDB_MAX_VNODES_PER_DB);
|
maxVgroupsPerDb = MIN(maxVgroupsPerDb, TSDB_MAX_VNODES_PER_DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pDb->cfg.dbType == TSDB_DB_TYPE_TOPIC) {
|
||||||
|
maxVgroupsPerDb = TSDB_MAX_DB_PARTITON_OPTION;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_MND_NO_ENOUGH_DNODES;
|
int32_t code = TSDB_CODE_MND_NO_ENOUGH_DNODES;
|
||||||
if (pDb->numOfVgroups < maxVgroupsPerDb) {
|
if (pDb->numOfVgroups < maxVgroupsPerDb) {
|
||||||
mDebug("msg:%p, app:%p db:%s, try to create a new vgroup, numOfVgroups:%d maxVgroupsPerDb:%d", pMsg,
|
mDebug("msg:%p, app:%p db:%s, try to create a new vgroup, numOfVgroups:%d maxVgroupsPerDb:%d", pMsg,
|
||||||
|
@ -881,6 +895,7 @@ static SCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) {
|
||||||
pCfg->update = pDb->cfg.update;
|
pCfg->update = pDb->cfg.update;
|
||||||
pCfg->cacheLastRow = pDb->cfg.cacheLastRow;
|
pCfg->cacheLastRow = pDb->cfg.cacheLastRow;
|
||||||
pCfg->dbReplica = pDb->cfg.replications;
|
pCfg->dbReplica = pDb->cfg.replications;
|
||||||
|
pCfg->dbType = pDb->cfg.dbType;
|
||||||
|
|
||||||
SVnodeDesc *pNodes = pVnode->nodes;
|
SVnodeDesc *pNodes = pVnode->nodes;
|
||||||
for (int32_t j = 0; j < pVgroup->numOfVnodes; ++j) {
|
for (int32_t j = 0; j < pVgroup->numOfVnodes; ++j) {
|
||||||
|
|
|
@ -125,6 +125,8 @@ typedef struct SCreateDbInfo {
|
||||||
int8_t update;
|
int8_t update;
|
||||||
int8_t cachelast;
|
int8_t cachelast;
|
||||||
SArray *keep;
|
SArray *keep;
|
||||||
|
int8_t dbType;
|
||||||
|
int16_t partitions;
|
||||||
} SCreateDbInfo;
|
} SCreateDbInfo;
|
||||||
|
|
||||||
typedef struct SCreateAcctInfo {
|
typedef struct SCreateAcctInfo {
|
||||||
|
@ -155,6 +157,7 @@ typedef struct SUserInfo {
|
||||||
typedef struct SMiscInfo {
|
typedef struct SMiscInfo {
|
||||||
SArray *a; // SArray<SStrToken>
|
SArray *a; // SArray<SStrToken>
|
||||||
bool existsCheck;
|
bool existsCheck;
|
||||||
|
int16_t dbType;
|
||||||
int16_t tableType;
|
int16_t tableType;
|
||||||
SUserInfo user;
|
SUserInfo user;
|
||||||
union {
|
union {
|
||||||
|
@ -265,7 +268,7 @@ void setCreatedTableName(SSqlInfo *pInfo, SStrToken *pTableNameToken, SStrToken
|
||||||
void SqlInfoDestroy(SSqlInfo *pInfo);
|
void SqlInfoDestroy(SSqlInfo *pInfo);
|
||||||
|
|
||||||
void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParams, ...);
|
void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParams, ...);
|
||||||
void setDropDbTableInfo(SSqlInfo *pInfo, int32_t type, SStrToken* pToken, SStrToken* existsCheck,int16_t tableType);
|
void setDropDbTableInfo(SSqlInfo *pInfo, int32_t type, SStrToken* pToken, SStrToken* existsCheck,int16_t dbType,int16_t tableType);
|
||||||
void setShowOptions(SSqlInfo *pInfo, int32_t type, SStrToken* prefix, SStrToken* pPatterns);
|
void setShowOptions(SSqlInfo *pInfo, int32_t type, SStrToken* prefix, SStrToken* pPatterns);
|
||||||
|
|
||||||
void setCreateDbInfo(SSqlInfo *pInfo, int32_t type, SStrToken *pToken, SCreateDbInfo *pDB, SStrToken *pIgExists);
|
void setCreateDbInfo(SSqlInfo *pInfo, int32_t type, SStrToken *pToken, SCreateDbInfo *pDB, SStrToken *pIgExists);
|
||||||
|
@ -276,6 +279,7 @@ void setKillSql(SSqlInfo *pInfo, int32_t type, SStrToken *ip);
|
||||||
void setAlterUserSql(SSqlInfo *pInfo, int16_t type, SStrToken *pName, SStrToken* pPwd, SStrToken *pPrivilege);
|
void setAlterUserSql(SSqlInfo *pInfo, int16_t type, SStrToken *pName, SStrToken* pPwd, SStrToken *pPrivilege);
|
||||||
|
|
||||||
void setDefaultCreateDbOption(SCreateDbInfo *pDBInfo);
|
void setDefaultCreateDbOption(SCreateDbInfo *pDBInfo);
|
||||||
|
void setDefaultCreateTopicOption(SCreateDbInfo *pDBInfo);
|
||||||
|
|
||||||
// prefix show db.tables;
|
// prefix show db.tables;
|
||||||
void setDbName(SStrToken *pCpxName, SStrToken *pDb);
|
void setDbName(SStrToken *pCpxName, SStrToken *pDb);
|
||||||
|
|
|
@ -64,6 +64,7 @@ program ::= cmd. {}
|
||||||
|
|
||||||
//////////////////////////////////THE SHOW STATEMENT///////////////////////////////////////////
|
//////////////////////////////////THE SHOW STATEMENT///////////////////////////////////////////
|
||||||
cmd ::= SHOW DATABASES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_DB, 0, 0);}
|
cmd ::= SHOW DATABASES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_DB, 0, 0);}
|
||||||
|
cmd ::= SHOW TOPICS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_TP, 0, 0);}
|
||||||
cmd ::= SHOW MNODES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_MNODE, 0, 0);}
|
cmd ::= SHOW MNODES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_MNODE, 0, 0);}
|
||||||
cmd ::= SHOW DNODES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_DNODE, 0, 0);}
|
cmd ::= SHOW DNODES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_DNODE, 0, 0);}
|
||||||
cmd ::= SHOW ACCOUNTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_ACCT, 0, 0);}
|
cmd ::= SHOW ACCOUNTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_ACCT, 0, 0);}
|
||||||
|
@ -131,16 +132,18 @@ cmd ::= SHOW dbPrefix(X) VGROUPS ids(Y). {
|
||||||
//drop configure for tables
|
//drop configure for tables
|
||||||
cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
|
cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
|
||||||
X.n += Z.n;
|
X.n += Z.n;
|
||||||
setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y, -1);
|
setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//drop stable
|
//drop stable
|
||||||
cmd ::= DROP STABLE ifexists(Y) ids(X) cpxName(Z). {
|
cmd ::= DROP STABLE ifexists(Y) ids(X) cpxName(Z). {
|
||||||
X.n += Z.n;
|
X.n += Z.n;
|
||||||
setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y, TSDB_SUPER_TABLE);
|
setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y, -1, TSDB_SUPER_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd ::= DROP DATABASE ifexists(Y) ids(X). { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &X, &Y, -1); }
|
cmd ::= DROP DATABASE ifexists(Y) ids(X). { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &X, &Y, TSDB_DB_TYPE_DEFAULT, -1); }
|
||||||
|
cmd ::= DROP TOPIC ifexists(Y) ids(X). { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &X, &Y, TSDB_DB_TYPE_TOPIC, -1); }
|
||||||
|
|
||||||
cmd ::= DROP DNODE ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &X); }
|
cmd ::= DROP DNODE ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &X); }
|
||||||
cmd ::= DROP USER ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &X); }
|
cmd ::= DROP USER ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &X); }
|
||||||
cmd ::= DROP ACCOUNT ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &X); }
|
cmd ::= DROP ACCOUNT ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &X); }
|
||||||
|
@ -162,6 +165,7 @@ cmd ::= ALTER DNODE ids(X) ids(Y) ids(Z). { setDCLSQLElems(pInfo, TSDB_SQL
|
||||||
cmd ::= ALTER LOCAL ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &X); }
|
cmd ::= ALTER LOCAL ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &X); }
|
||||||
cmd ::= ALTER LOCAL ids(X) ids(Y). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &X, &Y); }
|
cmd ::= ALTER LOCAL ids(X) ids(Y). { setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &X, &Y); }
|
||||||
cmd ::= ALTER DATABASE ids(X) alter_db_optr(Y). { SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &X, &Y, &t);}
|
cmd ::= ALTER DATABASE ids(X) alter_db_optr(Y). { SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &X, &Y, &t);}
|
||||||
|
cmd ::= ALTER TOPIC ids(X) alter_topic_optr(Y). { SStrToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &X, &Y, &t);}
|
||||||
|
|
||||||
cmd ::= ALTER ACCOUNT ids(X) acct_optr(Z). { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &X, NULL, &Z);}
|
cmd ::= ALTER ACCOUNT ids(X) acct_optr(Z). { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &X, NULL, &Z);}
|
||||||
cmd ::= ALTER ACCOUNT ids(X) PASS ids(Y) acct_optr(Z). { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &X, &Y, &Z);}
|
cmd ::= ALTER ACCOUNT ids(X) PASS ids(Y) acct_optr(Z). { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &X, &Y, &Z);}
|
||||||
|
@ -187,6 +191,7 @@ cmd ::= CREATE DNODE ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE
|
||||||
cmd ::= CREATE ACCOUNT ids(X) PASS ids(Y) acct_optr(Z).
|
cmd ::= CREATE ACCOUNT ids(X) PASS ids(Y) acct_optr(Z).
|
||||||
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &X, &Y, &Z);}
|
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &X, &Y, &Z);}
|
||||||
cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);}
|
cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);}
|
||||||
|
cmd ::= CREATE TOPIC ifnotexists(Z) ids(X) topic_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);}
|
||||||
cmd ::= CREATE USER ids(X) PASS ids(Y). { setCreateUserSql(pInfo, &X, &Y);}
|
cmd ::= CREATE USER ids(X) PASS ids(Y). { setCreateUserSql(pInfo, &X, &Y);}
|
||||||
|
|
||||||
pps(Y) ::= . { Y.n = 0; }
|
pps(Y) ::= . { Y.n = 0; }
|
||||||
|
@ -247,9 +252,10 @@ comp(Y) ::= COMP INTEGER(X). { Y = X; }
|
||||||
prec(Y) ::= PRECISION STRING(X). { Y = X; }
|
prec(Y) ::= PRECISION STRING(X). { Y = X; }
|
||||||
update(Y) ::= UPDATE INTEGER(X). { Y = X; }
|
update(Y) ::= UPDATE INTEGER(X). { Y = X; }
|
||||||
cachelast(Y) ::= CACHELAST INTEGER(X). { Y = X; }
|
cachelast(Y) ::= CACHELAST INTEGER(X). { Y = X; }
|
||||||
|
partitions(Y) ::= PARTITIONS INTEGER(X). { Y = X; }
|
||||||
|
|
||||||
%type db_optr {SCreateDbInfo}
|
%type db_optr {SCreateDbInfo}
|
||||||
db_optr(Y) ::= . {setDefaultCreateDbOption(&Y);}
|
db_optr(Y) ::= . {setDefaultCreateDbOption(&Y); Y.dbType = TSDB_DB_TYPE_DEFAULT;}
|
||||||
|
|
||||||
db_optr(Y) ::= db_optr(Z) cache(X). { Y = Z; Y.cacheBlockSize = strtol(X.z, NULL, 10); }
|
db_optr(Y) ::= db_optr(Z) cache(X). { Y = Z; Y.cacheBlockSize = strtol(X.z, NULL, 10); }
|
||||||
db_optr(Y) ::= db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); }
|
db_optr(Y) ::= db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); }
|
||||||
|
@ -267,8 +273,13 @@ db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
|
||||||
db_optr(Y) ::= db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); }
|
db_optr(Y) ::= db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); }
|
||||||
db_optr(Y) ::= db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); }
|
db_optr(Y) ::= db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); }
|
||||||
|
|
||||||
|
%type topic_optr {SCreateDbInfo}
|
||||||
|
|
||||||
|
topic_optr(Y) ::= db_optr(Z). { Y = Z; Y.dbType = TSDB_DB_TYPE_TOPIC; }
|
||||||
|
topic_optr(Y) ::= topic_optr(Z) partitions(X). { Y = Z; Y.partitions = strtol(X.z, NULL, 10); }
|
||||||
|
|
||||||
%type alter_db_optr {SCreateDbInfo}
|
%type alter_db_optr {SCreateDbInfo}
|
||||||
alter_db_optr(Y) ::= . { setDefaultCreateDbOption(&Y);}
|
alter_db_optr(Y) ::= . { setDefaultCreateDbOption(&Y); Y.dbType = TSDB_DB_TYPE_DEFAULT;}
|
||||||
|
|
||||||
alter_db_optr(Y) ::= alter_db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); }
|
alter_db_optr(Y) ::= alter_db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); }
|
||||||
alter_db_optr(Y) ::= alter_db_optr(Z) quorum(X). { Y = Z; Y.quorum = strtol(X.z, NULL, 10); }
|
alter_db_optr(Y) ::= alter_db_optr(Z) quorum(X). { Y = Z; Y.quorum = strtol(X.z, NULL, 10); }
|
||||||
|
@ -280,6 +291,11 @@ alter_db_optr(Y) ::= alter_db_optr(Z) fsync(X). { Y = Z; Y.fsyncPeriod = s
|
||||||
alter_db_optr(Y) ::= alter_db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); }
|
alter_db_optr(Y) ::= alter_db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); }
|
||||||
alter_db_optr(Y) ::= alter_db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); }
|
alter_db_optr(Y) ::= alter_db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); }
|
||||||
|
|
||||||
|
%type alter_topic_optr {SCreateDbInfo}
|
||||||
|
|
||||||
|
alter_topic_optr(Y) ::= alter_db_optr(Z). { Y = Z; Y.dbType = TSDB_DB_TYPE_TOPIC; }
|
||||||
|
alter_topic_optr(Y) ::= alter_topic_optr(Z) partitions(X). { Y = Z; Y.partitions = strtol(X.z, NULL, 10); }
|
||||||
|
|
||||||
%type typename {TAOS_FIELD}
|
%type typename {TAOS_FIELD}
|
||||||
typename(A) ::= ids(X). {
|
typename(A) ::= ids(X). {
|
||||||
X.type = 0;
|
X.type = 0;
|
||||||
|
@ -821,3 +837,4 @@ cmd ::= KILL QUERY INTEGER(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); s
|
||||||
COUNT SUM AVG MIN MAX FIRST LAST TOP BOTTOM STDDEV PERCENTILE APERCENTILE LEASTSQUARES HISTOGRAM DIFF
|
COUNT SUM AVG MIN MAX FIRST LAST TOP BOTTOM STDDEV PERCENTILE APERCENTILE LEASTSQUARES HISTOGRAM DIFF
|
||||||
SPREAD TWA INTERP LAST_ROW RATE IRATE SUM_RATE SUM_IRATE AVG_RATE AVG_IRATE TBID NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT
|
SPREAD TWA INTERP LAST_ROW RATE IRATE SUM_RATE SUM_IRATE AVG_RATE AVG_IRATE TBID NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT
|
||||||
METRIC TBNAME JOIN METRICS STABLE NULL INSERT INTO VALUES.
|
METRIC TBNAME JOIN METRICS STABLE NULL INSERT INTO VALUES.
|
||||||
|
|