提交 cfdab316 编写于 作者: S slguan

[TD-150]

上级 9f7e7deb
......@@ -304,10 +304,11 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
SSQLToken* pIpAddr = &pInfo->pDCLInfo->a[0];
if (!validateIpAddress(pIpAddr->z, pIpAddr->n)) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
}
// if (!validateIpAddress(pIpAddr->z, pIpAddr->n)) {
// return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
// }
pIpAddr->n = strdequote(pIpAddr->z);
break;
}
......
......@@ -79,7 +79,7 @@ void tscSetMgmtIpListFromEdge() {
if (tscMgmtIpSet.numOfIps != 1) {
tscMgmtIpSet.numOfIps = 1;
tscMgmtIpSet.inUse = 0;
taosGetFqdnPortFromEp(tsMaster, tscMgmtIpSet.fqdn[0], &tscMgmtIpSet.port[0]);
taosGetFqdnPortFromEp(tsFirst, tscMgmtIpSet.fqdn[0], &tscMgmtIpSet.port[0]);
tscTrace("edge mgmt IP list:");
tscPrintMgmtIp();
}
......
......@@ -80,8 +80,8 @@ STscObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
strcpy(tscMgmtIpSet.fqdn[0], ip);
tscMgmtIpSet.port[0] = port? port: tsMnodeShellPort;
} else {
if (tsMaster[0] != 0) {
taosGetFqdnPortFromEp(tsMaster, tscMgmtIpSet.fqdn[tscMgmtIpSet.numOfIps], &tscMgmtIpSet.port[tscMgmtIpSet.numOfIps]);
if (tsFirst[0] != 0) {
taosGetFqdnPortFromEp(tsFirst, tscMgmtIpSet.fqdn[tscMgmtIpSet.numOfIps], &tscMgmtIpSet.port[tscMgmtIpSet.numOfIps]);
tscMgmtIpSet.numOfIps++;
}
......
......@@ -136,9 +136,9 @@ void taos_init_imp() {
tscMgmtIpSet.inUse = 0;
tscMgmtIpSet.numOfIps = 1;
taosGetFqdnPortFromEp(tsMaster, tscMgmtIpSet.fqdn[0], &tscMgmtIpSet.port[0]);
taosGetFqdnPortFromEp(tsFirst, tscMgmtIpSet.fqdn[0], &tscMgmtIpSet.port[0]);
if (tsSecond[0] && strcmp(tsSecond, tsMaster) != 0) {
if (tsSecond[0] && strcmp(tsSecond, tsFirst) != 0) {
tscMgmtIpSet.numOfIps = 2;
taosGetFqdnPortFromEp(tsSecond, tscMgmtIpSet.fqdn[1], &tscMgmtIpSet.port[1]);
}
......
......@@ -51,7 +51,7 @@ extern int32_t tsVersion;
extern int32_t tscEmbedded;
extern int64_t tsMsPerDay[2];
extern char tsMaster[];
extern char tsFirst[];
extern char tsSecond[];
extern char tsLocalEp[];
extern uint16_t tsServerPort;
......
......@@ -61,7 +61,7 @@ int32_t tscEmbedded = 0;
*/
int64_t tsMsPerDay[] = {86400000L, 86400000000L};
char tsMaster[TSDB_FQDN_LEN] = {0};
char tsFirst[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
......@@ -272,9 +272,9 @@ static void doInitGlobalConfig() {
SGlobalCfg cfg = {0};
// ip address
cfg.option = "master";
cfg.ptr = tsMaster;
cfg.valType = TAOS_CFG_VTYPE_IPSTR;
cfg.option = "first";
cfg.ptr = tsFirst;
cfg.valType = TAOS_CFG_VTYPE_STRING;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
cfg.minValue = 0;
cfg.maxValue = 0;
......@@ -284,7 +284,7 @@ static void doInitGlobalConfig() {
cfg.option = "second";
cfg.ptr = tsSecond;
cfg.valType = TAOS_CFG_VTYPE_IPSTR;
cfg.valType = TAOS_CFG_VTYPE_STRING;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
cfg.minValue = 0;
cfg.maxValue = 0;
......@@ -346,7 +346,7 @@ static void doInitGlobalConfig() {
cfg.option = "arbitrator";
cfg.ptr = tsArbitrator;
cfg.valType = TAOS_CFG_VTYPE_IPSTR;
cfg.valType = TAOS_CFG_VTYPE_STRING;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT;
cfg.minValue = 0;
cfg.maxValue = 0;
......@@ -1204,9 +1204,10 @@ void taosInitGlobalCfg() {
bool taosCheckGlobalCfg() {
taosGetFqdn(tsLocalEp);
sprintf(tsLocalEp + strlen(tsLocalEp), ":%d", tsServerPort);
uPrint("localEp is %s", tsLocalEp);
if (tsMaster[0] == 0) {
strcpy(tsMaster, tsLocalEp);
if (tsFirst[0] == 0) {
strcpy(tsFirst, tsLocalEp);
}
if (tsSecond[0] == 0) {
......
......@@ -83,12 +83,12 @@ int32_t dnodeInitMClient() {
memset(&tsMnodeIpSet, 0, sizeof(SRpcIpSet));
memset(&tsMnodeInfos, 0, sizeof(SDMMnodeInfos));
tsMnodeIpSet.numOfIps = 1;
taosGetFqdnPortFromEp(tsMaster, tsMnodeIpSet.fqdn[0], &tsMnodeIpSet.port[0]);
taosGetFqdnPortFromEp(tsFirst, tsMnodeIpSet.fqdn[0], &tsMnodeIpSet.port[0]);
tsMnodeIpSet.port[0] += TSDB_PORT_MNODEDNODE;
if (strcmp(tsSecond, tsMaster) != 0) {
if (strcmp(tsSecond, tsFirst) != 0) {
tsMnodeIpSet.numOfIps = 2;
taosGetFqdnPortFromEp(tsSecond, tsMnodeIpSet.fqdn[1], &tsMnodeIpSet.port[1]);
tsMnodeIpSet.port[0] += TSDB_PORT_MNODEDNODE;
tsMnodeIpSet.port[1] += TSDB_PORT_MNODEDNODE;
}
} else {
tsMnodeIpSet.inUse = tsMnodeInfos.inUse;
......
......@@ -236,5 +236,5 @@ static int32_t dnodeInitStorage() {
static void dnodeCleanupStorage() {}
bool dnodeIsFirstDeploy() {
return strcmp(tsMaster, tsLocalEp) == 0;
return strcmp(tsFirst, tsLocalEp) == 0;
}
......@@ -190,7 +190,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_LOCALE_LEN 64
#define TSDB_TIMEZONE_LEN 64
#define TSDB_FQDN_LEN 64
#define TSDB_FQDN_LEN 72
#define TSDB_IPv4ADDR_LEN 16
#define TSDB_FILENAME_LEN 128
#define TSDB_METER_VNODE_BITS 20
......
......@@ -72,6 +72,7 @@ void sdbCleanUp();
void * sdbOpenTable(SSdbTableDesc *desc);
void sdbCloseTable(void *handle);
bool sdbIsMaster();
bool sdbIsServing();
void sdbUpdateMnodeRoles();
int32_t sdbInsertRow(SSdbOper *pOper);
......
......@@ -107,6 +107,7 @@ static void mgmtProcessMsgFromDnode(SRpcMsg *rpcMsg) {
SRpcIpSet ipSet = {0};
dnodeGetMnodeDnodeIpSet(&ipSet);
mTrace("conn from dnode ip:%s user:%s redirect msg, inUse:%d", taosIpStr(connInfo.clientIp), connInfo.user, ipSet.inUse);
for (int32_t i = 0; i < ipSet.numOfIps; ++i) {
mTrace("index:%d %s:%d", i, ipSet.fqdn[i], ipSet.port[i]);
......
......@@ -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);
......
......@@ -130,7 +130,7 @@ int32_t mgmtInitSystem() {
struct stat dirstat;
bool fileExist = (stat(tsMnodeDir, &dirstat) == 0);
bool asMaster = (strcmp(tsMaster, tsLocalEp) == 0);
bool asMaster = (strcmp(tsFirst, tsLocalEp) == 0);
if (asMaster || fileExist) {
if (mgmtStartSystem() != 0) {
......
......@@ -40,7 +40,7 @@ typedef enum {
typedef enum {
SDB_STATUS_OFFLINE,
SDB_STATUS_SERVING,
SDB_ACTION_CLOSING
SDB_STATUS_CLOSING
} ESdbStatus;
typedef struct _SSdbTable {
......@@ -107,6 +107,10 @@ bool sdbIsMaster() {
return tsSdbObj.role == TAOS_SYNC_ROLE_MASTER;
}
bool sdbIsServing() {
return tsSdbObj.status == SDB_STATUS_SERVING;
}
static char *sdbGetActionStr(int32_t action) {
switch (action) {
case SDB_ACTION_INSERT:
......@@ -314,6 +318,7 @@ int32_t sdbInit() {
void sdbCleanUp() {
if (tsSdbObj.status != SDB_STATUS_SERVING) return;
tsSdbObj.status = SDB_STATUS_CLOSING;
syncStop(tsSdbObj.sync);
free(tsSdbObj.sync);
walClose(tsSdbObj.wal);
......
......@@ -27,7 +27,6 @@
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "qsqlparser.h"
......@@ -203,61 +202,62 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (529)
#define YY_ACTTAB_COUNT (531)
static const YYACTIONTYPE yy_action[] = {
/* 0 */ 752, 440, 132, 150, 244, 10, 616, 246, 132, 441,
/* 10 */ 132, 155, 821, 41, 43, 20, 35, 36, 820, 154,
/* 20 */ 821, 29, 741, 440, 200, 39, 37, 40, 38, 131,
/* 30 */ 499, 441, 96, 34, 33, 100, 151, 32, 31, 30,
/* 40 */ 41, 43, 741, 35, 36, 152, 136, 163, 29, 727,
/* 50 */ 749, 200, 39, 37, 40, 38, 185, 100, 225, 224,
/* 60 */ 34, 33, 162, 730, 32, 31, 30, 400, 401, 402,
/* 0 */ 752, 440, 133, 151, 244, 10, 616, 246, 133, 441,
/* 10 */ 133, 156, 821, 41, 43, 20, 35, 36, 820, 155,
/* 20 */ 821, 29, 741, 440, 201, 39, 37, 40, 38, 132,
/* 30 */ 499, 441, 97, 34, 33, 101, 152, 32, 31, 30,
/* 40 */ 41, 43, 741, 35, 36, 153, 137, 164, 29, 727,
/* 50 */ 749, 201, 39, 37, 40, 38, 186, 101, 225, 224,
/* 60 */ 34, 33, 163, 730, 32, 31, 30, 400, 401, 402,
/* 70 */ 403, 404, 405, 406, 407, 408, 409, 410, 411, 245,
/* 80 */ 730, 41, 43, 188, 35, 36, 215, 236, 197, 29,
/* 90 */ 58, 20, 200, 39, 37, 40, 38, 32, 31, 30,
/* 100 */ 56, 34, 33, 75, 730, 32, 31, 30, 43, 236,
/* 110 */ 35, 36, 776, 817, 195, 29, 20, 20, 200, 39,
/* 120 */ 37, 40, 38, 164, 570, 727, 227, 34, 33, 440,
/* 130 */ 167, 32, 31, 30, 238, 35, 36, 441, 7, 816,
/* 140 */ 29, 61, 110, 200, 39, 37, 40, 38, 223, 228,
/* 80 */ 730, 41, 43, 189, 35, 36, 216, 236, 198, 29,
/* 90 */ 58, 20, 201, 39, 37, 40, 38, 32, 31, 30,
/* 100 */ 56, 34, 33, 76, 730, 32, 31, 30, 43, 236,
/* 110 */ 35, 36, 776, 817, 196, 29, 20, 20, 201, 39,
/* 120 */ 37, 40, 38, 165, 570, 727, 227, 34, 33, 440,
/* 130 */ 168, 32, 31, 30, 238, 35, 36, 441, 7, 816,
/* 140 */ 29, 61, 111, 201, 39, 37, 40, 38, 223, 228,
/* 150 */ 727, 727, 34, 33, 50, 728, 32, 31, 30, 15,
/* 160 */ 214, 237, 213, 212, 211, 210, 209, 208, 207, 206,
/* 160 */ 215, 237, 214, 213, 212, 211, 210, 209, 208, 207,
/* 170 */ 712, 51, 701, 702, 703, 704, 705, 706, 707, 708,
/* 180 */ 709, 710, 711, 159, 583, 11, 815, 574, 100, 577,
/* 190 */ 100, 580, 168, 159, 583, 222, 221, 574, 16, 577,
/* 200 */ 20, 580, 34, 33, 145, 26, 32, 31, 30, 238,
/* 210 */ 86, 85, 139, 174, 657, 156, 157, 123, 144, 199,
/* 220 */ 182, 715, 179, 714, 148, 156, 157, 159, 583, 531,
/* 230 */ 60, 574, 149, 577, 726, 580, 237, 16, 39, 37,
/* 180 */ 709, 710, 711, 160, 583, 11, 815, 574, 101, 577,
/* 190 */ 101, 580, 169, 160, 583, 222, 221, 574, 16, 577,
/* 200 */ 20, 580, 34, 33, 146, 26, 32, 31, 30, 238,
/* 210 */ 87, 86, 140, 175, 657, 157, 158, 124, 145, 200,
/* 220 */ 183, 715, 180, 714, 149, 157, 158, 160, 583, 531,
/* 230 */ 60, 574, 150, 577, 726, 580, 237, 16, 39, 37,
/* 240 */ 40, 38, 27, 775, 26, 59, 34, 33, 551, 552,
/* 250 */ 32, 31, 30, 137, 113, 114, 219, 64, 67, 156,
/* 260 */ 157, 95, 515, 666, 184, 512, 123, 513, 26, 514,
/* 270 */ 523, 147, 127, 125, 240, 88, 87, 187, 42, 158,
/* 280 */ 73, 77, 239, 84, 76, 572, 528, 729, 42, 582,
/* 290 */ 79, 17, 658, 165, 166, 123, 243, 242, 92, 582,
/* 250 */ 32, 31, 30, 138, 114, 115, 68, 64, 67, 157,
/* 260 */ 158, 96, 515, 666, 185, 512, 124, 513, 26, 514,
/* 270 */ 523, 148, 128, 126, 240, 89, 88, 188, 42, 159,
/* 280 */ 74, 78, 239, 85, 77, 572, 528, 729, 42, 582,
/* 290 */ 80, 17, 658, 166, 167, 124, 243, 242, 93, 582,
/* 300 */ 47, 542, 543, 600, 581, 45, 13, 12, 584, 576,
/* 310 */ 138, 579, 12, 575, 581, 578, 2, 72, 71, 48,
/* 320 */ 505, 573, 42, 743, 45, 504, 204, 9, 8, 21,
/* 330 */ 21, 140, 519, 582, 520, 517, 141, 518, 83, 82,
/* 340 */ 142, 143, 134, 130, 135, 830, 133, 786, 581, 785,
/* 350 */ 160, 782, 781, 161, 751, 721, 768, 226, 97, 767,
/* 360 */ 111, 112, 516, 668, 205, 109, 128, 24, 218, 220,
/* 370 */ 829, 69, 26, 828, 826, 115, 186, 686, 25, 22,
/* 380 */ 90, 129, 655, 78, 653, 80, 651, 650, 169, 538,
/* 390 */ 124, 648, 189, 647, 646, 644, 636, 193, 52, 740,
/* 400 */ 126, 642, 640, 638, 49, 755, 756, 101, 769, 44,
/* 410 */ 198, 196, 194, 28, 192, 190, 217, 74, 229, 230,
/* 420 */ 202, 232, 231, 614, 233, 234, 53, 235, 241, 170,
/* 430 */ 146, 62, 171, 65, 173, 172, 613, 176, 175, 178,
/* 440 */ 649, 177, 612, 89, 91, 117, 687, 118, 116, 119,
/* 450 */ 120, 643, 104, 102, 122, 725, 106, 103, 105, 121,
/* 460 */ 107, 1, 108, 23, 180, 181, 605, 183, 187, 525,
/* 470 */ 55, 539, 153, 98, 57, 191, 18, 63, 4, 544,
/* 480 */ 99, 5, 585, 3, 19, 14, 201, 6, 203, 480,
/* 490 */ 479, 478, 477, 476, 475, 474, 473, 471, 45, 444,
/* 500 */ 66, 446, 21, 501, 216, 68, 500, 498, 54, 465,
/* 510 */ 46, 463, 455, 70, 461, 457, 459, 453, 451, 472,
/* 520 */ 470, 81, 426, 442, 93, 415, 94, 413, 618,
/* 310 */ 139, 579, 12, 575, 581, 578, 2, 73, 72, 48,
/* 320 */ 505, 573, 42, 743, 45, 504, 205, 9, 8, 21,
/* 330 */ 21, 141, 519, 582, 520, 517, 142, 518, 84, 83,
/* 340 */ 143, 144, 135, 131, 136, 830, 134, 786, 581, 785,
/* 350 */ 161, 782, 781, 162, 751, 721, 768, 226, 98, 767,
/* 360 */ 112, 113, 516, 668, 206, 110, 129, 24, 219, 665,
/* 370 */ 220, 829, 26, 70, 828, 826, 187, 116, 686, 25,
/* 380 */ 91, 22, 130, 655, 79, 653, 81, 651, 650, 538,
/* 390 */ 170, 125, 190, 648, 647, 646, 644, 194, 52, 740,
/* 400 */ 636, 127, 642, 640, 638, 49, 755, 102, 756, 44,
/* 410 */ 769, 199, 197, 195, 193, 191, 28, 218, 75, 229,
/* 420 */ 230, 231, 232, 233, 234, 235, 203, 53, 241, 614,
/* 430 */ 171, 172, 147, 62, 65, 174, 613, 177, 173, 179,
/* 440 */ 612, 176, 649, 178, 181, 643, 123, 687, 117, 119,
/* 450 */ 118, 120, 121, 90, 103, 725, 108, 104, 105, 122,
/* 460 */ 106, 107, 109, 92, 1, 23, 182, 188, 605, 184,
/* 470 */ 525, 55, 539, 57, 99, 154, 192, 18, 63, 4,
/* 480 */ 544, 100, 480, 585, 3, 19, 5, 14, 202, 6,
/* 490 */ 204, 479, 478, 477, 476, 475, 474, 473, 471, 45,
/* 500 */ 217, 444, 66, 21, 501, 500, 46, 498, 54, 465,
/* 510 */ 463, 455, 461, 457, 69, 459, 71, 453, 451, 472,
/* 520 */ 470, 82, 426, 442, 94, 415, 413, 618, 617, 617,
/* 530 */ 95,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 207, 1, 256, 206, 207, 256, 204, 205, 256, 9,
......@@ -300,20 +300,20 @@ static const YYCODETYPE yy_lookahead[] = {
/* 370 */ 207, 207, 103, 207, 207, 207, 240, 207, 207, 207,
/* 380 */ 59, 207, 207, 207, 207, 207, 207, 207, 207, 107,
/* 390 */ 207, 207, 259, 207, 207, 207, 207, 259, 117, 253,
/* 400 */ 207, 207, 207, 207, 119, 208, 208, 252, 208, 116,
/* 410 */ 111, 115, 110, 121, 109, 108, 75, 84, 83, 49,
/* 420 */ 208, 82, 80, 5, 53, 81, 208, 79, 75, 132,
/* 430 */ 208, 212, 5, 212, 58, 132, 5, 5, 132, 58,
/* 440 */ 208, 132, 5, 209, 209, 220, 222, 216, 221, 219,
/* 450 */ 217, 208, 249, 251, 215, 240, 247, 250, 248, 218,
/* 460 */ 246, 213, 245, 210, 132, 58, 86, 124, 104, 97,
/* 470 */ 105, 97, 1, 96, 101, 96, 101, 72, 112, 97,
/* 480 */ 96, 112, 97, 96, 101, 96, 98, 96, 98, 9,
/* 490 */ 5, 5, 5, 5, 1, 5, 5, 5, 101, 76,
/* 500 */ 72, 58, 101, 5, 15, 127, 5, 97, 96, 5,
/* 510 */ 16, 5, 5, 127, 5, 5, 5, 5, 5, 5,
/* 520 */ 5, 58, 58, 76, 21, 59, 21, 58, 0, 267,
/* 530 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 400 */ 207, 207, 207, 207, 207, 119, 208, 252, 208, 116,
/* 410 */ 208, 111, 115, 110, 109, 108, 121, 75, 84, 83,
/* 420 */ 49, 80, 82, 53, 81, 79, 208, 208, 75, 5,
/* 430 */ 132, 5, 208, 212, 212, 58, 5, 5, 132, 58,
/* 440 */ 5, 132, 208, 132, 132, 208, 215, 222, 221, 216,
/* 450 */ 220, 219, 217, 209, 251, 240, 246, 250, 249, 218,
/* 460 */ 248, 247, 245, 209, 213, 210, 58, 104, 86, 124,
/* 470 */ 97, 105, 97, 101, 96, 1, 96, 101, 72, 112,
/* 480 */ 97, 96, 9, 97, 96, 101, 112, 96, 98, 96,
/* 490 */ 98, 5, 5, 5, 5, 1, 5, 5, 5, 101,
/* 500 */ 15, 76, 72, 101, 5, 5, 16, 97, 96, 5,
/* 510 */ 5, 5, 5, 5, 127, 5, 127, 5, 5, 5,
/* 520 */ 5, 58, 58, 76, 21, 59, 58, 0, 267, 267,
/* 530 */ 21, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 540 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 550 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 560 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
......@@ -333,41 +333,41 @@ static const YYCODETYPE yy_lookahead[] = {
/* 700 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 710 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 720 */ 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
/* 730 */ 267, 267,
/* 730 */ 267, 267, 267, 267,
};
#define YY_SHIFT_COUNT (246)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (528)
#define YY_SHIFT_MAX (527)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 141, 74, 182, 226, 128, 128, 128, 128, 128, 128,
/* 10 */ 0, 22, 226, 260, 260, 260, 102, 128, 128, 128,
/* 20 */ 128, 128, 31, 149, 9, 9, 529, 192, 226, 226,
/* 20 */ 128, 128, 31, 149, 9, 9, 531, 192, 226, 226,
/* 30 */ 226, 226, 226, 226, 226, 226, 226, 226, 226, 226,
/* 40 */ 226, 226, 226, 226, 226, 260, 260, 25, 25, 25,
/* 50 */ 25, 25, 25, 42, 25, 165, 128, 128, 135, 135,
/* 60 */ 185, 128, 128, 128, 128, 128, 128, 128, 128, 128,
/* 70 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
/* 80 */ 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
/* 90 */ 128, 128, 128, 128, 128, 269, 321, 321, 282, 282,
/* 100 */ 321, 281, 285, 293, 299, 296, 302, 305, 307, 292,
/* 110 */ 269, 321, 321, 341, 341, 321, 333, 335, 370, 342,
/* 120 */ 339, 371, 344, 348, 321, 353, 321, 353, 529, 529,
/* 130 */ 27, 68, 68, 68, 94, 119, 213, 213, 213, 216,
/* 140 */ 169, 169, 169, 169, 190, 208, 67, 89, 60, 60,
/* 150 */ 236, 173, 204, 205, 206, 211, 304, 308, 284, 220,
/* 160 */ 199, 53, 223, 228, 229, 327, 330, 191, 201, 266,
/* 170 */ 418, 297, 427, 303, 376, 431, 306, 432, 309, 381,
/* 180 */ 437, 332, 407, 380, 343, 364, 372, 365, 373, 374,
/* 190 */ 377, 471, 379, 382, 384, 375, 366, 383, 369, 385,
/* 200 */ 387, 389, 388, 391, 390, 405, 480, 485, 486, 487,
/* 210 */ 488, 493, 490, 491, 492, 397, 423, 489, 428, 443,
/* 220 */ 494, 378, 386, 401, 498, 501, 410, 412, 401, 504,
/* 230 */ 506, 507, 509, 510, 511, 512, 513, 514, 515, 463,
/* 240 */ 464, 447, 503, 505, 466, 469, 528,
/* 90 */ 128, 128, 128, 128, 128, 128, 269, 321, 321, 282,
/* 100 */ 282, 321, 281, 286, 293, 300, 297, 303, 305, 307,
/* 110 */ 295, 269, 321, 321, 342, 342, 321, 334, 336, 371,
/* 120 */ 341, 340, 370, 343, 346, 321, 353, 321, 353, 531,
/* 130 */ 531, 27, 68, 68, 68, 94, 119, 213, 213, 213,
/* 140 */ 216, 169, 169, 169, 169, 190, 208, 67, 89, 60,
/* 150 */ 60, 236, 173, 204, 205, 206, 211, 304, 308, 284,
/* 160 */ 220, 199, 53, 223, 228, 229, 327, 330, 191, 201,
/* 170 */ 266, 424, 298, 426, 306, 377, 431, 309, 432, 311,
/* 180 */ 381, 435, 312, 408, 382, 345, 363, 373, 366, 372,
/* 190 */ 375, 378, 474, 380, 383, 385, 376, 367, 384, 374,
/* 200 */ 386, 388, 391, 390, 393, 392, 406, 473, 486, 487,
/* 210 */ 488, 489, 494, 491, 492, 493, 398, 425, 485, 430,
/* 220 */ 490, 387, 389, 402, 499, 500, 410, 412, 402, 504,
/* 230 */ 505, 506, 507, 508, 510, 512, 513, 514, 515, 463,
/* 240 */ 464, 447, 503, 509, 466, 468, 527,
};
#define YY_REDUCE_COUNT (129)
#define YY_REDUCE_COUNT (130)
#define YY_REDUCE_MIN (-254)
#define YY_REDUCE_MAX (253)
#define YY_REDUCE_MAX (255)
static const short yy_reduce_ofst[] = {
/* 0 */ -198, -53, -254, -246, -150, -172, -192, -116, -91, -90,
/* 10 */ -207, -203, -248, -179, -162, -138, -218, -175, -19, -17,
......@@ -378,10 +378,11 @@ static const short yy_reduce_ofst[] = {
/* 60 */ 121, 153, 154, 156, 157, 159, 160, 161, 162, 163,
/* 70 */ 164, 166, 167, 168, 170, 171, 172, 174, 175, 176,
/* 80 */ 177, 178, 179, 180, 181, 183, 184, 186, 187, 188,
/* 90 */ 189, 193, 194, 195, 196, 136, 197, 198, 133, 138,
/* 100 */ 200, 146, 155, 202, 207, 203, 210, 209, 214, 217,
/* 110 */ 215, 212, 218, 219, 221, 222, 224, 227, 225, 231,
/* 120 */ 230, 233, 241, 239, 232, 234, 243, 235, 248, 253,
/* 90 */ 189, 193, 194, 195, 196, 197, 136, 198, 200, 133,
/* 100 */ 138, 202, 146, 155, 203, 207, 209, 212, 214, 210,
/* 110 */ 217, 215, 218, 219, 221, 222, 224, 225, 227, 230,
/* 120 */ 233, 232, 235, 241, 231, 234, 244, 237, 254, 251,
/* 130 */ 255,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 615, 667, 823, 823, 615, 615, 615, 615, 615, 615,
......@@ -391,21 +392,21 @@ static const YYACTIONTYPE yy_default[] = {
/* 40 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 50 */ 615, 615, 615, 615, 615, 615, 615, 615, 772, 772,
/* 60 */ 746, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 70 */ 615, 615, 615, 615, 615, 615, 615, 615, 654, 615,
/* 80 */ 652, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 90 */ 615, 615, 641, 615, 615, 615, 635, 635, 615, 615,
/* 100 */ 635, 779, 783, 777, 765, 773, 764, 760, 759, 787,
/* 110 */ 615, 635, 635, 664, 664, 635, 685, 683, 681, 673,
/* 120 */ 679, 675, 677, 671, 635, 662, 635, 662, 700, 713,
/* 130 */ 615, 788, 822, 778, 806, 805, 818, 812, 811, 615,
/* 140 */ 810, 809, 808, 807, 615, 615, 615, 615, 814, 813,
/* 150 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 790,
/* 160 */ 784, 780, 615, 615, 615, 615, 615, 615, 615, 615,
/* 70 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 654,
/* 80 */ 615, 652, 615, 615, 615, 615, 615, 615, 615, 615,
/* 90 */ 615, 615, 615, 641, 615, 615, 615, 635, 635, 615,
/* 100 */ 615, 635, 779, 783, 777, 765, 773, 764, 760, 759,
/* 110 */ 787, 615, 635, 635, 664, 664, 635, 685, 683, 681,
/* 120 */ 673, 679, 675, 677, 671, 635, 662, 635, 662, 700,
/* 130 */ 713, 615, 788, 822, 778, 806, 805, 818, 812, 811,
/* 140 */ 615, 810, 809, 808, 807, 615, 615, 615, 615, 814,
/* 150 */ 813, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 160 */ 790, 784, 780, 615, 615, 615, 615, 615, 615, 615,
/* 170 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 180 */ 615, 615, 615, 615, 615, 745, 615, 615, 754, 615,
/* 190 */ 615, 615, 615, 615, 615, 774, 615, 766, 615, 615,
/* 200 */ 615, 615, 615, 615, 722, 615, 615, 615, 615, 615,
/* 210 */ 615, 615, 615, 615, 615, 688, 615, 615, 615, 615,
/* 180 */ 615, 615, 615, 615, 615, 615, 745, 615, 615, 754,
/* 190 */ 615, 615, 615, 615, 615, 615, 774, 615, 766, 615,
/* 200 */ 615, 615, 615, 615, 615, 722, 615, 615, 615, 615,
/* 210 */ 615, 615, 615, 615, 615, 615, 688, 615, 615, 615,
/* 220 */ 615, 615, 615, 827, 615, 615, 615, 716, 825, 615,
/* 230 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
/* 240 */ 615, 615, 639, 637, 615, 631, 615,
......@@ -1038,7 +1039,7 @@ static const char *const yyRuleName[] = {
/* 44 */ "ifexists ::=",
/* 45 */ "ifnotexists ::= IF NOT EXISTS",
/* 46 */ "ifnotexists ::=",
/* 47 */ "cmd ::= CREATE DNODE IPTOKEN",
/* 47 */ "cmd ::= CREATE DNODE ids",
/* 48 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr",
/* 49 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr",
/* 50 */ "cmd ::= CREATE USER ids PASS ids",
......@@ -1711,7 +1712,7 @@ static const struct {
{ 209, 0 }, /* (44) ifexists ::= */
{ 212, -3 }, /* (45) ifnotexists ::= IF NOT EXISTS */
{ 212, 0 }, /* (46) ifnotexists ::= */
{ 205, -3 }, /* (47) cmd ::= CREATE DNODE IPTOKEN */
{ 205, -3 }, /* (47) cmd ::= CREATE DNODE ids */
{ 205, -6 }, /* (48) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{ 205, -5 }, /* (49) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{ 205, -5 }, /* (50) cmd ::= CREATE USER ids PASS ids */
......@@ -2122,7 +2123,7 @@ static void yy_reduce(
case 45: /* ifnotexists ::= IF NOT EXISTS */
{yymsp[-2].minor.yy0.n = 1;}
break;
case 47: /* cmd ::= CREATE DNODE IPTOKEN */
case 47: /* cmd ::= CREATE DNODE ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);}
break;
case 48: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
......
......@@ -520,6 +520,7 @@ SHashMutableIterator *taosHashCreateIter(SHashObj *pHashObj) {
static SHashNode *getNextHashNode(SHashMutableIterator *pIter) {
assert(pIter != NULL);
pIter->entryIndex++;
while (pIter->entryIndex < pIter->pHashObj->capacity) {
SHashEntry *pEntry = pIter->pHashObj->hashList[pIter->entryIndex];
......
......@@ -25,8 +25,13 @@ int taosGetFqdn(char *fqdn) {
struct hostent* h;
h = gethostbyname(hostname);
strcpy(fqdn, h->h_name);
return 0;
if (h != NULL) {
strcpy(fqdn, h->h_name);
return 0;
} else {
uError("failed to get host name");
return -1;
}
}
uint32_t taosGetIpFromFqdn(const char *fqdn) {
......
......@@ -26,7 +26,7 @@ do
v)
VALGRIND=1
;;
v)
u)
UNIQUE=1
;;
?)
......
......@@ -36,7 +36,12 @@ void simLogSql(char *sql) {
fflush(fp);
}
char *simParseHostName(char *varName);
char *simGetVariable(SScript *script, char *varName, int varLen) {
if (strncmp(varName, "hostname", 8) == 0) {
return simParseHostName(varName);
}
if (strncmp(varName, "error", varLen) == 0) return script->error;
if (strncmp(varName, "rows", varLen) == 0) return script->rows;
......
......@@ -19,6 +19,7 @@
#include "tglobal.h"
#include "ttimer.h"
#include "tutil.h"
#include "tsocket.h"
SScript *simScriptList[MAX_MAIN_SCRIPT_NUM];
SCommand simCmdList[SIM_CMD_END];
......@@ -26,8 +27,50 @@ int simScriptPos = -1;
int simScriptSucced = 0;
int simDebugFlag = 135;
void simCloseTaosdConnect(SScript *script);
char simHostName[128];
char *simParseHostName(char *varName) {
static char hostName[140];
int index = atoi(varName + 8);
int port = 7100;
switch (index) {
case 1:
port = 7100;
break;
case 2:
port = 7200;
break;
case 3:
port = 7300;
break;
case 4:
port = 7400;
break;
case 5:
port = 7500;
break;
case 6:
port = 7600;
break;
case 7:
port = 7700;
break;
case 8:
port = 7800;
break;
case 9:
port = 7900;
break;
}
sprintf(hostName, "'%s:%d'", simHostName, port);
//simPrint("hostName:%s", hostName);
return hostName;
}
bool simSystemInit() {
taosGetFqdn(simHostName);
taos_init();
simInitsimCmdList();
memset(simScriptList, 0, sizeof(SScript *) * MAX_MAIN_SCRIPT_NUM);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册