Merge branch 'develop' into feature/2.0tsdb
This commit is contained in:
commit
bba4963681
|
@ -25,6 +25,7 @@
|
|||
#include "tutil.h"
|
||||
#include "tlocale.h"
|
||||
#include "ttimezone.h"
|
||||
#include "tsync.h"
|
||||
|
||||
char configDir[TSDB_FILENAME_LEN] = "/etc/taos";
|
||||
char tsVnodeDir[TSDB_FILENAME_LEN] = {0};
|
||||
|
@ -62,6 +63,7 @@ int64_t tsMsPerDay[] = {86400000L, 86400000000L};
|
|||
|
||||
char tsMaster[TSDB_FQDN_LEN] = {0};
|
||||
char tsSecond[TSDB_FQDN_LEN] = {0};
|
||||
char tsArbitrator[TSDB_FQDN_LEN] = {0};
|
||||
char tsLocalEp[TSDB_FQDN_LEN] = {0}; // Local End Point, hostname:port
|
||||
uint16_t tsServerPort = 6030;
|
||||
uint16_t tsMnodeShellPort = 6030; // udp[6030-6034] tcp[6030]
|
||||
|
@ -141,6 +143,7 @@ int32_t qdebugFlag = 131;
|
|||
int32_t rpcDebugFlag = 131;
|
||||
int32_t uDebugFlag = 131;
|
||||
int32_t debugFlag = 131;
|
||||
int32_t sDebugFlag = 131;
|
||||
|
||||
// the maximum number of results for projection query on super table that are returned from
|
||||
// one virtual node, to order according to timestamp
|
||||
|
@ -341,6 +344,16 @@ static void doInitGlobalConfig() {
|
|||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "arbitrator";
|
||||
cfg.ptr = tsArbitrator;
|
||||
cfg.valType = TAOS_CFG_VTYPE_IPSTR;
|
||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 0;
|
||||
cfg.ptrLength = TSDB_FQDN_LEN;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
// dnode configs
|
||||
cfg.option = "numOfThreadsPerCore";
|
||||
cfg.ptr = &tsNumOfThreadsPerCore;
|
||||
|
@ -1012,6 +1025,16 @@ static void doInitGlobalConfig() {
|
|||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "sDebugFlag";
|
||||
cfg.ptr = &sDebugFlag;
|
||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_LOG;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = 255;
|
||||
cfg.ptrLength = 0;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_NONE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
||||
cfg.option = "sdbDebugFlag";
|
||||
cfg.ptr = &sdbDebugFlag;
|
||||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||
|
|
|
@ -88,12 +88,14 @@ int32_t dnodeInitMClient() {
|
|||
if (strcmp(tsSecond, tsMaster) != 0) {
|
||||
tsMnodeIpSet.numOfIps = 2;
|
||||
taosGetFqdnPortFromEp(tsSecond, tsMnodeIpSet.fqdn[1], &tsMnodeIpSet.port[1]);
|
||||
tsMnodeIpSet.port[0] += TSDB_PORT_MNODEDNODE;
|
||||
}
|
||||
} else {
|
||||
tsMnodeIpSet.inUse = tsMnodeInfos.inUse;
|
||||
tsMnodeIpSet.numOfIps = tsMnodeInfos.nodeNum;
|
||||
for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) {
|
||||
taosGetFqdnPortFromEp(tsMnodeInfos.nodeInfos[i].nodeEp, tsMnodeIpSet.fqdn[i], &tsMnodeIpSet.port[i]);
|
||||
tsMnodeIpSet.port[i] += TSDB_PORT_MNODEDNODE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,6 @@ typedef struct {
|
|||
typedef struct {
|
||||
int8_t quorum; // number of confirms required, >=1
|
||||
int8_t replica; // number of replications, >=1
|
||||
uint16_t arbitratorPort; // arbitrator port
|
||||
char arbitratorFqdn[TSDB_FQDN_LEN]; // arbitrator IP address
|
||||
SNodeInfo nodeInfo[TAOS_SYNC_MAX_REPLICA];
|
||||
} SSyncCfg;
|
||||
|
||||
|
@ -108,6 +106,7 @@ extern int tsMaxWatchFiles;
|
|||
extern int tsSyncTimer;
|
||||
extern int tsMaxFwdInfo;
|
||||
extern int sDebugFlag;
|
||||
extern char tsArbitrator[];
|
||||
extern uint16_t tsSyncPort;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -324,7 +324,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
|
|||
if (pStatus->dnodeId == 0) {
|
||||
mTrace("dnode:%d %s, first access", pDnode->dnodeId, pDnode->dnodeEp);
|
||||
} else {
|
||||
//mTrace("dnode:%d, status received, access times %d", pDnode->dnodeId, pDnode->lastAccess);
|
||||
mTrace("dnode:%d, status received, access times %d", pDnode->dnodeId, pDnode->lastAccess);
|
||||
}
|
||||
|
||||
int32_t openVnodes = htons(pStatus->openVnodes);
|
||||
|
|
|
@ -253,13 +253,7 @@ void sdbUpdateSync() {
|
|||
}
|
||||
|
||||
syncCfg.replica = index;
|
||||
syncCfg.arbitratorPort = syncCfg.nodeInfo[0].nodePort;
|
||||
strcpy(syncCfg.arbitratorFqdn, syncCfg.nodeInfo[0].nodeFqdn);
|
||||
if (syncCfg.replica == 1) {
|
||||
syncCfg.quorum = 1;
|
||||
} else {
|
||||
syncCfg.quorum = 2;
|
||||
}
|
||||
syncCfg.quorum = (syncCfg.replica == 1) ? 1:2;
|
||||
|
||||
bool hasThisDnode = false;
|
||||
for (int32_t i = 0; i < syncCfg.replica; ++i) {
|
||||
|
@ -272,9 +266,9 @@ void sdbUpdateSync() {
|
|||
if (!hasThisDnode) return;
|
||||
if (memcmp(&syncCfg, &tsSdbObj.cfg, sizeof(SSyncCfg)) == 0) return;
|
||||
|
||||
sdbPrint("work as mnode, replica:%d arbitrator:%s", syncCfg.replica, syncCfg.arbitratorFqdn);
|
||||
sdbPrint("work as mnode, replica:%d", syncCfg.replica);
|
||||
for (int32_t i = 0; i < syncCfg.replica; ++i) {
|
||||
sdbPrint("mnode:%d, ip:%s", syncCfg.nodeInfo[i].nodeId, syncCfg.nodeInfo[i].nodeFqdn);
|
||||
sdbPrint("mnode:%d, %s:%d", syncCfg.nodeInfo[i].nodeId, syncCfg.nodeInfo[i].nodeFqdn, syncCfg.nodeInfo[i].nodePort);
|
||||
}
|
||||
|
||||
SSyncInfo syncInfo;
|
||||
|
|
|
@ -431,8 +431,8 @@ static int32_t mgmtSuperTableActionUpdate(SSdbOper *pOper) {
|
|||
void *oldSchema = pTable->schema;
|
||||
memcpy(pTable, pNew, pOper->rowSize);
|
||||
pTable->schema = pNew->schema;
|
||||
free(pNew);
|
||||
free(pNew->vgList);
|
||||
free(pNew);
|
||||
free(oldSchema);
|
||||
}
|
||||
|
||||
|
@ -613,11 +613,18 @@ static void mgmtExtractTableName(char* tableId, char* name) {
|
|||
static void mgmtProcessCreateTableMsg(SQueuedMsg *pMsg) {
|
||||
SCMCreateTableMsg *pCreate = pMsg->pCont;
|
||||
|
||||
if (pMsg->pDb == NULL) pMsg->pDb = mgmtGetDb(pCreate->db);
|
||||
if (pMsg->pDb == NULL || pMsg->pDb->status != TSDB_DB_STATUS_READY) {
|
||||
mError("table:%s, failed to create, db not selected", pCreate->tableId);
|
||||
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_DB_NOT_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pMsg->pTable == NULL) pMsg->pTable = mgmtGetTable(pCreate->tableId);
|
||||
if (pMsg->pTable != NULL && pMsg->retry == 0) {
|
||||
if (pCreate->getMeta) {
|
||||
mTrace("table:%s, continue to get meta", pCreate->tableId);
|
||||
mgmtProcessTableMetaMsg(pMsg);
|
||||
mgmtGetChildTableMeta(pMsg);
|
||||
} else if (pCreate->igExists) {
|
||||
mTrace("table:%s, is already exist", pCreate->tableId);
|
||||
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SUCCESS);
|
||||
|
@ -628,13 +635,6 @@ static void mgmtProcessCreateTableMsg(SQueuedMsg *pMsg) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (pMsg->pDb == NULL) pMsg->pDb = mgmtGetDb(pCreate->db);
|
||||
if (pMsg->pDb == NULL || pMsg->pDb->status != TSDB_DB_STATUS_READY) {
|
||||
mError("table:%s, failed to create, db not selected", pCreate->tableId);
|
||||
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_DB_NOT_SELECTED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pCreate->numOfTags != 0) {
|
||||
mTrace("table:%s, create msg is received from thandle:%p", pCreate->tableId, pMsg->thandle);
|
||||
mgmtProcessCreateSuperTableMsg(pMsg);
|
||||
|
@ -646,7 +646,7 @@ static void mgmtProcessCreateTableMsg(SQueuedMsg *pMsg) {
|
|||
|
||||
static void mgmtProcessDropTableMsg(SQueuedMsg *pMsg) {
|
||||
SCMDropTableMsg *pDrop = pMsg->pCont;
|
||||
pMsg->pDb = mgmtGetDbByTableId(pDrop->tableId);
|
||||
if (pMsg->pDb == NULL) pMsg->pDb = mgmtGetDbByTableId(pDrop->tableId);
|
||||
if (pMsg->pDb == NULL || pMsg->pDb->status != TSDB_DB_STATUS_READY) {
|
||||
mError("table:%s, failed to drop table, db not selected", pDrop->tableId);
|
||||
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_DB_NOT_SELECTED);
|
||||
|
@ -659,8 +659,8 @@ static void mgmtProcessDropTableMsg(SQueuedMsg *pMsg) {
|
|||
return;
|
||||
}
|
||||
|
||||
pMsg->pTable = mgmtGetTable(pDrop->tableId);
|
||||
if (pMsg->pTable == NULL) {
|
||||
if (pMsg->pTable == NULL) pMsg->pTable = mgmtGetTable(pDrop->tableId);
|
||||
if (pMsg->pTable == NULL) {
|
||||
if (pDrop->igNotExists) {
|
||||
mTrace("table:%s, table is not exist, think drop success", pDrop->tableId);
|
||||
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SUCCESS);
|
||||
|
@ -683,7 +683,8 @@ static void mgmtProcessDropTableMsg(SQueuedMsg *pMsg) {
|
|||
|
||||
static void mgmtProcessTableMetaMsg(SQueuedMsg *pMsg) {
|
||||
SCMTableInfoMsg *pInfo = pMsg->pCont;
|
||||
mTrace("table:%s, table meta msg is received from thandle:%p", pInfo->tableId, pMsg->thandle);
|
||||
pInfo->createFlag = htons(pInfo->createFlag);
|
||||
mTrace("table:%s, table meta msg is received from thandle:%p, createFlag:%d", pInfo->tableId, pMsg->thandle, pInfo->createFlag);
|
||||
|
||||
if (pMsg->pDb == NULL) pMsg->pDb = mgmtGetDbByTableId(pInfo->tableId);
|
||||
if (pMsg->pDb == NULL || pMsg->pDb->status != TSDB_DB_STATUS_READY) {
|
||||
|
@ -694,7 +695,7 @@ static void mgmtProcessTableMetaMsg(SQueuedMsg *pMsg) {
|
|||
|
||||
if (pMsg->pTable == NULL) pMsg->pTable = mgmtGetTable(pInfo->tableId);
|
||||
if (pMsg->pTable == NULL) {
|
||||
if (htons(pInfo->createFlag) != 1) {
|
||||
if (!pInfo->createFlag) {
|
||||
mError("table:%s, failed to get table meta, table not exist", pInfo->tableId);
|
||||
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_INVALID_TABLE);
|
||||
} else {
|
||||
|
@ -1672,10 +1673,12 @@ static void mgmtAutoCreateChildTable(SQueuedMsg *pMsg) {
|
|||
strcpy(pCreateMsg->db, pMsg->pDb->name);
|
||||
pCreateMsg->igExists = 1;
|
||||
pCreateMsg->getMeta = 1;
|
||||
pCreateMsg->contLen = htonl(contLen);
|
||||
memcpy(pCreateMsg->schema, pInfo->tags, sizeof(STagData));
|
||||
|
||||
SQueuedMsg *newMsg = mgmtCloneQueuedMsg(pMsg);
|
||||
pMsg->pCont = newMsg->pCont;
|
||||
newMsg->msgType = TSDB_MSG_TYPE_CM_CREATE_TABLE;
|
||||
newMsg->pCont = pCreateMsg;
|
||||
|
||||
mTrace("table:%s, start to create on demand", pInfo->tableId);
|
||||
|
@ -1889,9 +1892,10 @@ static void mgmtProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
|
|||
} else {
|
||||
mTrace("table:%s, created in dnode, thandle:%p result:%s", pTable->info.tableId, queueMsg->thandle,
|
||||
tstrerror(rpcMsg->code));
|
||||
|
||||
if (queueMsg->msgType != TSDB_MSG_TYPE_CM_CREATE_TABLE) {
|
||||
mTrace("table:%s, start to get meta", pTable->info.tableId);
|
||||
SCMCreateTableMsg *pCreate = queueMsg->pCont;
|
||||
if (pCreate->getMeta) {
|
||||
mTrace("table:%s, continue to get meta", pTable->info.tableId);
|
||||
queueMsg->retry = 0;
|
||||
mgmtAddToShellQueue(queueMsg);
|
||||
} else {
|
||||
mgmtSendSimpleResp(queueMsg->thandle, rpcMsg->code);
|
||||
|
|
|
@ -151,67 +151,6 @@ int taosSetSockOpt(int socketfd, int level, int optname, void *optval, int optle
|
|||
return setsockopt(socketfd, level, optname, optval, (socklen_t)optlen);
|
||||
}
|
||||
|
||||
int taosOpenUDClientSocket(char *ip, uint16_t port) {
|
||||
int sockFd = 0;
|
||||
struct sockaddr_un serverAddr;
|
||||
int ret;
|
||||
char name[128];
|
||||
sprintf(name, "%s.%hu", ip, port);
|
||||
|
||||
sockFd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
if (sockFd < 0) {
|
||||
uError("failed to open the UD socket:%s, reason:%s", name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset((char *)&serverAddr, 0, sizeof(serverAddr));
|
||||
serverAddr.sun_family = AF_UNIX;
|
||||
strcpy(serverAddr.sun_path + 1, name);
|
||||
|
||||
ret = connect(sockFd, (struct sockaddr *)&serverAddr, sizeof(serverAddr));
|
||||
|
||||
if (ret != 0) {
|
||||
uError("failed to connect UD socket, name:%d, reason: %s", name, strerror(errno));
|
||||
sockFd = -1;
|
||||
}
|
||||
|
||||
return sockFd;
|
||||
}
|
||||
|
||||
int taosOpenUDServerSocket(char *ip, uint16_t port) {
|
||||
struct sockaddr_un serverAdd;
|
||||
int sockFd;
|
||||
char name[128];
|
||||
|
||||
uTrace("open ud socket:%s", name);
|
||||
sprintf(name, "%s.%hu", ip, port);
|
||||
|
||||
bzero((char *)&serverAdd, sizeof(serverAdd));
|
||||
serverAdd.sun_family = AF_UNIX;
|
||||
strcpy(serverAdd.sun_path + 1, name);
|
||||
unlink(name);
|
||||
|
||||
if ((sockFd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
uError("failed to open UD socket:%s, reason:%s", name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* bind socket to server address */
|
||||
if (bind(sockFd, (struct sockaddr *)&serverAdd, sizeof(serverAdd)) < 0) {
|
||||
uError("bind socket:%s failed, reason:%s", name, strerror(errno));
|
||||
tclose(sockFd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (listen(sockFd, 10) < 0) {
|
||||
uError("listen socket:%s failed, reason:%s", name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sockFd;
|
||||
}
|
||||
|
||||
int taosInitTimer(void (*callback)(int), int ms) {
|
||||
signal(SIGALRM, callback);
|
||||
|
||||
|
@ -443,4 +382,4 @@ int fsendfile(FILE* out_file, FILE* in_file, int64_t* offset, int32_t count) {
|
|||
return writeLen;
|
||||
}
|
||||
|
||||
void taosSetCoreDump() {}
|
||||
void taosSetCoreDump() {}
|
||||
|
|
|
@ -143,68 +143,6 @@ int taosSetNonblocking(int sock, int on) {
|
|||
int taosSetSockOpt(int socketfd, int level, int optname, void *optval, int optlen) {
|
||||
return setsockopt(socketfd, level, optname, optval, (socklen_t)optlen);
|
||||
}
|
||||
|
||||
int taosOpenUDClientSocket(char *ip, uint16_t port) {
|
||||
int sockFd = 0;
|
||||
struct sockaddr_un serverAddr;
|
||||
int ret;
|
||||
char name[128];
|
||||
sprintf(name, "%s.%hu", ip, port);
|
||||
|
||||
sockFd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
if (sockFd < 0) {
|
||||
uError("failed to open the UD socket:%s, reason:%s", name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset((char *)&serverAddr, 0, sizeof(serverAddr));
|
||||
serverAddr.sun_family = AF_UNIX;
|
||||
strcpy(serverAddr.sun_path + 1, name);
|
||||
|
||||
ret = connect(sockFd, (struct sockaddr *)&serverAddr, sizeof(serverAddr));
|
||||
|
||||
if (ret != 0) {
|
||||
uError("failed to connect UD socket, name:%d, reason: %s", name, strerror(errno));
|
||||
sockFd = -1;
|
||||
}
|
||||
|
||||
return sockFd;
|
||||
}
|
||||
|
||||
int taosOpenUDServerSocket(char *ip, uint16_t port) {
|
||||
struct sockaddr_un serverAdd;
|
||||
int sockFd;
|
||||
char name[128];
|
||||
|
||||
uTrace("open ud socket:%s", name);
|
||||
sprintf(name, "%s.%hu", ip, port);
|
||||
|
||||
bzero((char *)&serverAdd, sizeof(serverAdd));
|
||||
serverAdd.sun_family = AF_UNIX;
|
||||
strcpy(serverAdd.sun_path + 1, name);
|
||||
unlink(name);
|
||||
|
||||
if ((sockFd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
uError("failed to open UD socket:%s, reason:%s", name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* bind socket to server address */
|
||||
if (bind(sockFd, (struct sockaddr *)&serverAdd, sizeof(serverAdd)) < 0) {
|
||||
uError("bind socket:%s failed, reason:%s", name, strerror(errno));
|
||||
tclose(sockFd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (listen(sockFd, 10) < 0) {
|
||||
uError("listen socket:%s failed, reason:%s", name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sockFd;
|
||||
}
|
||||
|
||||
static void taosDeleteTimer(void *tharg) {
|
||||
timer_t *pTimer = tharg;
|
||||
timer_delete(*pTimer);
|
||||
|
|
|
@ -33,10 +33,6 @@ int taosOpenTcpServerSocket(uint32_t ip, uint16_t port);
|
|||
int taosKeepTcpAlive(int sockFd);
|
||||
void taosCloseTcpSocket(int sockFd);
|
||||
|
||||
int taosOpenUDServerSocket(uint32_t ip, uint16_t port);
|
||||
int taosOpenUDClientSocket(uint32_t ip, uint16_t port);
|
||||
int taosOpenRawSocket(uint32_t ip);
|
||||
|
||||
int taosGetFqdn(char *);
|
||||
uint32_t taosGetIpFromFqdn(const char *);
|
||||
void tinet_ntoa(char *ipstr, unsigned int ip);
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
*/
|
||||
|
||||
#include "os.h"
|
||||
#include "tglobal.h"
|
||||
#include "tulog.h"
|
||||
#include "tsocket.h"
|
||||
#include "tutil.h"
|
||||
|
@ -394,38 +393,6 @@ int taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
|
|||
return sockFd;
|
||||
}
|
||||
|
||||
int taosOpenRawSocket(uint32_t ip) {
|
||||
int fd, hold;
|
||||
struct sockaddr_in rawAdd;
|
||||
|
||||
uTrace("open udp raw socket:%s", ip);
|
||||
|
||||
fd = (int)socket(AF_INET, SOCK_RAW, IPPROTO_UDP);
|
||||
if (fd < 0) {
|
||||
uError("failed to open raw socket: %d (%s)", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
hold = 1;
|
||||
if (taosSetSockOpt(fd, IPPROTO_IP, IP_HDRINCL, (void *)&hold, sizeof(hold)) < 0) {
|
||||
uError("failed to set hold option: %d (%s)", errno, strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
bzero((char *)&rawAdd, sizeof(rawAdd));
|
||||
rawAdd.sin_family = AF_INET;
|
||||
rawAdd.sin_addr.s_addr = ip;
|
||||
|
||||
if (bind(fd, (struct sockaddr *)&rawAdd, sizeof(rawAdd)) < 0) {
|
||||
uError("failed to bind RAW socket:(%s)", strerror(errno));
|
||||
close(fd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
void tinet_ntoa(char *ipstr, unsigned int ip) {
|
||||
sprintf(ipstr, "%d.%d.%d.%d", ip & 0xFF, (ip >> 8) & 0xFF, (ip >> 16) & 0xFF, ip >> 24);
|
||||
}
|
||||
|
|
|
@ -686,4 +686,4 @@ void taosRemoveDir(char *rootDir) {
|
|||
rmdir(rootDir);
|
||||
|
||||
uPrint("dir:%s is removed", rootDir);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,28 @@
|
|||
#################################
|
||||
run general/db/basic1.sim
|
||||
run general/db/basic2.sim
|
||||
run general/db/basic3.sim
|
||||
run general/db/basic4.sim
|
||||
run general/db/basic5.sim
|
||||
|
||||
run general/db/testSuite.sim
|
||||
run general/insert/testSuite.sim
|
||||
run general/table/testSuite.sim
|
||||
run general/user/basicSuite.sim
|
||||
run general/table/basic1.sim
|
||||
run general/table/basic2.sim
|
||||
run general/table/basic3.sim
|
||||
run general/table/column_num.sim
|
||||
run general/table/column_name.sim
|
||||
run general/table/bigint.sim
|
||||
run general/table/bool.sim
|
||||
run general/table/double.sim
|
||||
run general/table/float.sim
|
||||
run general/table/int.sim
|
||||
run general/table/smallint.sim
|
||||
run general/table/tinyint.sim
|
||||
run general/table/db.table.sim
|
||||
|
||||
run general/user/basic1.sim
|
||||
run general/user/pass_alter.sim
|
||||
run general/user/pass_len.sim
|
||||
run general/user/user_create.sim
|
||||
run general/user/user_len.sim
|
||||
|
||||
##################################
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -m 192.168.0.1 -i 192.168.0.1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print =============== create database
|
||||
sql create database db
|
||||
sql show databases
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print $data00 $data01 $data02
|
||||
|
||||
print =============== create super table
|
||||
sql create table db.st1 (ts timestamp, i int) tags (j int)
|
||||
sql create table db.st2 (ts timestamp, i int, j int) tags (t1 int, t2 int, t3 int)
|
||||
sql show db.stables
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print $data00 $data01 $data02
|
||||
|
||||
print =============== create child table
|
||||
sql insert into db.c1 using db.st1 tags(1) values(now, 1);
|
||||
sql insert into db.c2 using db.st1 tags(2) values(now, 2);
|
||||
sql insert into db.c3 using db.st1 tags(3) values(now, 3);
|
||||
sql insert into db.c4 using db.st1 tags(4) values(now, 4);
|
||||
sql insert into db.c1 using db.st1 tags(1) values(now, 1);
|
||||
sql insert into db.c2 using db.st1 tags(2) values(now, 2);
|
||||
sql insert into db.c3 using db.st1 tags(3) values(now, 3);
|
||||
sql insert into db.c4 using db.st1 tags(4) values(now, 4);
|
||||
|
||||
sql show db.tables
|
||||
if $rows != 4 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.c1
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.c2
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.c3
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.c4
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.st1
|
||||
if $rows != 8 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== insert data
|
||||
sql insert into db.s1 using db.st2 tags(1, 1, 1) values(now, 1, 2);
|
||||
sql insert into db.s2 using db.st2 tags(2, 2, 2) values(now, 2, 3);
|
||||
sql insert into db.s3 using db.st2 tags(3, 3, 3) values(now, 3, 4);
|
||||
sql insert into db.s4 using db.st2 tags(4, 4, 4) values(now, 4, 5);
|
||||
sql insert into db.s1 using db.st2 tags(1, 1, 1) values(now, 1, 2);
|
||||
sql insert into db.s2 using db.st2 tags(2, 2, 2) values(now, 2, 3);
|
||||
sql insert into db.s3 using db.st2 tags(3, 3, 3) values(now, 3, 4);
|
||||
sql insert into db.s4 using db.st2 tags(4, 4, 4) values(now, 4, 5);
|
||||
sql insert into db.s1 using db.st2 tags(1, 1, 1) values(now, 1, 2);
|
||||
sql insert into db.s2 using db.st2 tags(2, 2, 2) values(now, 2, 3);
|
||||
sql insert into db.s3 using db.st2 tags(3, 3, 3) values(now, 3, 4);
|
||||
sql insert into db.s4 using db.st2 tags(4, 4, 4) values(now, 4, 5);
|
||||
|
||||
sql show db.tables
|
||||
if $rows != 8 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.s1
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.s2
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.s3
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from db.s4
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
|
@ -1,25 +1,26 @@
|
|||
run general/table/autocreate.sim
|
||||
run general/table/basic1.sim
|
||||
run general/table/basic2.sim
|
||||
run general/table/basic3.sim
|
||||
#run general/table/table.sim
|
||||
#run general/table/vgroup.sim
|
||||
#run general/table/limit.sim
|
||||
#run general/table/table_len.sim
|
||||
run general/table/column_num.sim
|
||||
#run general/table/column2.sim
|
||||
run general/table/column_name.sim
|
||||
#run general/table/column_value.sim
|
||||
#run general/table/describe.sim
|
||||
#run general/table/date.sim
|
||||
run general/table/bigint.sim
|
||||
#run general/table/binary.sim
|
||||
run general/table/bool.sim
|
||||
run general/table/double.sim
|
||||
run general/table/float.sim
|
||||
run general/table/int.sim
|
||||
run general/table/smallint.sim
|
||||
run general/table/tinyint.sim
|
||||
run general/table/column_name.sim
|
||||
run general/table/column_num.sim
|
||||
#run general/table/column_value.sim
|
||||
#run general/table/column2.sim
|
||||
#run general/table/date.sim
|
||||
run general/table/db.table.sim
|
||||
#run general/table/delete_reuse1.sim
|
||||
#run general/table/delete_reuse2.sim
|
||||
#run general/table/delete_writing.sim
|
||||
#run general/table/describe.sim
|
||||
run general/table/double.sim
|
||||
run general/table/float.sim
|
||||
run general/table/int.sim
|
||||
#run general/table/limit.sim
|
||||
run general/table/smallint.sim
|
||||
#run general/table/table_len.sim
|
||||
#run general/table/table.sim
|
||||
run general/table/tinyint.sim
|
||||
#run general/table/vgroup.sim
|
||||
|
|
Loading…
Reference in New Issue