提交 ebff0807 编写于 作者: H hjLiao

[td-225] merge develop

...@@ -49,7 +49,7 @@ matrix: ...@@ -49,7 +49,7 @@ matrix:
./test-all.sh $TRAVIS_EVENT_TYPE || travis_terminate $? ./test-all.sh $TRAVIS_EVENT_TYPE || travis_terminate $?
cd ${TRAVIS_BUILD_DIR}/tests/pytest cd ${TRAVIS_BUILD_DIR}/tests/pytest
./smoketest.sh -g 2>&1 | tee mem-error-out.txt ./valgrind-test.sh -g 2>&1 | tee mem-error-out.txt
sleep 1 sleep 1
# Color setting # Color setting
...@@ -64,7 +64,7 @@ matrix: ...@@ -64,7 +64,7 @@ matrix:
for memError in `cat uniq-mem-error-out.txt | awk '{print $4}'` for memError in `cat uniq-mem-error-out.txt | awk '{print $4}'`
do do
if [ -n "$memError" ]; then if [ -n "$memError" ]; then
if [ "$memError" -gt 5 ]; then if [ "$memError" -gt 12 ]; then
echo -e "${RED} ## Memory errors number valgrind reports is $memError.\ echo -e "${RED} ## Memory errors number valgrind reports is $memError.\
More than our threshold! ## ${NC}" More than our threshold! ## ${NC}"
travis_terminate $memError travis_terminate $memError
...@@ -76,7 +76,7 @@ matrix: ...@@ -76,7 +76,7 @@ matrix:
for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $7}'` for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $7}'`
do do
if [ -n "$defiMemError" ]; then if [ -n "$defiMemError" ]; then
if [ "$defiMemError" -gt 3 ]; then if [ "$defiMemError" -gt 13 ]; then
echo -e "${RED} ## Memory errors number valgrind reports \ echo -e "${RED} ## Memory errors number valgrind reports \
Definitely lost is $defiMemError. More than our threshold! ## ${NC}" Definitely lost is $defiMemError. More than our threshold! ## ${NC}"
travis_terminate $defiMemError travis_terminate $defiMemError
...@@ -115,7 +115,7 @@ matrix: ...@@ -115,7 +115,7 @@ matrix:
# The command that will be added as an argument to "cov-build" to compile your project for analysis, # The command that will be added as an argument to "cov-build" to compile your project for analysis,
# ** likely specific to your build ** # ** likely specific to your build **
build_command: make > /dev/null build_command: make
# Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'. # Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'.
# Take care in resource usage, and consider the build frequency allowances per # Take care in resource usage, and consider the build frequency allowances per
...@@ -163,11 +163,9 @@ matrix: ...@@ -163,11 +163,9 @@ matrix:
cd ${TRAVIS_BUILD_DIR}/tests cd ${TRAVIS_BUILD_DIR}/tests
./test-all.sh ./test-all.sh $TRAVIS_EVENT_TYPE COVER
if [ "$?" -ne "0" ]; then TEST_RESULT=$?
travis_terminate $?
fi
pkill taosd pkill taosd
sleep 1 sleep 1
...@@ -199,6 +197,9 @@ matrix: ...@@ -199,6 +197,9 @@ matrix:
echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} " echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} "
fi fi
if [ "$TEST_RESULT" -ne "0" ]; then
travis_terminate $?
fi
;; ;;
esac esac
......
...@@ -121,7 +121,7 @@ TDengine provides abundant developing tools for users to develop on TDengine. Fo ...@@ -121,7 +121,7 @@ TDengine provides abundant developing tools for users to develop on TDengine. Fo
1. sudo apt install 1. sudo apt install
build-essential cmake net-tools python-pip python-setuptools python3-pip build-essential cmake net-tools python-pip python-setuptools python3-pip
python3-setuptools valgrind python3-setuptools valgrind psmisc curl
2. git clone <https://github.com/taosdata/TDengine>; cd TDengine 2. git clone <https://github.com/taosdata/TDengine>; cd TDengine
......
...@@ -365,7 +365,7 @@ void tscInitMsgsFp(); ...@@ -365,7 +365,7 @@ void tscInitMsgsFp();
int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion); int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion);
void tscProcessMsgFromServer(SRpcMsg *rpcMsg); void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet);
int tscProcessSql(SSqlObj *pSql); int tscProcessSql(SSqlObj *pSql);
int tscRenewMeterMeta(SSqlObj *pSql, char *tableId); int tscRenewMeterMeta(SSqlObj *pSql, char *tableId);
......
...@@ -221,7 +221,7 @@ int tscSendMsgToServer(SSqlObj *pSql) { ...@@ -221,7 +221,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
void tscProcessMsgFromServer(SRpcMsg *rpcMsg) { void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
SSqlObj *pSql = (SSqlObj *)rpcMsg->handle; SSqlObj *pSql = (SSqlObj *)rpcMsg->handle;
if (pSql == NULL) { if (pSql == NULL) {
tscError("%p sql is already released", pSql->signature); tscError("%p sql is already released", pSql->signature);
...@@ -245,6 +245,12 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) { ...@@ -245,6 +245,12 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
return; return;
} }
if (pCmd->command < TSDB_SQL_MGMT) {
if (pIpSet) pSql->ipList = *pIpSet;
} else {
if (pIpSet) tscMgmtIpSet = *pIpSet;
}
if (rpcMsg->pCont == NULL) { if (rpcMsg->pCont == NULL) {
rpcMsg->code = TSDB_CODE_NETWORK_UNAVAIL; rpcMsg->code = TSDB_CODE_NETWORK_UNAVAIL;
} else { } else {
......
...@@ -63,6 +63,7 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) { ...@@ -63,6 +63,7 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) {
rpcInit.user = (char*)user; rpcInit.user = (char*)user;
rpcInit.idleTime = 2000; rpcInit.idleTime = 2000;
rpcInit.ckey = "key"; rpcInit.ckey = "key";
rpcInit.spi = 1;
rpcInit.secret = secretEncrypt; rpcInit.secret = secretEncrypt;
*pDnodeConn = rpcOpen(&rpcInit); *pDnodeConn = rpcOpen(&rpcInit);
......
...@@ -266,9 +266,12 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) { ...@@ -266,9 +266,12 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
return taosCfgDynamicOptions(pCfg->config); return taosCfgDynamicOptions(pCfg->config);
} }
void dnodeUpdateIpSet(SRpcIpSet *pIpSet) {
dPrint("mnode IP list is changed, numOfIps:%d inUse:%d", pIpSet->numOfIps, pIpSet->inUse);
for (int i = 0; i < pIpSet->numOfIps; ++i) {
dPrint("mnode index:%d %s:%u", i, pIpSet->fqdn[i], pIpSet->port[i])
}
void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) {
dTrace("mgmt IP list is changed for ufp is called");
tsMnodeIpSet = *pIpSet; tsMnodeIpSet = *pIpSet;
} }
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
#include "dnodeVWrite.h" #include "dnodeVWrite.h"
#include "mnode.h" #include "mnode.h"
extern void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet); extern void dnodeUpdateIpSet(SRpcIpSet *pIpSet);
static void (*dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); static void (*dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *);
static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg); static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *);
static void (*dnodeProcessRspMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *rpcMsg); static void (*dnodeProcessRspMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *rpcMsg);
static void dnodeProcessRspFromDnode(SRpcMsg *pMsg); static void dnodeProcessRspFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet);
static void *tsDnodeServerRpc = NULL; static void *tsDnodeServerRpc = NULL;
static void *tsDnodeClientRpc = NULL; static void *tsDnodeClientRpc = NULL;
...@@ -52,7 +52,8 @@ int32_t dnodeInitServer() { ...@@ -52,7 +52,8 @@ int32_t dnodeInitServer() {
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_CONFIG_VNODE] = mgmtProcessReqMsgFromDnode; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_CONFIG_VNODE] = mgmtProcessReqMsgFromDnode;
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_GRANT] = mgmtProcessReqMsgFromDnode; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_GRANT] = mgmtProcessReqMsgFromDnode;
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_STATUS] = mgmtProcessReqMsgFromDnode; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_STATUS] = mgmtProcessReqMsgFromDnode;
dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_AUTH] = mgmtProcessReqMsgFromDnode;
SRpcInit rpcInit; SRpcInit rpcInit;
memset(&rpcInit, 0, sizeof(rpcInit)); memset(&rpcInit, 0, sizeof(rpcInit));
rpcInit.localPort = tsDnodeDnodePort; rpcInit.localPort = tsDnodeDnodePort;
...@@ -81,7 +82,7 @@ void dnodeCleanupServer() { ...@@ -81,7 +82,7 @@ void dnodeCleanupServer() {
} }
} }
static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg) { static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
SRpcMsg rspMsg; SRpcMsg rspMsg;
rspMsg.handle = pMsg->handle; rspMsg.handle = pMsg->handle;
rspMsg.pCont = NULL; rspMsg.pCont = NULL;
...@@ -119,7 +120,6 @@ int32_t dnodeInitClient() { ...@@ -119,7 +120,6 @@ int32_t dnodeInitClient() {
rpcInit.label = "DND-C"; rpcInit.label = "DND-C";
rpcInit.numOfThreads = 1; rpcInit.numOfThreads = 1;
rpcInit.cfp = dnodeProcessRspFromDnode; rpcInit.cfp = dnodeProcessRspFromDnode;
rpcInit.ufp = dnodeUpdateIpSet;
rpcInit.sessions = 100; rpcInit.sessions = 100;
rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.connType = TAOS_CONN_CLIENT;
rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.idleTime = tsShellActivityTimer * 1000;
...@@ -145,9 +145,10 @@ void dnodeCleanupClient() { ...@@ -145,9 +145,10 @@ void dnodeCleanupClient() {
} }
} }
static void dnodeProcessRspFromDnode(SRpcMsg *pMsg) { static void dnodeProcessRspFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
if (dnodeProcessRspMsgFp[pMsg->msgType]) { if (dnodeProcessRspMsgFp[pMsg->msgType]) {
if (pMsg->msgType == TSDB_MSG_TYPE_DM_STATUS_RSP && pIpSet) dnodeUpdateIpSet(pIpSet);
(*dnodeProcessRspMsgFp[pMsg->msgType])(pMsg); (*dnodeProcessRspMsgFp[pMsg->msgType])(pMsg);
} else { } else {
dError("RPC %p, msg:%s is not processed", pMsg->handle, taosMsg[pMsg->msgType]); dError("RPC %p, msg:%s is not processed", pMsg->handle, taosMsg[pMsg->msgType]);
...@@ -163,3 +164,9 @@ void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) { ...@@ -163,3 +164,9 @@ void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) {
void dnodeSendMsgToDnode(SRpcIpSet *ipSet, SRpcMsg *rpcMsg) { void dnodeSendMsgToDnode(SRpcIpSet *ipSet, SRpcMsg *rpcMsg) {
rpcSendRequest(tsDnodeClientRpc, ipSet, rpcMsg); rpcSendRequest(tsDnodeClientRpc, ipSet, rpcMsg);
} }
void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp) {
SRpcIpSet ipSet = {0};
dnodeGetMnodeDnodeIpSet(&ipSet);
rpcSendRecv(tsDnodeClientRpc, &ipSet, rpcMsg, rpcRsp);
}
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "trpc.h" #include "trpc.h"
#include "tglobal.h" #include "tglobal.h"
#include "http.h" #include "http.h"
#include "mnode.h"
#include "dnode.h" #include "dnode.h"
#include "dnodeInt.h" #include "dnodeInt.h"
#include "dnodeVRead.h" #include "dnodeVRead.h"
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
#include "dnodeShell.h" #include "dnodeShell.h"
static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *);
static void dnodeProcessMsgFromShell(SRpcMsg *pMsg); static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *);
static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey); static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey);
static void * tsDnodeShellRpc = NULL; static void * tsDnodeShellRpc = NULL;
static int32_t tsDnodeQueryReqNum = 0; static int32_t tsDnodeQueryReqNum = 0;
...@@ -106,7 +107,7 @@ void dnodeCleanupShell() { ...@@ -106,7 +107,7 @@ void dnodeCleanupShell() {
} }
} }
void dnodeProcessMsgFromShell(SRpcMsg *pMsg) { void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
rpcMsg.handle = pMsg->handle; rpcMsg.handle = pMsg->handle;
rpcMsg.pCont = NULL; rpcMsg.pCont = NULL;
...@@ -138,7 +139,34 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg) { ...@@ -138,7 +139,34 @@ void dnodeProcessMsgFromShell(SRpcMsg *pMsg) {
} }
static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey) { static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
return TSDB_CODE_SUCCESS; int code = mgmtRetriveAuth(user, spi, encrypt, secret, ckey);
if (code != TSDB_CODE_NOT_READY) return code;
SDMAuthMsg *pMsg = rpcMallocCont(sizeof(SDMAuthMsg));
strcpy(pMsg->user, user);
SRpcMsg rpcMsg = {0};
rpcMsg.pCont = pMsg;
rpcMsg.contLen = sizeof(SDMAuthMsg);
rpcMsg.msgType = TSDB_MSG_TYPE_DM_AUTH;
dTrace("user:%s, send auth msg to mnode", user);
SRpcMsg rpcRsp = {0};
dnodeSendMsgToDnodeRecv(&rpcMsg, &rpcRsp);
if (rpcRsp.code != 0) {
dError("user:%s, auth msg received from mnode, error:%s", user, tstrerror(rpcRsp.code));
} else {
dTrace("user:%s, auth msg received from mnode", user);
SDMAuthRsp *pRsp = rpcRsp.pCont;
memcpy(secret, pRsp->secret, TSDB_KEY_LEN);
memcpy(ckey, pRsp->ckey, TSDB_KEY_LEN);
*spi = pRsp->spi;
*encrypt = pRsp->encrypt;
}
rpcFreeCont(rpcRsp.pCont);
return rpcRsp.code;
} }
SDnodeStatisInfo dnodeGetStatisInfo() { SDnodeStatisInfo dnodeGetStatisInfo() {
......
...@@ -52,6 +52,7 @@ int32_t dnodeGetDnodeId(); ...@@ -52,6 +52,7 @@ int32_t dnodeGetDnodeId();
void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)); void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg));
void dnodeAddServerMsgHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)); void dnodeAddServerMsgHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg));
void dnodeSendMsgToDnode(SRpcIpSet *ipSet, SRpcMsg *rpcMsg); void dnodeSendMsgToDnode(SRpcIpSet *ipSet, SRpcMsg *rpcMsg);
void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -26,8 +26,10 @@ void mgmtCleanUpSystem(); ...@@ -26,8 +26,10 @@ void mgmtCleanUpSystem();
void mgmtStopSystem(); void mgmtStopSystem();
void sdbUpdateSync(); void sdbUpdateSync();
void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg); int32_t mgmtRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey);
void mgmtProcessReqMsgFromDnode(SRpcMsg *rpcMsg); void mgmtProcessMsgFromShell(SRpcMsg *rpcMsg);
void mgmtProcessReqMsgFromDnode(SRpcMsg *rpcMsg);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -74,6 +74,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_OPTION, 0, 26, "invalid option") ...@@ -74,6 +74,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_OPTION, 0, 26, "invalid option")
TAOS_DEFINE_ERROR(TSDB_CODE_NOT_CONFIGURED, 0, 27, "not configured") TAOS_DEFINE_ERROR(TSDB_CODE_NOT_CONFIGURED, 0, 27, "not configured")
TAOS_DEFINE_ERROR(TSDB_CODE_NODE_OFFLINE, 0, 28, "node offline") TAOS_DEFINE_ERROR(TSDB_CODE_NODE_OFFLINE, 0, 28, "node offline")
TAOS_DEFINE_ERROR(TSDB_CODE_NETWORK_UNAVAIL, 0, 29, "network unavailable") TAOS_DEFINE_ERROR(TSDB_CODE_NETWORK_UNAVAIL, 0, 29, "network unavailable")
TAOS_DEFINE_ERROR(TSDB_CODE_AUTH_REQUIRED, 0, 30, "auth required")
// db // db
TAOS_DEFINE_ERROR(TSDB_CODE_DB_NOT_SELECTED, 0, 100, "db not selected") TAOS_DEFINE_ERROR(TSDB_CODE_DB_NOT_SELECTED, 0, 100, "db not selected")
......
...@@ -100,6 +100,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_CONFIG_TABLE, "config-table" ) ...@@ -100,6 +100,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_CONFIG_TABLE, "config-table" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_CONFIG_VNODE, "config-vnode" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_CONFIG_VNODE, "config-vnode" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_STATUS, "status" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_STATUS, "status" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_GRANT, "grant" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_GRANT, "grant" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DM_AUTH, "auth" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY12, "dummy12" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY12, "dummy12" )
TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY13, "dummy13" ) 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" )
...@@ -736,6 +737,14 @@ typedef struct { ...@@ -736,6 +737,14 @@ typedef struct {
char tableId[TSDB_TABLE_ID_LEN + 1]; char tableId[TSDB_TABLE_ID_LEN + 1];
} SMDAlterStreamMsg; } SMDAlterStreamMsg;
typedef struct {
char user[TSDB_USER_LEN + 1];
char spi;
char encrypt;
char secret[TSDB_KEY_LEN + 1];
char ckey[TSDB_KEY_LEN + 1];
} SDMAuthMsg, SDMAuthRsp;
#pragma pack(pop) #pragma pack(pop)
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -66,10 +66,7 @@ typedef struct { ...@@ -66,10 +66,7 @@ typedef struct {
char *ckey; // ciphering key char *ckey; // ciphering key
// call back to process incoming msg, code shall be ignored by server app // call back to process incoming msg, code shall be ignored by server app
void (*cfp)(SRpcMsg *); void (*cfp)(SRpcMsg *, SRpcIpSet *);
// call back to process notify the ipSet changes, for client app only
void (*ufp)(void *ahandle, SRpcIpSet *pIpSet);
// call back to retrieve the client auth info, for server app only // call back to retrieve the client auth info, for server app only
int (*afp)(char *tableId, char *spi, char *encrypt, char *secret, char *ckey); int (*afp)(char *tableId, char *spi, char *encrypt, char *secret, char *ckey);
......
...@@ -109,6 +109,8 @@ int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId); ...@@ -109,6 +109,8 @@ int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId);
int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg); int tsdbAlterTable(TsdbRepoT *repo, STableCfg *pCfg);
TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid); TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid);
uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size);
// the TSDB repository info // the TSDB repository info
typedef struct STsdbRepoInfo { typedef struct STsdbRepoInfo {
STsdbCfg tsdbCfg; STsdbCfg tsdbCfg;
......
...@@ -85,8 +85,7 @@ typedef struct SSuperTableObj { ...@@ -85,8 +85,7 @@ typedef struct SSuperTableObj {
int32_t numOfTables; int32_t numOfTables;
int16_t nextColId; int16_t nextColId;
SSchema * schema; SSchema * schema;
int32_t vgLen; void * vgHash;
int32_t * vgList;
} SSuperTableObj; } SSuperTableObj;
typedef struct { typedef struct {
......
...@@ -297,8 +297,10 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) { ...@@ -297,8 +297,10 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) {
if (pDb != NULL) { if (pDb != NULL) {
mgmtDecDbRef(pDb); mgmtDecDbRef(pDb);
if (pCreate->ignoreExist) { if (pCreate->ignoreExist) {
mTrace("db:%s, already exist, ignore exist is set", pCreate->db);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else { } else {
mError("db:%s, is already exist, ignore exist not set", pCreate->db);
return TSDB_CODE_DB_ALREADY_EXIST; return TSDB_CODE_DB_ALREADY_EXIST;
} }
} }
...@@ -751,6 +753,8 @@ static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) { ...@@ -751,6 +753,8 @@ static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) {
code = mgmtCreateDb(pMsg->pUser->pAcct, pCreate); code = mgmtCreateDb(pMsg->pUser->pAcct, pCreate);
if (code == TSDB_CODE_SUCCESS) { if (code == TSDB_CODE_SUCCESS) {
mLPrint("db:%s, is created by %s", pCreate->db, pMsg->pUser->user); mLPrint("db:%s, is created by %s", pCreate->db, pMsg->pUser->user);
} else {
mError("db:%s, failed to create, reason:%s", pCreate->db, tstrerror(code));
} }
} }
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
typedef int32_t (*SShowMetaFp)(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); typedef int32_t (*SShowMetaFp)(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
typedef int32_t (*SShowRetrieveFp)(SShowObj *pShow, char *data, int32_t rows, void *pConn); typedef int32_t (*SShowRetrieveFp)(SShowObj *pShow, char *data, int32_t rows, void *pConn);
//static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey);
static bool mgmtCheckMsgReadOnly(SQueuedMsg *pMsg); static bool mgmtCheckMsgReadOnly(SQueuedMsg *pMsg);
static void mgmtProcessUnSupportMsg(SRpcMsg *rpcMsg); static void mgmtProcessUnSupportMsg(SRpcMsg *rpcMsg);
static void mgmtProcessShowMsg(SQueuedMsg *queuedMsg); static void mgmtProcessShowMsg(SQueuedMsg *queuedMsg);
...@@ -343,29 +342,6 @@ static void mgmtProcessHeartBeatMsg(SQueuedMsg *pMsg) { ...@@ -343,29 +342,6 @@ static void mgmtProcessHeartBeatMsg(SQueuedMsg *pMsg) {
rpcSendResponse(&rpcRsp); rpcSendResponse(&rpcRsp);
} }
/*
static int mgmtShellRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
*spi = 1;
*encrypt = 0;
*ckey = 0;
if (!sdbIsMaster()) {
*secret = 0;
return TSDB_CODE_NOT_READY;
}
SUserObj *pUser = mgmtGetUser(user);
if (pUser == NULL) {
*secret = 0;
return TSDB_CODE_INVALID_USER;
} else {
memcpy(secret, pUser->pass, TSDB_KEY_LEN);
mgmtDecUserRef(pUser);
return TSDB_CODE_SUCCESS;
}
}
*/
static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) { static void mgmtProcessConnectMsg(SQueuedMsg *pMsg) {
SRpcMsg rpcRsp = {.handle = pMsg->thandle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0}; SRpcMsg rpcRsp = {.handle = pMsg->thandle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0};
SCMConnectMsg *pConnectMsg = pMsg->pCont; SCMConnectMsg *pConnectMsg = pMsg->pCont;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "tname.h" #include "tname.h"
#include "tidpool.h" #include "tidpool.h"
#include "tglobal.h" #include "tglobal.h"
#include "hash.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mgmtDef.h"
#include "mgmtInt.h" #include "mgmtInt.h"
...@@ -194,7 +195,7 @@ static int32_t mgmtChildTableActionUpdate(SSdbOper *pOper) { ...@@ -194,7 +195,7 @@ static int32_t mgmtChildTableActionUpdate(SSdbOper *pOper) {
} }
static int32_t mgmtChildTableActionEncode(SSdbOper *pOper) { static int32_t mgmtChildTableActionEncode(SSdbOper *pOper) {
const int32_t maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS; const int32_t maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16);
SChildTableObj *pTable = pOper->pObj; SChildTableObj *pTable = pOper->pObj;
assert(pTable != NULL && pOper->rowData != NULL); assert(pTable != NULL && pOper->rowData != NULL);
...@@ -336,7 +337,7 @@ static int32_t mgmtInitChildTables() { ...@@ -336,7 +337,7 @@ static int32_t mgmtInitChildTables() {
.tableId = SDB_TABLE_CTABLE, .tableId = SDB_TABLE_CTABLE,
.tableName = "ctables", .tableName = "ctables",
.hashSessions = tsMaxTables, .hashSessions = tsMaxTables,
.maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS, .maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16),
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_STRING, .keyType = SDB_KEY_STRING,
.insertFp = mgmtChildTableActionInsert, .insertFp = mgmtChildTableActionInsert,
...@@ -363,39 +364,35 @@ static void mgmtCleanUpChildTables() { ...@@ -363,39 +364,35 @@ static void mgmtCleanUpChildTables() {
} }
static void mgmtAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCtable) { static void mgmtAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCtable) {
if (pStable->vgLen == 0) { pStable->numOfTables++;
pStable->vgLen = 8;
pStable->vgList = calloc(pStable->vgLen, sizeof(int32_t));
}
bool find = false;
int32_t pos = 0;
for (pos = 0; pos < pStable->vgLen; ++pos) {
if (pStable->vgList[pos] == 0) break;
if (pStable->vgList[pos] == pCtable->vgId) {
find = true;
break;
}
}
if (!find) { if (pStable->vgHash == NULL) {
if (pos >= pStable->vgLen) { pStable->vgHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false);
pStable->vgLen *= 2;
pStable->vgList = realloc(pStable->vgList, pStable->vgLen * sizeof(int32_t));
}
pStable->vgList[pos] = pCtable->vgId;
} }
pStable->numOfTables++; if (pStable->vgHash != NULL) {
taosHashPut(pStable->vgHash, (char *)&pCtable->vgId, sizeof(pCtable->vgId), &pCtable->vgId, sizeof(pCtable->vgId));
}
} }
static void mgmtRemoveTableFromStable(SSuperTableObj *pStable, SChildTableObj *pCtable) { static void mgmtRemoveTableFromStable(SSuperTableObj *pStable, SChildTableObj *pCtable) {
pStable->numOfTables--; pStable->numOfTables--;
if (pStable->vgHash == NULL) return;
SVgObj *pVgroup = mgmtGetVgroup(pCtable->vgId);
if (pVgroup == NULL) {
taosHashRemove(pStable->vgHash, (char *)&pCtable->vgId, sizeof(pCtable->vgId));
}
mgmtDecVgroupRef(pVgroup);
} }
static void mgmtDestroySuperTable(SSuperTableObj *pStable) { static void mgmtDestroySuperTable(SSuperTableObj *pStable) {
if (pStable->vgHash != NULL) {
taosHashCleanup(pStable->vgHash);
pStable->vgHash = NULL;
}
tfree(pStable->schema); tfree(pStable->schema);
tfree(pStable->vgList)
tfree(pStable); tfree(pStable);
} }
...@@ -434,7 +431,7 @@ static int32_t mgmtSuperTableActionUpdate(SSdbOper *pOper) { ...@@ -434,7 +431,7 @@ static int32_t mgmtSuperTableActionUpdate(SSdbOper *pOper) {
void *oldSchema = pTable->schema; void *oldSchema = pTable->schema;
memcpy(pTable, pNew, pOper->rowSize); memcpy(pTable, pNew, pOper->rowSize);
pTable->schema = pNew->schema; pTable->schema = pNew->schema;
free(pNew->vgList); free(pNew->vgHash);
free(pNew); free(pNew);
free(oldSchema); free(oldSchema);
} }
...@@ -443,7 +440,7 @@ static int32_t mgmtSuperTableActionUpdate(SSdbOper *pOper) { ...@@ -443,7 +440,7 @@ static int32_t mgmtSuperTableActionUpdate(SSdbOper *pOper) {
} }
static int32_t mgmtSuperTableActionEncode(SSdbOper *pOper) { static int32_t mgmtSuperTableActionEncode(SSdbOper *pOper) {
const int32_t maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS; const int32_t maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16);
SSuperTableObj *pStable = pOper->pObj; SSuperTableObj *pStable = pOper->pObj;
assert(pOper->pObj != NULL && pOper->rowData != NULL); assert(pOper->pObj != NULL && pOper->rowData != NULL);
...@@ -494,7 +491,7 @@ static int32_t mgmtInitSuperTables() { ...@@ -494,7 +491,7 @@ static int32_t mgmtInitSuperTables() {
.tableId = SDB_TABLE_STABLE, .tableId = SDB_TABLE_STABLE,
.tableName = "stables", .tableName = "stables",
.hashSessions = TSDB_MAX_SUPER_TABLES, .hashSessions = TSDB_MAX_SUPER_TABLES,
.maxRowSize = tsSuperTableUpdateSize + sizeof(SSchema) * TSDB_MAX_COLUMNS, .maxRowSize = tsSuperTableUpdateSize + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16),
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_STRING, .keyType = SDB_KEY_STRING,
.insertFp = mgmtSuperTableActionInsert, .insertFp = mgmtSuperTableActionInsert,
...@@ -797,26 +794,26 @@ static void mgmtProcessCreateSuperTableMsg(SQueuedMsg *pMsg) { ...@@ -797,26 +794,26 @@ static void mgmtProcessCreateSuperTableMsg(SQueuedMsg *pMsg) {
static void mgmtProcessDropSuperTableMsg(SQueuedMsg *pMsg) { static void mgmtProcessDropSuperTableMsg(SQueuedMsg *pMsg) {
SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable; SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable;
if (pStable->numOfTables != 0) { if (pStable->numOfTables != 0) {
mgmtDropAllChildTablesInStable(pStable); SHashMutableIterator *pIter = taosHashCreateIter(pStable->vgHash);
for (int32_t vg = 0; vg < pStable->vgLen; ++vg) { while (taosHashIterNext(pIter)) {
int32_t vgId = pStable->vgList[vg]; int32_t *pVgId = taosHashIterGet(pIter);
if (vgId == 0) break; SVgObj *pVgroup = mgmtGetVgroup(*pVgId);
SVgObj *pVgroup = mgmtGetVgroup(vgId);
if (pVgroup == NULL) break; if (pVgroup == NULL) break;
SMDDropSTableMsg *pDrop = rpcMallocCont(sizeof(SMDDropSTableMsg)); SMDDropSTableMsg *pDrop = rpcMallocCont(sizeof(SMDDropSTableMsg));
pDrop->contLen = htonl(sizeof(SMDDropSTableMsg)); pDrop->contLen = htonl(sizeof(SMDDropSTableMsg));
pDrop->vgId = htonl(vgId); pDrop->vgId = htonl(pVgroup->vgId);
pDrop->uid = htobe64(pStable->uid); pDrop->uid = htobe64(pStable->uid);
mgmtExtractTableName(pStable->info.tableId, pDrop->tableId); mgmtExtractTableName(pStable->info.tableId, pDrop->tableId);
mPrint("stable:%s, send drop stable msg to vgId:%d", pStable->info.tableId, vgId); mPrint("stable:%s, send drop stable msg to vgId:%d", pStable->info.tableId, pVgroup->vgId);
SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup);
SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE}; SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE};
dnodeSendMsgToDnode(&ipSet, &rpcMsg); dnodeSendMsgToDnode(&ipSet, &rpcMsg);
mgmtDecVgroupRef(pVgroup); mgmtDecVgroupRef(pVgroup);
} }
mgmtDropAllChildTablesInStable(pStable);
} }
SSdbOper oper = { SSdbOper oper = {
...@@ -1221,7 +1218,7 @@ static int32_t mgmtSetSchemaFromSuperTable(SSchema *pSchema, SSuperTableObj *pTa ...@@ -1221,7 +1218,7 @@ static int32_t mgmtSetSchemaFromSuperTable(SSchema *pSchema, SSuperTableObj *pTa
static void mgmtGetSuperTableMeta(SQueuedMsg *pMsg) { static void mgmtGetSuperTableMeta(SQueuedMsg *pMsg) {
SSuperTableObj *pTable = (SSuperTableObj *)pMsg->pTable; SSuperTableObj *pTable = (SSuperTableObj *)pMsg->pTable;
STableMetaMsg *pMeta = rpcMallocCont(sizeof(STableMetaMsg) + sizeof(SSchema) * TSDB_MAX_COLUMNS); STableMetaMsg *pMeta = rpcMallocCont(sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16));
pMeta->uid = htobe64(pTable->uid); pMeta->uid = htobe64(pTable->uid);
pMeta->sversion = htons(pTable->sversion); pMeta->sversion = htons(pTable->sversion);
pMeta->precision = pMsg->pDb->cfg.precision; pMeta->precision = pMsg->pDb->cfg.precision;
...@@ -1245,59 +1242,58 @@ static void mgmtGetSuperTableMeta(SQueuedMsg *pMsg) { ...@@ -1245,59 +1242,58 @@ static void mgmtGetSuperTableMeta(SQueuedMsg *pMsg) {
static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) {
SCMSTableVgroupMsg *pInfo = pMsg->pCont; SCMSTableVgroupMsg *pInfo = pMsg->pCont;
int32_t numOfTable = htonl(pInfo->numOfTables); int32_t numOfTable = htonl(pInfo->numOfTables);
char* name = (char*) pInfo + sizeof(struct SCMSTableVgroupMsg); // reserve space
SCMSTableVgroupRspMsg *pRsp = NULL; int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + 32 * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo);
for (int32_t i = 0; i < numOfTable; ++i) {
// todo set the initial size to be 10, fix me char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i;
int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + (sizeof(SCMVgroupInfo) * 10 + sizeof(SVgroupsInfo))*numOfTable; SSuperTableObj *pTable = mgmtGetSuperTable(stableName);
if (pTable->vgHash != NULL) {
pRsp = rpcMallocCont(contLen); contLen += (taosHashGetSize(pTable->vgHash) * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo));
}
mgmtDecTableRef(pTable);
}
SCMSTableVgroupRspMsg *pRsp = rpcMallocCont(contLen);
if (pRsp == NULL) { if (pRsp == NULL) {
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY);
return; return;
} }
pRsp->numOfTables = htonl(numOfTable); pRsp->numOfTables = htonl(numOfTable);
char* msg = (char*) pRsp + sizeof(SCMSTableVgroupRspMsg); char* msg = (char*) pRsp + sizeof(SCMSTableVgroupRspMsg);
for(int32_t i = 0; i < numOfTable; ++i) { for (int32_t i = 0; i < numOfTable; ++i) {
SSuperTableObj *pTable = mgmtGetSuperTable(name); char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i;
SSuperTableObj *pTable = mgmtGetSuperTable(stableName);
pMsg->pTable = (STableObj *)pTable; SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg;
if (pMsg->pTable == NULL) {
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_INVALID_TABLE); SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash);
return; int32_t vgSize = 0;
} while (taosHashIterNext(pIter)) {
int32_t *pVgId = taosHashIterGet(pIter);
SVgroupsInfo* pVgroup = (SVgroupsInfo*) msg; SVgObj * pVgroup = mgmtGetVgroup(*pVgId);
if (pVgroup == NULL) continue;
int32_t vg = 0;
for (; vg < pTable->vgLen; ++vg) { pVgroupInfo->vgroups[vgSize].vgId = htonl(pVgroup->vgId);
int32_t vgId = pTable->vgList[vg]; for (int32_t vn = 0; vn < pVgroup->numOfVnodes; ++vn) {
if (vgId == 0) break; SDnodeObj *pDnode = pVgroup->vnodeGid[vn].pDnode;
SVgObj *vgItem = mgmtGetVgroup(vgId);
if (vgItem == NULL) break;
pVgroup->vgroups[vg].vgId = htonl(vgId);
for (int32_t vn = 0; vn < vgItem->numOfVnodes; ++vn) {
SDnodeObj *pDnode = vgItem->vnodeGid[vn].pDnode;
if (pDnode == NULL) break; if (pDnode == NULL) break;
strncpy(pVgroup->vgroups[vg].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); strncpy(pVgroupInfo->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn));
pVgroup->vgroups[vg].ipAddr[vn].port = htons(tsDnodeShellPort); pVgroupInfo->vgroups[vgSize].ipAddr[vn].port = htons(tsDnodeShellPort);
pVgroup->vgroups[vg].numOfIps++; pVgroupInfo->vgroups[vgSize].numOfIps++;
} }
mgmtDecVgroupRef(vgItem); vgSize++;
mgmtDecVgroupRef(pVgroup);
} }
pVgroup->numOfVgroups = htonl(vg); pVgroupInfo->numOfVgroups = htonl(vgSize);
// one table is done, try the next table // one table is done, try the next table
msg += sizeof(SVgroupsInfo) + vg * sizeof(SCMVgroupInfo); msg += sizeof(SVgroupsInfo) + vgSize * sizeof(SCMVgroupInfo);
} }
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};
...@@ -1736,7 +1732,7 @@ static void mgmtAutoCreateChildTable(SQueuedMsg *pMsg) { ...@@ -1736,7 +1732,7 @@ static void mgmtAutoCreateChildTable(SQueuedMsg *pMsg) {
} }
static void mgmtGetChildTableMeta(SQueuedMsg *pMsg) { static void mgmtGetChildTableMeta(SQueuedMsg *pMsg) {
STableMetaMsg *pMeta = rpcMallocCont(sizeof(STableMetaMsg) + sizeof(SSchema) * TSDB_MAX_COLUMNS); STableMetaMsg *pMeta = rpcMallocCont(sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16));
if (pMeta == NULL) { if (pMeta == NULL) {
mError("table:%s, failed to get table meta, no enough memory", pMsg->pTable->tableId); mError("table:%s, failed to get table meta, no enough memory", pMsg->pTable->tableId);
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY);
...@@ -1984,7 +1980,7 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) { ...@@ -1984,7 +1980,7 @@ static void mgmtProcessMultiTableMetaMsg(SQueuedMsg *pMsg) {
if (pMsg->pDb == NULL) continue; if (pMsg->pDb == NULL) continue;
int availLen = totalMallocLen - pMultiMeta->contLen; int availLen = totalMallocLen - pMultiMeta->contLen;
if (availLen <= sizeof(STableMetaMsg) + sizeof(SSchema) * TSDB_MAX_COLUMNS) { if (availLen <= sizeof(STableMetaMsg) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16)) {
//TODO realloc //TODO realloc
//totalMallocLen *= 2; //totalMallocLen *= 2;
//pMultiMeta = rpcReMalloc(pMultiMeta, totalMallocLen); //pMultiMeta = rpcReMalloc(pMultiMeta, totalMallocLen);
......
...@@ -37,6 +37,7 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void ...@@ -37,6 +37,7 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void
static void mgmtProcessCreateUserMsg(SQueuedMsg *pMsg); static void mgmtProcessCreateUserMsg(SQueuedMsg *pMsg);
static void mgmtProcessAlterUserMsg(SQueuedMsg *pMsg); static void mgmtProcessAlterUserMsg(SQueuedMsg *pMsg);
static void mgmtProcessDropUserMsg(SQueuedMsg *pMsg); static void mgmtProcessDropUserMsg(SQueuedMsg *pMsg);
static void mgmtProcessAuthMsg(SRpcMsg *rpcMsg);
static int32_t mgmtUserActionDestroy(SSdbOper *pOper) { static int32_t mgmtUserActionDestroy(SSdbOper *pOper) {
tfree(pOper->pObj); tfree(pOper->pObj);
...@@ -140,7 +141,8 @@ int32_t mgmtInitUsers() { ...@@ -140,7 +141,8 @@ int32_t mgmtInitUsers() {
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_USER, mgmtProcessDropUserMsg); mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_DROP_USER, mgmtProcessDropUserMsg);
mgmtAddShellShowMetaHandle(TSDB_MGMT_TABLE_USER, mgmtGetUserMeta); mgmtAddShellShowMetaHandle(TSDB_MGMT_TABLE_USER, mgmtGetUserMeta);
mgmtAddShellShowRetrieveHandle(TSDB_MGMT_TABLE_USER, mgmtRetrieveUsers); mgmtAddShellShowRetrieveHandle(TSDB_MGMT_TABLE_USER, mgmtRetrieveUsers);
dnodeAddServerMsgHandle(TSDB_MSG_TYPE_DM_AUTH, mgmtProcessAuthMsg);
mTrace("table:%s, hash is created", tableDesc.tableName); mTrace("table:%s, hash is created", tableDesc.tableName);
return 0; return 0;
} }
...@@ -529,3 +531,40 @@ void mgmtDropAllUsers(SAcctObj *pAcct) { ...@@ -529,3 +531,40 @@ void mgmtDropAllUsers(SAcctObj *pAcct) {
mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers); mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers);
} }
int32_t mgmtRetriveAuth(char *user, char *spi, char *encrypt, char *secret, char *ckey) {
if (!sdbIsMaster()) {
*secret = 0;
mTrace("user:%s, failed to auth user, reason:%s", user, tstrerror(TSDB_CODE_NOT_READY));
return TSDB_CODE_NOT_READY;
}
SUserObj *pUser = mgmtGetUser(user);
if (pUser == NULL) {
*secret = 0;
mError("user:%s, failed to auth user, reason:%s", user, tstrerror(TSDB_CODE_INVALID_USER));
return TSDB_CODE_INVALID_USER;
} else {
*spi = 1;
*encrypt = 0;
*ckey = 0;
memcpy(secret, pUser->pass, TSDB_KEY_LEN);
mgmtDecUserRef(pUser);
mTrace("user:%s, auth info is returned", user);
return TSDB_CODE_SUCCESS;
}
}
static void mgmtProcessAuthMsg(SRpcMsg *rpcMsg) {
SRpcMsg rpcRsp = {.handle = rpcMsg->handle, .pCont = NULL, .contLen = 0, .code = 0, .msgType = 0};
SDMAuthMsg *pAuthMsg = rpcMsg->pCont;
SDMAuthRsp *pAuthRsp = rpcMallocCont(sizeof(SDMAuthRsp));
rpcRsp.code = mgmtRetriveAuth(pAuthMsg->user, &pAuthRsp->spi, &pAuthRsp->encrypt, pAuthRsp->secret, pAuthRsp->ckey);
rpcRsp.pCont = pAuthRsp;
rpcRsp.contLen = sizeof(SDMAuthRsp);
rpcSendResponse(&rpcRsp);
}
...@@ -820,7 +820,7 @@ void setCreateDBSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pToken, SCreateDBI ...@@ -820,7 +820,7 @@ void setCreateDBSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pToken, SCreateDBI
pInfo->pDCLInfo->dbOpt = *pDB; pInfo->pDCLInfo->dbOpt = *pDB;
pInfo->pDCLInfo->dbOpt.dbname = *pToken; pInfo->pDCLInfo->dbOpt.dbname = *pToken;
pInfo->pDCLInfo->dbOpt.ignoreExists = (pIgExists->z != NULL); pInfo->pDCLInfo->dbOpt.ignoreExists = pIgExists->n; // sql.y has: ifnotexists(X) ::= IF NOT EXISTS. {X.n = 1;}
} }
void setCreateAcctSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pName, SSQLToken *pPwd, SCreateAcctSQL *pAcctInfo) { void setCreateAcctSQL(SSqlInfo *pInfo, int32_t type, SSQLToken *pName, SSQLToken *pPwd, SCreateAcctSQL *pAcctInfo) {
......
...@@ -55,9 +55,8 @@ typedef struct { ...@@ -55,9 +55,8 @@ typedef struct {
char secret[TSDB_KEY_LEN]; // secret for the link char secret[TSDB_KEY_LEN]; // secret for the link
char ckey[TSDB_KEY_LEN]; // ciphering key char ckey[TSDB_KEY_LEN]; // ciphering key
void (*cfp)(SRpcMsg *); void (*cfp)(SRpcMsg *, SRpcIpSet *);
int (*afp)(char *user, char *spi, char *encrypt, char *secret, char *ckey); int (*afp)(char *user, char *spi, char *encrypt, char *secret, char *ckey);
void (*ufp)(void *ahandle, SRpcIpSet *pIpSet);
void *idPool; // handle to ID pool void *idPool; // handle to ID pool
void *tmrCtrl; // handle to timer void *tmrCtrl; // handle to timer
...@@ -222,7 +221,6 @@ void *rpcOpen(const SRpcInit *pInit) { ...@@ -222,7 +221,6 @@ void *rpcOpen(const SRpcInit *pInit) {
if (pInit->secret) strcpy(pRpc->secret, pInit->secret); if (pInit->secret) strcpy(pRpc->secret, pInit->secret);
if (pInit->ckey) strcpy(pRpc->ckey, pInit->ckey); if (pInit->ckey) strcpy(pRpc->ckey, pInit->ckey);
pRpc->spi = pInit->spi; pRpc->spi = pInit->spi;
pRpc->ufp = pInit->ufp;
pRpc->cfp = pInit->cfp; pRpc->cfp = pInit->cfp;
pRpc->afp = pInit->afp; pRpc->afp = pInit->afp;
...@@ -614,7 +612,12 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) { ...@@ -614,7 +612,12 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
pConn->ownId = htonl(pConn->sid); pConn->ownId = htonl(pConn->sid);
pConn->linkUid = pHead->linkUid; pConn->linkUid = pHead->linkUid;
if (pRpc->afp) { if (pRpc->afp) {
terrno = (*pRpc->afp)(pConn->user, &pConn->spi, &pConn->encrypt, pConn->secret, pConn->ckey); if (pConn->user[0] == 0) {
terrno = TSDB_CODE_AUTH_REQUIRED;
} else {
terrno = (*pRpc->afp)(pConn->user, &pConn->spi, &pConn->encrypt, pConn->secret, pConn->ckey);
}
if (terrno != 0) { if (terrno != 0) {
tWarn("%s %p, user not there or server not ready", pRpc->label, pConn); tWarn("%s %p, user not there or server not ready", pRpc->label, pConn);
taosFreeId(pRpc->idPool, sid); // sid shall be released taosFreeId(pRpc->idPool, sid); // sid shall be released
...@@ -900,10 +903,11 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) { ...@@ -900,10 +903,11 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) {
memcpy(pContext->pRsp, pMsg, sizeof(SRpcMsg)); memcpy(pContext->pRsp, pMsg, sizeof(SRpcMsg));
} else { } else {
// for asynchronous API // for asynchronous API
if (pRpc->ufp && (pContext->ipSet.inUse != pContext->oldInUse || pContext->redirect)) SRpcIpSet *pIpSet = NULL;
(*pRpc->ufp)(pContext->ahandle, &pContext->ipSet); // notify the update of ipSet if (pContext->ipSet.inUse != pContext->oldInUse || pContext->redirect)
pIpSet = &pContext->ipSet;
(*pRpc->cfp)(pMsg); (*pRpc->cfp)(pMsg, pIpSet);
} }
// free the request message // free the request message
...@@ -924,13 +928,19 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) { ...@@ -924,13 +928,19 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
if ( rpcIsReq(pHead->msgType) ) { if ( rpcIsReq(pHead->msgType) ) {
rpcMsg.handle = pConn; rpcMsg.handle = pConn;
taosTmrReset(rpcProcessProgressTimer, tsRpcTimer/2, pConn, pRpc->tmrCtrl, &pConn->pTimer); taosTmrReset(rpcProcessProgressTimer, tsRpcTimer/2, pConn, pRpc->tmrCtrl, &pConn->pTimer);
(*(pRpc->cfp))(&rpcMsg); (*(pRpc->cfp))(&rpcMsg, NULL);
} else { } else {
// it's a response // it's a response
SRpcReqContext *pContext = pConn->pContext; SRpcReqContext *pContext = pConn->pContext;
rpcMsg.handle = pContext->ahandle; rpcMsg.handle = pContext->ahandle;
pConn->pContext = NULL; pConn->pContext = NULL;
if (pHead->code == TSDB_CODE_AUTH_REQUIRED) {
pConn->secured = 0;
rpcSendReqToServer(pRpc, pContext);
return;
}
// for UDP, port may be changed by server, the port in ipSet shall be used for cache // for UDP, port may be changed by server, the port in ipSet shall be used for cache
rpcAddConnIntoCache(pRpc->pCache, pConn, pConn->peerFqdn, pContext->ipSet.port[pContext->ipSet.inUse], pConn->connType); rpcAddConnIntoCache(pRpc->pCache, pConn, pConn->peerFqdn, pContext->ipSet.port[pContext->ipSet.inUse], pConn->connType);
......
...@@ -31,22 +31,16 @@ typedef struct { ...@@ -31,22 +31,16 @@ typedef struct {
void *pRpc; void *pRpc;
} SInfo; } SInfo;
static void processResponse(SRpcMsg *pMsg) { static void processResponse(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
SInfo *pInfo = (SInfo *)pMsg->handle; SInfo *pInfo = (SInfo *)pMsg->handle;
tTrace("thread:%d, response is received, type:%d contLen:%d code:0x%x", pInfo->index, pMsg->msgType, pMsg->contLen, pMsg->code); tTrace("thread:%d, response is received, type:%d contLen:%d code:0x%x", pInfo->index, pMsg->msgType, pMsg->contLen, pMsg->code);
rpcFreeCont(pMsg->pCont); if (pIpSet) pInfo->ipSet = *pIpSet;
rpcFreeCont(pMsg->pCont);
sem_post(&pInfo->rspSem); sem_post(&pInfo->rspSem);
} }
static void processUpdateIpSet(void *handle, SRpcIpSet *pIpSet) {
SInfo *pInfo = (SInfo *)handle;
tTrace("thread:%d, ip set is changed, index:%d", pInfo->index, pIpSet->inUse);
pInfo->ipSet = *pIpSet;
}
static int tcount = 0; static int tcount = 0;
static void *sendRequest(void *param) { static void *sendRequest(void *param) {
...@@ -99,7 +93,6 @@ int main(int argc, char *argv[]) { ...@@ -99,7 +93,6 @@ int main(int argc, char *argv[]) {
rpcInit.label = "APP"; rpcInit.label = "APP";
rpcInit.numOfThreads = 1; rpcInit.numOfThreads = 1;
rpcInit.cfp = processResponse; rpcInit.cfp = processResponse;
rpcInit.ufp = processUpdateIpSet;
rpcInit.sessions = 100; rpcInit.sessions = 100;
rpcInit.idleTime = tsShellActivityTimer*1000; rpcInit.idleTime = tsShellActivityTimer*1000;
rpcInit.user = "michael"; rpcInit.user = "michael";
......
...@@ -32,12 +32,6 @@ typedef struct { ...@@ -32,12 +32,6 @@ typedef struct {
void *pRpc; void *pRpc;
} SInfo; } SInfo;
static void processUpdateIpSet(void *handle, SRpcIpSet *pIpSet) {
SInfo *pInfo = (SInfo *)handle;
tTrace("thread:%d, ip set is changed, index:%d", pInfo->index, pIpSet->inUse);
pInfo->ipSet = *pIpSet;
}
static int tcount = 0; static int tcount = 0;
static int terror = 0; static int terror = 0;
...@@ -100,8 +94,6 @@ int main(int argc, char *argv[]) { ...@@ -100,8 +94,6 @@ int main(int argc, char *argv[]) {
rpcInit.localPort = 0; rpcInit.localPort = 0;
rpcInit.label = "APP"; rpcInit.label = "APP";
rpcInit.numOfThreads = 1; rpcInit.numOfThreads = 1;
// rpcInit.cfp = processResponse;
rpcInit.ufp = processUpdateIpSet;
rpcInit.sessions = 100; rpcInit.sessions = 100;
rpcInit.idleTime = tsShellActivityTimer*1000; rpcInit.idleTime = tsShellActivityTimer*1000;
rpcInit.user = "michael"; rpcInit.user = "michael";
......
...@@ -113,7 +113,7 @@ int retrieveAuthInfo(char *meterId, char *spi, char *encrypt, char *secret, char ...@@ -113,7 +113,7 @@ int retrieveAuthInfo(char *meterId, char *spi, char *encrypt, char *secret, char
return ret; return ret;
} }
void processRequestMsg(SRpcMsg *pMsg) { void processRequestMsg(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
SRpcMsg *pTemp; SRpcMsg *pTemp;
pTemp = taosAllocateQitem(sizeof(SRpcMsg)); pTemp = taosAllocateQitem(sizeof(SRpcMsg));
......
...@@ -151,8 +151,6 @@ STSchema * tsdbGetTableTagSchema(STsdbMeta *pMeta, STable *pTable); ...@@ -151,8 +151,6 @@ STSchema * tsdbGetTableTagSchema(STsdbMeta *pMeta, STable *pTable);
STsdbMeta *tsdbGetMeta(TsdbRepoT *pRepo); STsdbMeta *tsdbGetMeta(TsdbRepoT *pRepo);
int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg);
int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId);
STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId); STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId);
// int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable); // int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable);
STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid); STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid);
...@@ -496,9 +494,10 @@ int tsdbWriteCompInfo(SRWHelper *pHelper); ...@@ -496,9 +494,10 @@ int tsdbWriteCompInfo(SRWHelper *pHelper);
int tsdbWriteCompIdx(SRWHelper *pHelper); int tsdbWriteCompIdx(SRWHelper *pHelper);
// --------- Other functions need to further organize // --------- Other functions need to further organize
void tsdbFitRetention(STsdbRepo *pRepo); void tsdbFitRetention(STsdbRepo *pRepo);
int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks); int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks);
void tsdbAdjustCacheBlocks(STsdbCache *pCache); void tsdbAdjustCacheBlocks(STsdbCache *pCache);
int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -164,7 +164,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) { ...@@ -164,7 +164,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) {
} }
tsdbUnLockRepo((TsdbRepoT *)pRepo); tsdbUnLockRepo((TsdbRepoT *)pRepo);
tsdbTrace("tsdbId %d: tsdb total cache blocks changed from %d to %d", pRepo->config.tsdbId, oldNumOfBlocks, totalBlocks); tsdbTrace("vgId: %d tsdb total cache blocks changed from %d to %d", pRepo->config.tsdbId, oldNumOfBlocks, totalBlocks);
return 0; return 0;
} }
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "tscompression.h" #include "tscompression.h"
#include "tchecksum.h" #include "tchecksum.h"
#include "ttime.h" #include "ttime.h"
#include <sys/stat.h>
int tsdbDebugFlag = 135; int tsdbDebugFlag = 135;
...@@ -133,6 +134,7 @@ int32_t tsdbCreateRepo(char *rootDir, STsdbCfg *pCfg, void *limiter /* TODO */) ...@@ -133,6 +134,7 @@ int32_t tsdbCreateRepo(char *rootDir, STsdbCfg *pCfg, void *limiter /* TODO */)
*/ */
int32_t tsdbDropRepo(TsdbRepoT *repo) { int32_t tsdbDropRepo(TsdbRepoT *repo) {
STsdbRepo *pRepo = (STsdbRepo *)repo; STsdbRepo *pRepo = (STsdbRepo *)repo;
int id = pRepo->config.tsdbId;
pRepo->state = TSDB_REPO_STATE_CLOSED; pRepo->state = TSDB_REPO_STATE_CLOSED;
...@@ -148,6 +150,8 @@ int32_t tsdbDropRepo(TsdbRepoT *repo) { ...@@ -148,6 +150,8 @@ int32_t tsdbDropRepo(TsdbRepoT *repo) {
free(pRepo->rootDir); free(pRepo->rootDir);
free(pRepo); free(pRepo);
tsdbTrace("vgId: %d tsdb repository is dropped!", id);
return 0; return 0;
} }
...@@ -238,6 +242,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) { ...@@ -238,6 +242,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
pRepo->state = TSDB_REPO_STATE_ACTIVE; pRepo->state = TSDB_REPO_STATE_ACTIVE;
tsdbTrace("vgId: %d open tsdb repository successfully!", pRepo->config.tsdbId);
return (TsdbRepoT *)pRepo; return (TsdbRepoT *)pRepo;
} }
...@@ -256,6 +261,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) { ...@@ -256,6 +261,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
int32_t tsdbCloseRepo(TsdbRepoT *repo) { int32_t tsdbCloseRepo(TsdbRepoT *repo) {
STsdbRepo *pRepo = (STsdbRepo *)repo; STsdbRepo *pRepo = (STsdbRepo *)repo;
if (pRepo == NULL) return 0; if (pRepo == NULL) return 0;
int id = pRepo->config.tsdbId;
pRepo->state = TSDB_REPO_STATE_CLOSED; pRepo->state = TSDB_REPO_STATE_CLOSED;
tsdbLockRepo(repo); tsdbLockRepo(repo);
...@@ -289,6 +295,8 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) { ...@@ -289,6 +295,8 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) {
tfree(pRepo->rootDir); tfree(pRepo->rootDir);
tfree(pRepo); tfree(pRepo);
tsdbTrace("vgId: %d repository is closed!", id);
return 0; return 0;
} }
...@@ -349,6 +357,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) { ...@@ -349,6 +357,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) {
pthread_attr_init(&thattr); pthread_attr_init(&thattr);
pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED);
pthread_create(&(pRepo->commitThread), &thattr, tsdbCommitData, (void *)repo); pthread_create(&(pRepo->commitThread), &thattr, tsdbCommitData, (void *)repo);
tsdbTrace("vgId: %d start to commit!", pRepo->config.tsdbId);
return 0; return 0;
} }
...@@ -376,11 +385,6 @@ STsdbRepoInfo *tsdbGetStatus(TsdbRepoT *pRepo) { ...@@ -376,11 +385,6 @@ STsdbRepoInfo *tsdbGetStatus(TsdbRepoT *pRepo) {
return NULL; return NULL;
} }
int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
STsdbRepo *pRepo = (STsdbRepo *)repo;
return tsdbCreateTableImpl(pRepo->tsdbMeta, pCfg);
}
int tsdbAlterTable(TsdbRepoT *pRepo, STableCfg *pCfg) { int tsdbAlterTable(TsdbRepoT *pRepo, STableCfg *pCfg) {
// TODO // TODO
return 0; return 0;
...@@ -395,13 +399,6 @@ TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid) { ...@@ -395,13 +399,6 @@ TSKEY tsdbGetTableLastKey(TsdbRepoT *repo, int64_t uid) {
return TSDB_GET_TABLE_LAST_KEY(pTable); return TSDB_GET_TABLE_LAST_KEY(pTable);
} }
int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
if (repo == NULL) return -1;
STsdbRepo *pRepo = (STsdbRepo *)repo;
return tsdbDropTableImpl(pRepo->tsdbMeta, tableId);
}
STableInfo *tsdbGetTableInfo(TsdbRepoT *pRepo, STableId tableId) { STableInfo *tsdbGetTableInfo(TsdbRepoT *pRepo, STableId tableId) {
// TODO // TODO
return NULL; return NULL;
...@@ -756,12 +753,12 @@ static int32_t tsdbSetRepoEnv(STsdbRepo *pRepo) { ...@@ -756,12 +753,12 @@ static int32_t tsdbSetRepoEnv(STsdbRepo *pRepo) {
if (tsdbGetDataDirName(pRepo, dirName) < 0) return -1; if (tsdbGetDataDirName(pRepo, dirName) < 0) return -1;
if (mkdir(dirName, 0755) < 0) { if (mkdir(dirName, 0755) < 0) {
tsdbError("id %d: failed to create repository directory! reason %s", pRepo->config.tsdbId, strerror(errno)); tsdbError("vgId: %d failed to create repository directory! reason %s", pRepo->config.tsdbId, strerror(errno));
return -1; return -1;
} }
tsdbError( tsdbTrace(
"id %d: set up tsdb environment succeed! cacheBlockSize %d, totalBlocks %d, maxTables %d, daysPerFile %d, keep " "vgId: %d set up tsdb environment succeed! cacheBlockSize %d, totalBlocks %d, maxTables %d, daysPerFile %d, keep "
"%d, minRowsPerFileBlock %d, maxRowsPerFileBlock %d, precision %d, compression%d", "%d, minRowsPerFileBlock %d, maxRowsPerFileBlock %d, precision %d, compression%d",
pRepo->config.tsdbId, pCfg->cacheBlockSize, pCfg->totalBlocks, pCfg->maxTables, pCfg->daysPerFile, pCfg->keep, pRepo->config.tsdbId, pCfg->cacheBlockSize, pCfg->totalBlocks, pCfg->maxTables, pCfg->daysPerFile, pCfg->keep,
pCfg->minRowsPerFileBlock, pCfg->maxRowsPerFileBlock, pCfg->precision, pCfg->compression); pCfg->minRowsPerFileBlock, pCfg->maxRowsPerFileBlock, pCfg->precision, pCfg->compression);
...@@ -842,6 +839,9 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable ...@@ -842,6 +839,9 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
pTable->mem->numOfPoints = tSkipListGetSize(pTable->mem->pData); pTable->mem->numOfPoints = tSkipListGetSize(pTable->mem->pData);
tsdbTrace("vgId: %d, tid: %d, uid: " PRId64 "a row is inserted to table! key" PRId64,
pRepo->config.tsdbId, pTable->tableId.tid, pTable->tableId.uid, dataRowKey(row));
return 0; return 0;
} }
...@@ -1104,11 +1104,14 @@ static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minK ...@@ -1104,11 +1104,14 @@ static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minK
} }
static void tsdbAlterCompression(STsdbRepo *pRepo, int8_t compression) { static void tsdbAlterCompression(STsdbRepo *pRepo, int8_t compression) {
int8_t oldCompRession = pRepo->config.compression;
pRepo->config.compression = compression; pRepo->config.compression = compression;
tsdbTrace("vgId: %d tsdb compression is changed from %d to %d", oldCompRession, compression);
} }
static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
STsdbCfg *pCfg = &pRepo->config; STsdbCfg *pCfg = &pRepo->config;
int oldKeep = pCfg->keep;
int maxFiles = keep / pCfg->maxTables + 3; int maxFiles = keep / pCfg->maxTables + 3;
if (pRepo->config.keep > keep) { if (pRepo->config.keep > keep) {
...@@ -1120,8 +1123,57 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) { ...@@ -1120,8 +1123,57 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
} }
pRepo->tsdbFileH->maxFGroups = maxFiles; pRepo->tsdbFileH->maxFGroups = maxFiles;
} }
tsdbTrace("vgId: %d keep is changed from %d to %d", pRepo->config.tsdbId, oldKeep, keep);
} }
static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) { static void tsdbAlterMaxTables(STsdbRepo *pRepo, int32_t maxTables) {
// TODO // TODO
int oldMaxTables = pRepo->config.maxTables;
tsdbTrace("vgId: %d tsdb maxTables is changed from %d to %d!", pRepo->config.tsdbId, oldMaxTables, maxTables);
}
uint32_t tsdbGetFileInfo(TsdbRepoT *repo, char *name, uint32_t *index, int32_t *size) {
// TODO: need to refactor this function
STsdbRepo *pRepo = (STsdbRepo *)repo;
// STsdbMeta *pMeta = pRepo->tsdbMeta;
STsdbFileH *pFileH = pRepo->tsdbFileH;
uint32_t magic = 0;
char fname[256] = "\0";
struct stat fState;
char *spath = strdup(pRepo->rootDir);
char *prefixDir = dirname(spath);
if (name[0] == 0) {
// Map index to the file name
int fid = (*index) / 3;
if (fid > pFileH->numOfFGroups) {
// return meta data file
if ((*index) % 3 > 0) { // it is finished
tfree(spath);
return 0;
} else {
tsdbGetMetaFileName(pRepo->rootDir, fname);
}
} else {
// return data file name
strcpy(fname, pFileH->fGroup[fid].files[(*index) % 3].fname);
}
strcpy(name, fname + strlen(spath));
} else {
// Name is provided, need to get the file info
sprintf(fname, "%s/%s", prefixDir, name);
}
if (stat(fname, &fState) < 0) {
tfree(spath);
return 0;
}
*size = fState.st_size;
magic = *size;
return magic;
} }
\ No newline at end of file
...@@ -283,7 +283,10 @@ char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes) { ...@@ -283,7 +283,10 @@ char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes) {
} }
} }
int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) { int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
STsdbRepo *pRepo = (STsdbRepo *)repo;
STsdbMeta *pMeta = pRepo->tsdbMeta;
if (tsdbCheckTableCfg(pCfg) < 0) return -1; if (tsdbCheckTableCfg(pCfg) < 0) return -1;
STable *super = NULL; STable *super = NULL;
...@@ -351,8 +354,14 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) { ...@@ -351,8 +354,14 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) {
} }
// Register to meta // Register to meta
if (newSuper) tsdbAddTableToMeta(pMeta, super, true); if (newSuper) {
tsdbAddTableToMeta(pMeta, super, true);
tsdbTrace("vgId: %d super table is created! uid " PRId64, pRepo->config.tsdbId,
super->tableId.uid);
}
tsdbAddTableToMeta(pMeta, table, true); tsdbAddTableToMeta(pMeta, table, true);
tsdbTrace("vgId: %d table is created! tid %d, uid " PRId64, pRepo->config.tsdbId, table->tableId.tid,
table->tableId.uid);
// Write to meta file // Write to meta file
int bufLen = 0; int bufLen = 0;
...@@ -385,13 +394,24 @@ STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId) { ...@@ -385,13 +394,24 @@ STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId) {
return pTable; return pTable;
} }
int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId) { // int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId) {
int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
STsdbRepo *pRepo = (STsdbRepo *)repo;
if (pRepo == NULL) return -1;
STsdbMeta *pMeta = pRepo->tsdbMeta;
if (pMeta == NULL) return -1; if (pMeta == NULL) return -1;
STable *pTable = tsdbGetTableByUid(pMeta, tableId.uid); STable *pTable = tsdbGetTableByUid(pMeta, tableId.uid);
if (pTable == NULL) return -1; if (pTable == NULL) {
tsdbError("vgId %d: failed to drop table since table not exists! tid %d, uid " PRId64, pRepo->config.tsdbId,
tableId.tid, tableId.uid);
return -1;
}
tsdbTrace("vgId: %d table is dropped! tid %d, uid " PRId64, pRepo->config.tsdbId, tableId.tid, tableId.uid);
if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1; if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1;
return 0; return 0;
} }
...@@ -483,7 +503,9 @@ static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) { ...@@ -483,7 +503,9 @@ static int tsdbRemoveTableFromMeta(STsdbMeta *pMeta, STable *pTable) {
if (pTable->type == TSDB_SUPER_TABLE) { if (pTable->type == TSDB_SUPER_TABLE) {
SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex); SSkipListIterator *pIter = tSkipListCreateIter(pTable->pIndex);
while (tSkipListIterNext(pIter)) { while (tSkipListIterNext(pIter)) {
STable *tTable = *(STable **)SL_GET_NODE_DATA(tSkipListIterGet(pIter)); STableIndexElem *pEle = (STableIndexElem *)SL_GET_NODE_DATA(tSkipListIterGet(pIter));
STable *tTable = pEle->pTable;
ASSERT(tTable != NULL && tTable->type == TSDB_CHILD_TABLE); ASSERT(tTable != NULL && tTable->type == TSDB_CHILD_TABLE);
pMeta->tables[tTable->tableId.tid] = NULL; pMeta->tables[tTable->tableId.tid] = NULL;
......
...@@ -28,7 +28,7 @@ typedef struct { ...@@ -28,7 +28,7 @@ typedef struct {
int64_t uid; int64_t uid;
} SRecordInfo; } SRecordInfo;
static int32_t tsdbGetMetaFileName(char *rootDir, char *fname); // static int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
// static int32_t tsdbCheckMetaHeader(int fd); // static int32_t tsdbCheckMetaHeader(int fd);
static int32_t tsdbWriteMetaHeader(int fd); static int32_t tsdbWriteMetaHeader(int fd);
static int tsdbCreateMetaFile(char *fname); static int tsdbCreateMetaFile(char *fname);
...@@ -180,7 +180,7 @@ void tsdbCloseMetaFile(SMetaFile *mfh) { ...@@ -180,7 +180,7 @@ void tsdbCloseMetaFile(SMetaFile *mfh) {
tfree(mfh); tfree(mfh);
} }
static int32_t tsdbGetMetaFileName(char *rootDir, char *fname) { int32_t tsdbGetMetaFileName(char *rootDir, char *fname) {
if (rootDir == NULL) return -1; if (rootDir == NULL) return -1;
sprintf(fname, "%s/%s", rootDir, TSDB_META_FILE_NAME); sprintf(fname, "%s/%s", rootDir, TSDB_META_FILE_NAME);
return 0; return 0;
......
...@@ -414,6 +414,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheck ...@@ -414,6 +414,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheck
static int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order); static int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order);
static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock, STableCheckInfo* pCheckInfo) { static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock, STableCheckInfo* pCheckInfo) {
STsdbRepo *pRepo = pQueryHandle->pTsdb;
SCompData* data = calloc(1, sizeof(SCompData) + sizeof(SCompCol) * pBlock->numOfCols); SCompData* data = calloc(1, sizeof(SCompData) + sizeof(SCompCol) * pBlock->numOfCols);
data->numOfCols = pBlock->numOfCols; data->numOfCols = pBlock->numOfCols;
...@@ -423,7 +424,7 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo ...@@ -423,7 +424,7 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo
SArray* sa = getDefaultLoadColumns(pQueryHandle, true); SArray* sa = getDefaultLoadColumns(pQueryHandle, true);
if (pCheckInfo->pDataCols == NULL) { if (pCheckInfo->pDataCols == NULL) {
pCheckInfo->pDataCols = tdNewDataCols(1000, 100, 4096); //todo fix me pCheckInfo->pDataCols = tdNewDataCols(pRepo->tsdbMeta->maxRowBytes, pRepo->tsdbMeta->maxCols, pRepo->config.maxRowsPerFileBlock);
} }
tdInitDataCols(pCheckInfo->pDataCols, tsdbGetTableSchema(tsdbGetMeta(pQueryHandle->pTsdb), pCheckInfo->pTableObj)); tdInitDataCols(pCheckInfo->pDataCols, tsdbGetTableSchema(tsdbGetMeta(pQueryHandle->pTsdb), pCheckInfo->pTableObj));
......
...@@ -49,6 +49,7 @@ typedef struct { ...@@ -49,6 +49,7 @@ typedef struct {
STsdbCfg tsdbCfg; STsdbCfg tsdbCfg;
SSyncCfg syncCfg; SSyncCfg syncCfg;
SWalCfg walCfg; SWalCfg walCfg;
char * rootDir;
} SVnodeObj; } SVnodeObj;
int vnodeWriteToQueue(void *param, void *pHead, int type); int vnodeWriteToQueue(void *param, void *pHead, int type);
......
...@@ -182,6 +182,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { ...@@ -182,6 +182,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
pVnode->refCount = 1; pVnode->refCount = 1;
pVnode->version = 0; pVnode->version = 0;
pVnode->tsdbCfg.tsdbId = pVnode->vgId; pVnode->tsdbCfg.tsdbId = pVnode->vgId;
pVnode->rootDir = strdup(rootDir);
taosAddIntHash(tsDnodeVnodesHash, pVnode->vgId, (char *)(&pVnode)); taosAddIntHash(tsDnodeVnodesHash, pVnode->vgId, (char *)(&pVnode));
int32_t code = vnodeReadCfg(pVnode); int32_t code = vnodeReadCfg(pVnode);
...@@ -271,6 +272,7 @@ void vnodeRelease(void *pVnodeRaw) { ...@@ -271,6 +272,7 @@ void vnodeRelease(void *pVnodeRaw) {
return; return;
} }
tfree(pVnode->rootDir);
// remove read queue // remove read queue
dnodeFreeRqueue(pVnode->rqueue); dnodeFreeRqueue(pVnode->rqueue);
pVnode->rqueue = NULL; pVnode->rqueue = NULL;
...@@ -288,7 +290,7 @@ void vnodeRelease(void *pVnodeRaw) { ...@@ -288,7 +290,7 @@ void vnodeRelease(void *pVnodeRaw) {
free(pVnode); free(pVnode);
int32_t count = atomic_sub_fetch_32(&tsOpennedVnodes, 1); int32_t count = atomic_sub_fetch_32(&tsOpennedVnodes, 1);
vTrace("vgId:%d, vnode is released, vnodes:%d", pVnode, vgId, count); vTrace("vgId:%d, vnode is released, vnodes:%d", vgId, count);
if (count <= 0) { if (count <= 0) {
taosCleanUpIntHash(tsDnodeVnodesHash); taosCleanUpIntHash(tsDnodeVnodesHash);
...@@ -383,9 +385,8 @@ static int vnodeWalCallback(void *arg) { ...@@ -383,9 +385,8 @@ static int vnodeWalCallback(void *arg) {
} }
static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size) { static uint32_t vnodeGetFileInfo(void *ahandle, char *name, uint32_t *index, int32_t *size) {
// SVnodeObj *pVnode = ahandle; SVnodeObj *pVnode = ahandle;
//tsdbGetFileInfo(pVnode->tsdb, name, index, size); return tsdbGetFileInfo(pVnode->tsdb, name, index, size);
return 0;
} }
static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index) { static int vnodeGetWalInfo(void *ahandle, char *name, uint32_t *index) {
...@@ -405,9 +406,17 @@ static void vnodeNotifyRole(void *ahandle, int8_t role) { ...@@ -405,9 +406,17 @@ static void vnodeNotifyRole(void *ahandle, int8_t role) {
static void vnodeNotifyFileSynced(void *ahandle) { static void vnodeNotifyFileSynced(void *ahandle) {
SVnodeObj *pVnode = ahandle; SVnodeObj *pVnode = ahandle;
vTrace("pVnode:%p vgId:%d, data file is synced", pVnode, pVnode->vgId); vTrace("vgId:%d, data file is synced", pVnode->vgId);
char rootDir[128] = "\0";
sprintf(rootDir, "%s/tsdb", pVnode->rootDir);
// clsoe tsdb, then open tsdb // clsoe tsdb, then open tsdb
tsdbCloseRepo(pVnode->tsdb);
STsdbAppH appH = {0};
appH.appH = (void *)pVnode;
appH.walCallBack = vnodeWalCallback;
appH.cqH = pVnode->cq;
pVnode->tsdb = tsdbOpenRepo(rootDir, &appH);
} }
static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) { static int32_t vnodeSaveCfg(SMDCreateVnodeMsg *pVnodeCfg) {
......
...@@ -65,7 +65,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont ...@@ -65,7 +65,7 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, void *pCont, int32_t cont
pRet->len = sizeof(SQueryTableRsp); pRet->len = sizeof(SQueryTableRsp);
pRet->rsp = pRsp; pRet->rsp = pRsp;
vTrace("vgId:%d QInfo:%p, dnode query msg disposed", pVnode->vgId, pQInfo); vTrace("vgId:%d, QInfo:%p, dnode query msg disposed", pVnode->vgId, pQInfo);
} else { } else {
pQInfo = pCont; pQInfo = pCont;
code = TSDB_CODE_ACTION_IN_PROGRESS; code = TSDB_CODE_ACTION_IN_PROGRESS;
...@@ -83,7 +83,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t cont ...@@ -83,7 +83,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t cont
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
vTrace("vgId:%d QInfo:%p, retrieve msg is received", pVnode->vgId, pQInfo); vTrace("vgId:%d, QInfo:%p, retrieve msg is received", pVnode->vgId, pQInfo);
pRet->code = qRetrieveQueryResultInfo(pQInfo); pRet->code = qRetrieveQueryResultInfo(pQInfo);
if (pRet->code != TSDB_CODE_SUCCESS) { if (pRet->code != TSDB_CODE_SUCCESS) {
...@@ -104,6 +104,6 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t cont ...@@ -104,6 +104,6 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, void *pCont, int32_t cont
} }
} }
vTrace("vgId:%d QInfo:%p, retrieve msg is disposed", pVnode->vgId, pQInfo); vTrace("vgId:%d, QInfo:%p, retrieve msg is disposed", pVnode->vgId, pQInfo);
return code; return code;
} }
...@@ -51,10 +51,7 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { ...@@ -51,10 +51,7 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
if (vnodeProcessWriteMsgFp[pHead->msgType] == NULL) if (vnodeProcessWriteMsgFp[pHead->msgType] == NULL)
return TSDB_CODE_MSG_NOT_PROCESSED; return TSDB_CODE_MSG_NOT_PROCESSED;
if (pVnode->status != TAOS_VN_STATUS_READY && qtype == TAOS_QTYPE_RPC) if (pHead->version == 0) { // from client or CQ
return TSDB_CODE_NOT_ACTIVE_VNODE;
if (pHead->version == 0) { // from client
if (pVnode->status != TAOS_VN_STATUS_READY) if (pVnode->status != TAOS_VN_STATUS_READY)
return TSDB_CODE_NOT_ACTIVE_VNODE; return TSDB_CODE_NOT_ACTIVE_VNODE;
...@@ -64,12 +61,10 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { ...@@ -64,12 +61,10 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
// assign version // assign version
pVnode->version++; pVnode->version++;
pHead->version = pVnode->version; pHead->version = pVnode->version;
} else { } else { // from wal or forward
// for data from WAL or forward, version may be smaller // for data from WAL or forward, version may be smaller
if (pHead->version <= pVnode->version) return 0; if (pHead->version <= pVnode->version) return 0;
} }
// more status and role checking here
pVnode->version = pHead->version; pVnode->version = pHead->version;
...@@ -77,9 +72,13 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { ...@@ -77,9 +72,13 @@ int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) {
code = walWrite(pVnode->wal, pHead); code = walWrite(pVnode->wal, pHead);
if (code < 0) return code; if (code < 0) return code;
int32_t syncCode = syncForwardToPeer(pVnode->sync, pHead, item); // forward to peers if data is from RPC or CQ
int32_t syncCode = 0;
if (qtype == TAOS_QTYPE_RPC || qtype == TAOS_QTYPE_CQ)
syncCode = syncForwardToPeer(pVnode->sync, pHead, item);
if (syncCode < 0) return syncCode; if (syncCode < 0) return syncCode;
// write data locally
code = (*vnodeProcessWriteMsgFp[pHead->msgType])(pVnode, pHead->cont, item); code = (*vnodeProcessWriteMsgFp[pHead->msgType])(pVnode, pHead->cont, item);
if (code < 0) return code; if (code < 0) return code;
......
...@@ -84,4 +84,7 @@ python3 ./test.py $1 -f import_merge/importTRestart.py ...@@ -84,4 +84,7 @@ python3 ./test.py $1 -f import_merge/importTRestart.py
# user # user
python3 ./test.py $1 -f user/user_create.py python3 ./test.py $1 -f user/user_create.py
python3 ./test.py $1 -f user/pass_len.py python3 ./test.py $1 -f user/pass_len.py
\ No newline at end of file
# table
#python3 ./test.py $1 -f table/del_stable.py
\ No newline at end of file
...@@ -46,16 +46,16 @@ class TDTestCase: ...@@ -46,16 +46,16 @@ class TDTestCase:
self.maxrows) self.maxrows)
tdLog.info("================= step2") tdLog.info("================= step2")
tdLog.info("import %d sequential data" % (self.maxrows / 2)) tdLog.info("import %d sequential data" % (self.maxrows // 2))
startTime = self.startTime startTime = self.startTime
sqlcmd = ['import into tb1 values'] sqlcmd = ['import into tb1 values']
for rid in range(1, self.maxrows / 2 + 1): for rid in range(1, self.maxrows // 2 + 1):
sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) sqlcmd.append('(%ld, %d)' % (startTime + rid, rid))
tdSql.execute(" ".join(sqlcmd)) tdSql.execute(" ".join(sqlcmd))
tdLog.info("================= step3") tdLog.info("================= step3")
tdSql.query('select * from tb1') tdSql.query('select * from tb1')
tdSql.checkRows(self.maxrows / 2) tdSql.checkRows(self.maxrows // 2)
tdLog.info("================= step4") tdLog.info("================= step4")
tdDnodes.stop(1) tdDnodes.stop(1)
...@@ -70,7 +70,7 @@ class TDTestCase: ...@@ -70,7 +70,7 @@ class TDTestCase:
tdLog.info("================= step7") tdLog.info("================= step7")
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.query('select * from tb1 order by ts desc') tdSql.query('select * from tb1 order by ts desc')
tdSql.checkRows(self.maxrows / 2 + 1) tdSql.checkRows(self.maxrows // 2 + 1)
tdLog.info("================= step8") tdLog.info("================= step8")
tdLog.info("import 10 data in batch before") tdLog.info("import 10 data in batch before")
...@@ -83,7 +83,7 @@ class TDTestCase: ...@@ -83,7 +83,7 @@ class TDTestCase:
tdLog.info("================= step9") tdLog.info("================= step9")
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.query('select * from tb1 order by ts desc') tdSql.query('select * from tb1 order by ts desc')
tdSql.checkRows(self.maxrows / 2 + 11) tdSql.checkRows(self.maxrows // 2 + 11)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -27,7 +27,7 @@ class TDTestCase: ...@@ -27,7 +27,7 @@ class TDTestCase:
def run(self): def run(self):
self.ntables = 1 self.ntables = 1
self.startTime = 1520000010000 self.startTime = 1520000010000
self.maxwrows = 200 self.maxrows = 200
self.rowsPerTable = 20 self.rowsPerTable = 20
tdDnodes.stop(1) tdDnodes.stop(1)
......
...@@ -46,16 +46,17 @@ class TDTestCase: ...@@ -46,16 +46,17 @@ class TDTestCase:
self.maxrows) self.maxrows)
tdLog.info("================= step2") tdLog.info("================= step2")
tdLog.info("import %d sequential data" % (self.maxrows / 2)) tdLog.info("import %d sequential data" % (self.maxrows // 2))
startTime = self.startTime startTime = self.startTime
sqlcmd = ['import into tb1 values'] sqlcmd = ['import into tb1 values']
for rid in range(1, self.maxrows / 2 + 1): for rid in range(1, self.maxrows // 2 + 1):
sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) sqlcmd.append('(%ld, %d)' % (startTime + rid, rid))
tdSql.execute(" ".join(sqlcmd)) tdSql.execute(" ".join(sqlcmd))
tdLog.info("================= step3") tdLog.info("================= step3")
tdSql.query('select * from tb1') tdSql.query('select * from tb1')
tdSql.checkRows(self.maxrows / 2) tdSql.checkRows(self.maxrows // 2)
tdLog.info("================= step4") tdLog.info("================= step4")
tdDnodes.stop(1) tdDnodes.stop(1)
...@@ -73,7 +74,7 @@ class TDTestCase: ...@@ -73,7 +74,7 @@ class TDTestCase:
tdLog.info("================= step9") tdLog.info("================= step9")
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.query('select * from tb1 order by ts desc') tdSql.query('select * from tb1 order by ts desc')
tdSql.checkRows(self.maxrows / 2) tdSql.checkRows(self.maxrows // 2)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -33,7 +33,7 @@ class TDTestCase: ...@@ -33,7 +33,7 @@ class TDTestCase:
tdDnodes.start(1) tdDnodes.start(1)
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512 tables 10') tdSql.execute('create database db cache 512 maxtables 10')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")
......
...@@ -29,88 +29,17 @@ python3 ./test.py $1 -s && sleep 1 ...@@ -29,88 +29,17 @@ python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/db_table.py python3 ./test.py $1 -f table/db_table.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastTO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataTO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHeadOverlap.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHORestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHPORestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHRestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importLastSub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1HO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1HPO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1H.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1S.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1Sub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1TO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1TPO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1T.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2HO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2HPO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2H.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2S.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2Sub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2TO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2TPO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2T.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlockbetween.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileSub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileTO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileT.py python3 ./test.py $1 -f import_merge/importCacheFileT.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastSub.py python3 ./test.py $1 -f import_merge/importDataLastSub.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHead.py python3 ./test.py $1 -f import_merge/importHead.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importLastTO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importLastT.py python3 ./test.py $1 -f import_merge/importLastT.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importSpan.py python3 ./test.py $1 -f import_merge/importSpan.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importSRestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importSubRestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTailOverlap.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTail.py python3 ./test.py $1 -f import_merge/importTail.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTORestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTPORestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTRestart.py python3 ./test.py $1 -f import_merge/importTRestart.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import taos
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
class TDTestCase:
def init(self, conn):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
def run(self):
tdSql.prepare()
tdSql.execute("drop database if exists db")
print("==============step1")
tdSql.execute("create database db")
tdSql.execute("create table db.st (ts timestamp, i int) tags(j int)")
tdSql.execute("create table db.tb using st tags(1)")
tdSql.execute("insert into db.tb values(now, 1)")
print("==============step2")
try:
tdSql.execute("drop table db.st")
except Exception as e:
tdLog.exit(e)
tdSql.execute("select * from db.st")
tdSql.checkRows(1)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -201,8 +201,8 @@ class TDDnode: ...@@ -201,8 +201,8 @@ class TDDnode:
self.running = 1 self.running = 1
tdLog.debug("dnode:%d is running with %s " % (self.index, cmd)) tdLog.debug("dnode:%d is running with %s " % (self.index, cmd))
tdLog.debug("wait 2 seconds for the dnode:%d to start." % (self.index)) tdLog.debug("wait 4 seconds for the dnode:%d to start." % (self.index))
time.sleep(2) time.sleep(4)
def stop(self): def stop(self):
if self.valgrind == 0: if self.valgrind == 0:
......
#!/bin/bash
python3 ./test.py $1 -f insert/basic.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/int.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/float.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/bigint.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/bool.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/double.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/smallint.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/tinyint.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/binary.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/date.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/nchar.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/column_name.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/column_num.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/db_table.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastSub.py
python3 ./test.py $1 -s && sleep 1
#################################
run general/cache/new_metrics.sim run general/cache/new_metrics.sim
run general/compress/compress.sim run general/compress/compress.sim
run general/compute/avg.sim run general/compute/avg.sim
run general/compute/bottom.sim
run general/compute/count.sim run general/compute/count.sim
run general/db/len.sim run general/db/len.sim
run general/db/basic4.sim run general/db/basic4.sim
run general/http/restful_insert.sim run general/http/restful_insert.sim
run general/import/basic.sim run general/import/basic.sim
run general/import/commit.sim run general/import/commit.sim
run general/insert/basic.sim
run general/insert/query_file_memory.sim run general/insert/query_file_memory.sim
run general/parser/binary_escapeCharacter.sim run general/parser/binary_escapeCharacter.sim
run general/parser/columnValue_bigint.sim
run general/parser/select_from_cache_disk.sim run general/parser/select_from_cache_disk.sim
run general/table/autocreate.sim run general/table/autocreate.sim
run general/table/basic3.sim
run general/table/column_name.sim run general/table/column_name.sim
run general/table/int.sim run general/table/int.sim
run general/table/vgroup.sim run general/table/vgroup.sim
run general/user/basic1.sim run general/user/basic1.sim
run general/user/pass_alter.sim run general/user/pass_alter.sim
run general/user/user_len.sim
run general/vector/single.sim run general/vector/single.sim
################################## #run general/connection/connection.sim
run general/user/authority.sim
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql connect
print ============= step1
sql close
print close1
sql connect
print ============= step2
sql close
sql connect
print ============= step3
sql close
sql connect write
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -26,9 +26,11 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4 ...@@ -26,9 +26,11 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
print ========= start dnodes print ========= start dnodes
sleep 2000
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000 sleep 3000
sql connect sql connect
sql reset query cache
print ======== step1 print ======== step1
sql create database d1 replica 1 sql create database d1 replica 1
......
run general//db/basic.sim run general/db/basic.sim
run general/db/basic1.sim run general/db/basic1.sim
run general/db/basic2.sim run general/db/basic2.sim
run general/db/basic3.sim run general/db/basic3.sim
...@@ -13,3 +13,4 @@ run general/db/delete_writing2.sim ...@@ -13,3 +13,4 @@ run general/db/delete_writing2.sim
run general/db/len.sim run general/db/len.sim
run general/db/repeat.sim run general/db/repeat.sim
run general/db/tables.sim run general/db/tables.sim
run general/db/vnodes.sim
system sh/stop_dnodes.sh
$totalVnodes = 10
$maxTables = 4
$totalRows = $totalVnodes * $maxTables
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $maxTables
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v $totalVnodes
system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 100000
system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 100000
system sh/cfg.sh -n dnode1 -c maxShellConns -v 100000
system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 100000
print ========== prepare data
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql connect
sql create database db blocks 2 cache 1 maxTables $maxTables
sql use db
print ========== step1
sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int)
$x = 0
while $x < $totalRows
$tb = t . $x
sql create table $tb using mt tags( $x )
sql insert into $tb values (now, $x )
$x = $x + 1
endw
print ========== step2
sql select * from mt
if $rows != $totalRows then
return -1
endi
sql select count(*) from mt
if $data00 != $totalRows then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -157,25 +157,25 @@ endi ...@@ -157,25 +157,25 @@ endi
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query
print 16-> $system_content print 16-> $system_content
if $system_content != @[{"refId":"A","target":"1","datapoints":[[5,"-"]]},{"refId":"A","target":"2","datapoints":[[4,"-"]]},{"refId":"A","target":"3","datapoints":[[3,"-"]]},{"refId":"B","target":"a","datapoints":[[5,"-"]]},{"refId":"B","target":"b","datapoints":[[8,"-"]]},{"refId":"B","target":"c","datapoints":[[9,"-"]]}]@ then if $system_content != @[{"refId":"A","target":"{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"{b:c}","datapoints":[[9,"-"]]}]@ then
return -1 return -1
endi endi
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query
print 17-> $system_content print 17-> $system_content
if $system_content != @[{"refId":"A","target":"count1","datapoints":[[5,"-"]]},{"refId":"A","target":"count2","datapoints":[[4,"-"]]},{"refId":"A","target":"count3","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-a","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-b","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-c","datapoints":[[9,"-"]]}]@ then if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"count{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"count{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-{b:c}","datapoints":[[9,"-"]]}]@ then
return -1 return -1
endi endi
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]' 127.0.0.1:6020/grafana/query system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]' 127.0.0.1:6020/grafana/query
print 18-> $system_content print 18-> $system_content
if $system_content != @[{"refId":"A","target":"count1","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count2","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count3","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count{a:2,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count{a:3,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then
return -1 return -1
endi endi
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query
print 19-> $system_content print 19-> $system_content
if $system_content != @[{"refId":"A","target":"3","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"15.299999714","datapoints":[[3,"-"]]}]@ then if $system_content != @[{"refId":"A","target":"{count(v1):3}","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"{sum(v2):15.299999714}","datapoints":[[3,"-"]]}]@ then
return -1 return -1
endi endi
......
...@@ -43,7 +43,7 @@ print ====== tables created ...@@ -43,7 +43,7 @@ print ====== tables created
print ================== restart server to commit data into disk print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 2000 sleep 3000
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
...@@ -69,7 +69,7 @@ endw ...@@ -69,7 +69,7 @@ endw
print ================== restart server to commit data into disk print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 2000 sleep 4000
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
......
...@@ -238,3 +238,5 @@ sql show databases ...@@ -238,3 +238,5 @@ sql show databases
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -39,4 +39,4 @@ sql alter table tb1 set tag len = 379 ...@@ -39,4 +39,4 @@ sql alter table tb1 set tag len = 379
# test end # test end
sql drop database $db sql drop database $db
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 2
...@@ -96,25 +94,25 @@ $ts1 = $ts0 + 1000 ...@@ -96,25 +94,25 @@ $ts1 = $ts0 + 1000
$ts2 = $ts0 + 2000 $ts2 = $ts0 + 2000
sql insert into tb_1 using $stb tags (-1) values ( $ts1 , 1,1,1,1,'bin',1,1,1,'涛思数据') ( $ts2 , 2,2,2,2,'binar', 1,1,1,'nchar') sql insert into tb_1 using $stb tags (-1) values ( $ts1 , 1,1,1,1,'bin',1,1,1,'涛思数据') ( $ts2 , 2,2,2,2,'binar', 1,1,1,'nchar')
sql select * from $stb sql select * from $stb
if $rows != 3 then if $rows != 5 then
return -1 return -1
endi endi
if $data19 != 涛思数据 then if $data09 != 涛思数据 then
return -1 return -1
endi endi
if $data11 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data22 != 2 then if $data42 != 2 then
return -2 return -2
endi endi
if $data23 != 2.00000 then if $data43 != 2.00000 then
return -1 return -1
endi endi
if $data25 != binar then if $data45 != binar then
return -1 return -1
endi endi
if $data29 != nchar then if $data49 != nchar then
return -1 return -1
endi endi
sql drop table tb_1 sql drop table tb_1
...@@ -127,22 +125,22 @@ sql select * from $stb ...@@ -127,22 +125,22 @@ sql select * from $stb
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
if $data19 != 涛思数据 then if $data09 != 涛思数据 then
return -1 return -1
endi endi
if $data11 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data22 != 2 then if $data42 != 2 then
return -2 return -2
endi endi
if $data23 != 2.00000 then if $data43 != 2.00000 then
return -1 return -1
endi endi
if $data25 != binar then if $data45 != binar then
return -1 return -1
endi endi
if $data29 != nchar then if $data49 != nchar then
return -1 return -1
endi endi
...@@ -154,13 +152,13 @@ sql show tables ...@@ -154,13 +152,13 @@ sql show tables
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data00 != tb3 then if $data00 != tb1 then
return -1 return -1
endi endi
if $data10 != tb2 then if $data10 != tb2 then
return -1 return -1
endi endi
if $data20 != tb1 then if $data20 != tb3 then
return -1 return -1
endi endi
...@@ -222,13 +220,13 @@ sql show tables ...@@ -222,13 +220,13 @@ sql show tables
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data00 != tb3 then if $data00 != tb1 then
return -1 return -1
endi endi
if $data10 != tb2 then if $data10 != tb2 then
return -1 return -1
endi endi
if $data20 != tb1 then if $data20 != tb3 then
return -1 return -1
endi endi
...@@ -301,6 +299,9 @@ sql_error create table txu using tu tags(0) values(now, 1); ...@@ -301,6 +299,9 @@ sql_error create table txu using tu tags(0) values(now, 1);
#[TBASE-675] #[TBASE-675]
sql insert into tu values(1565971200000, 1) (1565971200000,2) (1565971200001, 3)(1565971200001, 4) sql insert into tu values(1565971200000, 1) (1565971200000,2) (1565971200001, 3)(1565971200001, 4)
sql select * from tu
if $rows != 2 then if $rows != 2 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c commitTime -v 30 system sh/cfg.sh -n dnode1 -c ctime -v 30
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000 sleep 3000
sql connect sql connect
...@@ -22,7 +21,7 @@ $stb = $stbPrefix . $i ...@@ -22,7 +21,7 @@ $stb = $stbPrefix . $i
sql drop database $db -x step1 sql drop database $db -x step1
step1: step1:
sql create database $db maxrows 200 cache 2048 maxTables 4 sql create database $db maxrows 200 cache 2 maxTables 4
print ====== create tables print ====== create tables
sql use $db sql use $db
...@@ -81,3 +80,5 @@ while $x < 100 ...@@ -81,3 +80,5 @@ while $x < 100
$x = $x + 1 $x = $x + 1
print loop $x print loop $x
endw endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -95,9 +95,4 @@ if $data41 != @udp005@ then ...@@ -95,9 +95,4 @@ if $data41 != @udp005@ then
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -42,4 +42,3 @@ sql select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st ...@@ -42,4 +42,3 @@ sql select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts' 127.0.0.1:6020/restful/sql system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts' 127.0.0.1:6020/restful/sql
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -90,3 +90,5 @@ endi ...@@ -90,3 +90,5 @@ endi
#### illegal operations #### illegal operations
sql_error select max(c2*2) from $tb sql_error select max(c2*2) from $tb
sql_error select max(c1-c2) from $tb sql_error select max(c1-c2) from $tb
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -22,15 +22,5 @@ run general/parser/columnValue_bigint.sim ...@@ -22,15 +22,5 @@ run general/parser/columnValue_bigint.sim
run general/parser/columnValue_float.sim run general/parser/columnValue_float.sim
run general/parser/columnValue_double.sim run general/parser/columnValue_double.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -107,3 +107,5 @@ while $loop <= $loops ...@@ -107,3 +107,5 @@ while $loop <= $loops
endi endi
$loop = $loop + 1 $loop = $loop + 1
endw endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -188,3 +188,5 @@ sql show databases ...@@ -188,3 +188,5 @@ sql show databases
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -258,3 +258,5 @@ sql show databases ...@@ -258,3 +258,5 @@ sql show databases
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -188,3 +188,5 @@ sql show databases ...@@ -188,3 +188,5 @@ sql show databases
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -127,5 +127,4 @@ if $rows != 7 then ...@@ -127,5 +127,4 @@ if $rows != 7 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -849,3 +849,5 @@ sql show databases ...@@ -849,3 +849,5 @@ sql show databases
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -430,3 +430,5 @@ sql show databases ...@@ -430,3 +430,5 @@ sql show databases
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -83,3 +83,4 @@ sleep 3000 ...@@ -83,3 +83,4 @@ sleep 3000
run general/parser/first_last_query.sim run general/parser/first_last_query.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -406,4 +406,6 @@ endi ...@@ -406,4 +406,6 @@ endi
if $data97 != @group_tb0@ then if $data97 != @group_tb0@ then
return -1 return -1
endi endi
\ No newline at end of file
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -2,7 +2,7 @@ system sh/stop_dnodes.sh ...@@ -2,7 +2,7 @@ system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c commitTime -v 30 system sh/cfg.sh -n dnode1 -c ctime -v 30
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000 sleep 3000
sql connect sql connect
...@@ -53,3 +53,4 @@ if $data00 != $res then ...@@ -53,3 +53,4 @@ if $data00 != $res then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -2,7 +2,7 @@ system sh/stop_dnodes.sh ...@@ -2,7 +2,7 @@ system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c commitTime -v 30 system sh/cfg.sh -n dnode1 -c ctime -v 30
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000 sleep 3000
sql connect sql connect
...@@ -52,3 +52,4 @@ if $data00 != $res then ...@@ -52,3 +52,4 @@ if $data00 != $res then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -2,7 +2,7 @@ system sh/stop_dnodes.sh ...@@ -2,7 +2,7 @@ system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/cfg.sh -n dnode1 -c walLevel -v 1
system sh/cfg.sh -n dnode1 -c commitTime -v 30 system sh/cfg.sh -n dnode1 -c ctime -v 30
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000 sleep 3000
sql connect sql connect
...@@ -59,3 +59,4 @@ if $data00 != $res then ...@@ -59,3 +59,4 @@ if $data00 != $res then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -34,4 +34,6 @@ endi ...@@ -34,4 +34,6 @@ endi
#system rm -f $inFileName # invalid shell #system rm -f $inFileName # invalid shell
system rm -f ~/data.csv system rm -f ~/data.csv
\ No newline at end of file
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -233,3 +233,4 @@ endi ...@@ -233,3 +233,4 @@ endi
#endi #endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -65,3 +65,5 @@ system sh/exec.sh -n dnode1 -s start ...@@ -65,3 +65,5 @@ system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
run general/parser/interp_test.sim run general/parser/interp_test.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -444,3 +444,5 @@ sql insert into um1 using m2 tags(1) values(1000001, 10)(2000000, 20); ...@@ -444,3 +444,5 @@ sql insert into um1 using m2 tags(1) values(1000001, 10)(2000000, 20);
sql insert into um2 using m2 tags(9) values(1000001, 10)(2000000, 20); sql insert into um2 using m2 tags(9) values(1000001, 10)(2000000, 20);
sql_error select count(*) from m1,m2 where m1.a=m2.a and m1.ts=m2.ts; sql_error select count(*) from m1,m2 where m1.a=m2.a and m1.ts=m2.ts;
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -127,4 +127,6 @@ sql select join_mt0.ts, join_mt1.t1 from join_mt0, join_mt1 where join_mt0.ts=jo ...@@ -127,4 +127,6 @@ sql select join_mt0.ts, join_mt1.t1 from join_mt0, join_mt1 where join_mt0.ts=jo
sql select join_mt0.ts, join_mt1.t1, join_mt0.t1, join_mt1.tbname, join_mt0.tbname from join_mt0, join_mt1 where join_mt0.ts=join_mt1.ts and join_mt0.t1=join_mt1.t1 sql select join_mt0.ts, join_mt1.t1, join_mt0.t1, join_mt1.tbname, join_mt0.tbname from join_mt0, join_mt1 where join_mt0.ts=join_mt1.ts and join_mt0.t1=join_mt1.t1
sql select join_mt0.ts, join_mt1.t1, join_mt0.t1, join_mt1.tbname, join_mt0.tbname from join_mt0, join_mt1 where join_mt0.ts=join_mt1.ts and join_mt0.t1=join_mt1.t1 limit 1 sql select join_mt0.ts, join_mt1.t1, join_mt0.t1, join_mt1.tbname, join_mt0.tbname from join_mt0, join_mt1 where join_mt0.ts=join_mt1.ts and join_mt0.t1=join_mt1.t1 limit 1
\ No newline at end of file
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -68,3 +68,5 @@ sql connect ...@@ -68,3 +68,5 @@ sql connect
sleep 3000 sleep 3000
run general/parser/lastrow_query.sim run general/parser/lastrow_query.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -69,3 +69,5 @@ sleep 3000 ...@@ -69,3 +69,5 @@ sleep 3000
run general/parser/limit_tb.sim run general/parser/limit_tb.sim
run general/parser/limit_stb.sim run general/parser/limit_stb.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -67,3 +67,5 @@ print ================== server restart completed ...@@ -67,3 +67,5 @@ print ================== server restart completed
run general/parser/limit1_tb.sim run general/parser/limit1_tb.sim
run general/parser/limit1_stb.sim run general/parser/limit1_stb.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -67,3 +67,5 @@ print ================== server restart completed ...@@ -67,3 +67,5 @@ print ================== server restart completed
run general/parser/limit1_tb.sim run general/parser/limit1_tb.sim
run general/parser/limit1_stb.sim run general/parser/limit1_stb.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -74,3 +74,5 @@ system sh/exec.sh -n dnode1 -s start ...@@ -74,3 +74,5 @@ system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
run general/parser/limit2_query.sim run general/parser/limit2_query.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -142,3 +142,5 @@ endi ...@@ -142,3 +142,5 @@ endi
if $data03 != 319 then if $data03 != 319 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -310,3 +310,5 @@ endi ...@@ -310,3 +310,5 @@ endi
# if $rows != 0 then # if $rows != 0 then
# return -1 # return -1
# endi # endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -488,3 +488,4 @@ sql_error alter table st51 set tag tag_tinyint = abc379 ...@@ -488,3 +488,4 @@ sql_error alter table st51 set tag tag_tinyint = abc379
#sql drop database $db #sql drop database $db
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -375,4 +375,4 @@ sql_error select 'abc'; ...@@ -375,4 +375,4 @@ sql_error select 'abc';
#=============================tbase-1205 #=============================tbase-1205
sql select count(*) from tm1 where ts<now and ts>= now -1d interval(1h) fill(NULL); sql select count(*) from tm1 where ts<now and ts>= now -1d interval(1h) fill(NULL);
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -5,3 +5,5 @@ while $i <= $loops ...@@ -5,3 +5,5 @@ while $i <= $loops
run general/parser/alter.sim run general/parser/alter.sim
$i = $i + 1 $i = $i + 1
endw endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -5,3 +5,5 @@ while $i <= $repeats ...@@ -5,3 +5,5 @@ while $i <= $repeats
run general/parser/stream.sim run general/parser/stream.sim
$i = $i + 1 $i = $i + 1
endw endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -182,3 +182,5 @@ while $loop <= $loops ...@@ -182,3 +182,5 @@ while $loop <= $loops
endw endw
$loop = $loop + 1 $loop = $loop + 1
endw endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -80,3 +80,5 @@ sql show databases ...@@ -80,3 +80,5 @@ sql show databases
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -68,3 +68,5 @@ endi ...@@ -68,3 +68,5 @@ endi
if $data12 != 1 then if $data12 != 1 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -838,3 +838,5 @@ sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group ...@@ -838,3 +838,5 @@ sql_error select first(c1), count(*), t2, t1, tbname from select_tags_mt0 group
#sql select first(ts), tbname from select_tags_mt0 group by tbname; #sql select first(ts), tbname from select_tags_mt0 group by tbname;
#sql select count(c1) from select_tags_mt0 where c1=99 group by tbname; #sql select count(c1) from select_tags_mt0 where c1=99 group by tbname;
#sql select count(*),tbname from select_tags_mt0 group by tbname #sql select count(*),tbname from select_tags_mt0 group by tbname
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -225,3 +225,5 @@ endi ...@@ -225,3 +225,5 @@ endi
if $data04 != NULL then if $data04 != NULL then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -36,3 +36,5 @@ system sh/exec.sh -n dnode1 -s start ...@@ -36,3 +36,5 @@ system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
run general/parser/single_row_in_tb_query.sim run general/parser/single_row_in_tb_query.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -105,3 +105,5 @@ sql connect ...@@ -105,3 +105,5 @@ sql connect
sleep 3000 sleep 3000
run general/parser/slimit_query.sim run general/parser/slimit_query.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -64,3 +64,5 @@ sql connect ...@@ -64,3 +64,5 @@ sql connect
sleep 3000 sleep 3000
run general/parser/slimit1_query.sim run general/parser/slimit1_query.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -255,3 +255,5 @@ endi ...@@ -255,3 +255,5 @@ endi
#if $rows != 0 then #if $rows != 0 then
# return -1 # return -1
#endi #endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -220,3 +220,5 @@ sql create database $db ...@@ -220,3 +220,5 @@ sql create database $db
sql use $db sql use $db
sql create table stb (ts timestamp, c1 int) tags(t1 int) sql create table stb (ts timestamp, c1 int) tags(t1 int)
sql create table tb1 using stb tags(1) sql create table tb1 using stb tags(1)
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -58,3 +58,5 @@ sql select * from iostrm ...@@ -58,3 +58,5 @@ sql select * from iostrm
if $rows <= 0 then if $rows <= 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -55,4 +55,6 @@ endi ...@@ -55,4 +55,6 @@ endi
#if $data06 != 100.90000 then #if $data06 != 100.90000 then
# print "expect: 100.90000, act: $data06" # print "expect: 100.90000, act: $data06"
# return -1 # return -1
#endi #endi
\ No newline at end of file
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
...@@ -73,3 +73,5 @@ system sh/exec.sh -n dnode1 -s start ...@@ -73,3 +73,5 @@ system sh/exec.sh -n dnode1 -s start
print ================== server restart completed print ================== server restart completed
run general/parser/tbnameIn_query.sim run general/parser/tbnameIn_query.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册