提交 cd6a1008 编写于 作者: H Hongze Cheng

Merge branch 'develop' into feature/2.0tsdb

...@@ -52,7 +52,8 @@ matrix: ...@@ -52,7 +52,8 @@ matrix:
cd ${TRAVIS_BUILD_DIR}/debug cd ${TRAVIS_BUILD_DIR}/debug
make install > /dev/null || travis_terminate $? make install > /dev/null || travis_terminate $?
pip3 install numpy py3ver=`python3 --version|awk '{print $2}'|cut -d "." -f 1,2` && apt install python$py3ver-dev
pip3 install psutil
pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/ pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/
cd ${TRAVIS_BUILD_DIR}/tests cd ${TRAVIS_BUILD_DIR}/tests
......
...@@ -4992,6 +4992,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) { ...@@ -4992,6 +4992,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
pMsg->compression = pCreateDb->compressionLevel; pMsg->compression = pCreateDb->compressionLevel;
pMsg->walLevel = (char)pCreateDb->walLevel; pMsg->walLevel = (char)pCreateDb->walLevel;
pMsg->replications = pCreateDb->replica; pMsg->replications = pCreateDb->replica;
pMsg->quorum = pCreateDb->quorum;
pMsg->ignoreExist = pCreateDb->ignoreExists; pMsg->ignoreExist = pCreateDb->ignoreExists;
} }
...@@ -5522,6 +5523,13 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) { ...@@ -5522,6 +5523,13 @@ int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
} }
if (pCreate->quorum != -1 &&
(pCreate->quorum < TSDB_MIN_DB_REPLICA_OPTION || pCreate->quorum > TSDB_MAX_DB_REPLICA_OPTION)) {
snprintf(msg, tListLen(msg), "invalid db option quorum: %d valid range: [%d, %d]", pCreate->quorum,
TSDB_MIN_DB_REPLICA_OPTION, TSDB_MAX_DB_REPLICA_OPTION);
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg);
}
int32_t val = htonl(pCreate->daysPerFile); int32_t val = htonl(pCreate->daysPerFile);
if (val != -1 && (val < TSDB_MIN_DAYS_PER_FILE || val > TSDB_MAX_DAYS_PER_FILE)) { if (val != -1 && (val < TSDB_MIN_DAYS_PER_FILE || val > TSDB_MAX_DAYS_PER_FILE)) {
snprintf(msg, tListLen(msg), "invalid db option daysPerFile: %d valid range: [%d, %d]", val, snprintf(msg, tListLen(msg), "invalid db option daysPerFile: %d valid range: [%d, %d]", val,
......
...@@ -80,6 +80,7 @@ extern int16_t tsCompression; ...@@ -80,6 +80,7 @@ extern int16_t tsCompression;
extern int16_t tsWAL; extern int16_t tsWAL;
extern int32_t tsFsyncPeriod; extern int32_t tsFsyncPeriod;
extern int32_t tsReplications; extern int32_t tsReplications;
extern int32_t tsQuorum;
// balance // balance
extern int32_t tsEnableBalance; extern int32_t tsEnableBalance;
......
...@@ -109,6 +109,7 @@ int16_t tsCompression = TSDB_DEFAULT_COMP_LEVEL; ...@@ -109,6 +109,7 @@ int16_t tsCompression = TSDB_DEFAULT_COMP_LEVEL;
int16_t tsWAL = TSDB_DEFAULT_WAL_LEVEL; int16_t tsWAL = TSDB_DEFAULT_WAL_LEVEL;
int32_t tsFsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD; int32_t tsFsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD;
int32_t tsReplications = TSDB_DEFAULT_DB_REPLICA_OPTION; int32_t tsReplications = TSDB_DEFAULT_DB_REPLICA_OPTION;
int32_t tsQuorum = TSDB_DEFAULT_DB_QUORUM_OPTION;
int32_t tsMaxVgroupsPerDb = 0; int32_t tsMaxVgroupsPerDb = 0;
int32_t tsMinTablePerVnode = 100; int32_t tsMinTablePerVnode = 100;
int32_t tsMaxTablePerVnode = TSDB_DEFAULT_TABLES; int32_t tsMaxTablePerVnode = TSDB_DEFAULT_TABLES;
...@@ -742,6 +743,16 @@ static void doInitGlobalConfig() { ...@@ -742,6 +743,16 @@ static void doInitGlobalConfig() {
cfg.unitType = TAOS_CFG_UTYPE_NONE; cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg); taosInitConfigOption(cfg);
cfg.option = "quorum";
cfg.ptr = &tsQuorum;
cfg.valType = TAOS_CFG_VTYPE_INT32;
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_SHOW;
cfg.minValue = TSDB_MIN_DB_REPLICA_OPTION;
cfg.maxValue = TSDB_MAX_DB_REPLICA_OPTION;
cfg.ptrLength = 0;
cfg.unitType = TAOS_CFG_UTYPE_NONE;
taosInitConfigOption(cfg);
cfg.option = "mqttBrokerAddress"; cfg.option = "mqttBrokerAddress";
cfg.ptr = tsMqttBrokerAddress; cfg.ptr = tsMqttBrokerAddress;
cfg.valType = TAOS_CFG_VTYPE_STRING; cfg.valType = TAOS_CFG_VTYPE_STRING;
...@@ -1338,4 +1349,4 @@ bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *d ...@@ -1338,4 +1349,4 @@ bool taosCheckBalanceCfgOptions(const char *option, int32_t *vnodeId, int32_t *d
} }
return true; return true;
} }
\ No newline at end of file
...@@ -38,6 +38,8 @@ typedef struct { ...@@ -38,6 +38,8 @@ typedef struct {
typedef struct { typedef struct {
SRspRet rspRet; SRspRet rspRet;
int32_t processedCount;
int32_t code;
void *pCont; void *pCont;
int32_t contLen; int32_t contLen;
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
...@@ -187,13 +189,16 @@ void dnodeFreeVnodeWqueue(void *wqueue) { ...@@ -187,13 +189,16 @@ void dnodeFreeVnodeWqueue(void *wqueue) {
void dnodeSendRpcVnodeWriteRsp(void *pVnode, void *param, int32_t code) { void dnodeSendRpcVnodeWriteRsp(void *pVnode, void *param, int32_t code) {
SWriteMsg *pWrite = (SWriteMsg *)param; SWriteMsg *pWrite = (SWriteMsg *)param;
if (code > 0) return; if (code < 0) pWrite->code = code;
int32_t count = atomic_add_fetch_32(&pWrite->processedCount, 1);
if (count <= 1) return;
SRpcMsg rpcRsp = { SRpcMsg rpcRsp = {
.handle = pWrite->rpcMsg.handle, .handle = pWrite->rpcMsg.handle,
.pCont = pWrite->rspRet.rsp, .pCont = pWrite->rspRet.rsp,
.contLen = pWrite->rspRet.len, .contLen = pWrite->rspRet.len,
.code = code, .code = pWrite->code,
}; };
rpcSendResponse(&rpcRsp); rpcSendResponse(&rpcRsp);
...@@ -239,7 +244,10 @@ static void *dnodeProcessWriteQueue(void *param) { ...@@ -239,7 +244,10 @@ static void *dnodeProcessWriteQueue(void *param) {
} }
int32_t code = vnodeProcessWrite(pVnode, type, pHead, pRspRet); int32_t code = vnodeProcessWrite(pVnode, type, pHead, pRspRet);
if (pWrite) pWrite->rpcMsg.code = code; if (pWrite) {
pWrite->rpcMsg.code = code;
if (code <= 0) pWrite->processedCount = 1;
}
} }
walFsync(vnodeGetWal(pVnode)); walFsync(vnodeGetWal(pVnode));
......
...@@ -338,6 +338,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); ...@@ -338,6 +338,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_MIN_DB_REPLICA_OPTION 1 #define TSDB_MIN_DB_REPLICA_OPTION 1
#define TSDB_MAX_DB_REPLICA_OPTION 3 #define TSDB_MAX_DB_REPLICA_OPTION 3
#define TSDB_DEFAULT_DB_REPLICA_OPTION 1 #define TSDB_DEFAULT_DB_REPLICA_OPTION 1
#define TSDB_DEFAULT_DB_QUORUM_OPTION 1
#define TSDB_MAX_JOIN_TABLE_NUM 5 #define TSDB_MAX_JOIN_TABLE_NUM 5
#define TSDB_MAX_UNION_CLAUSE 5 #define TSDB_MAX_UNION_CLAUSE 5
......
...@@ -522,6 +522,7 @@ typedef struct { ...@@ -522,6 +522,7 @@ typedef struct {
int8_t compression; int8_t compression;
int8_t walLevel; int8_t walLevel;
int8_t replications; int8_t replications;
int8_t quorum;
int8_t ignoreExist; int8_t ignoreExist;
} SCMCreateDbMsg, SCMAlterDbMsg; } SCMCreateDbMsg, SCMAlterDbMsg;
......
...@@ -104,123 +104,125 @@ ...@@ -104,123 +104,125 @@
#define TK_MAXTABLES 86 #define TK_MAXTABLES 86
#define TK_CACHE 87 #define TK_CACHE 87
#define TK_REPLICA 88 #define TK_REPLICA 88
#define TK_DAYS 89 #define TK_QUORUM 89
#define TK_MINROWS 90 #define TK_DAYS 90
#define TK_MAXROWS 91 #define TK_MINROWS 91
#define TK_BLOCKS 92 #define TK_MAXROWS 92
#define TK_CTIME 93 #define TK_BLOCKS 93
#define TK_WAL 94 #define TK_CTIME 94
#define TK_FSYNC 95 #define TK_WAL 95
#define TK_COMP 96 #define TK_FSYNC 96
#define TK_PRECISION 97 #define TK_COMP 97
#define TK_LP 98 #define TK_PRECISION 98
#define TK_RP 99 #define TK_LP 99
#define TK_TAGS 100 #define TK_RP 100
#define TK_USING 101 #define TK_TAGS 101
#define TK_AS 102 #define TK_USING 102
#define TK_COMMA 103 #define TK_AS 103
#define TK_NULL 104 #define TK_COMMA 104
#define TK_SELECT 105 #define TK_NULL 105
#define TK_UNION 106 #define TK_SELECT 106
#define TK_ALL 107 #define TK_UNION 107
#define TK_FROM 108 #define TK_ALL 108
#define TK_VARIABLE 109 #define TK_FROM 109
#define TK_INTERVAL 110 #define TK_VARIABLE 110
#define TK_FILL 111 #define TK_INTERVAL 111
#define TK_SLIDING 112 #define TK_FILL 112
#define TK_ORDER 113 #define TK_SLIDING 113
#define TK_BY 114 #define TK_ORDER 114
#define TK_ASC 115 #define TK_BY 115
#define TK_DESC 116 #define TK_ASC 116
#define TK_GROUP 117 #define TK_DESC 117
#define TK_HAVING 118 #define TK_GROUP 118
#define TK_LIMIT 119 #define TK_HAVING 119
#define TK_OFFSET 120 #define TK_LIMIT 120
#define TK_SLIMIT 121 #define TK_OFFSET 121
#define TK_SOFFSET 122 #define TK_SLIMIT 122
#define TK_WHERE 123 #define TK_SOFFSET 123
#define TK_NOW 124 #define TK_WHERE 124
#define TK_RESET 125 #define TK_NOW 125
#define TK_QUERY 126 #define TK_RESET 126
#define TK_ADD 127 #define TK_QUERY 127
#define TK_COLUMN 128 #define TK_ADD 128
#define TK_TAG 129 #define TK_COLUMN 129
#define TK_CHANGE 130 #define TK_TAG 130
#define TK_SET 131 #define TK_CHANGE 131
#define TK_KILL 132 #define TK_SET 132
#define TK_CONNECTION 133 #define TK_KILL 133
#define TK_STREAM 134 #define TK_CONNECTION 134
#define TK_COLON 135 #define TK_STREAM 135
#define TK_ABORT 136 #define TK_COLON 136
#define TK_AFTER 137 #define TK_ABORT 137
#define TK_ATTACH 138 #define TK_AFTER 138
#define TK_BEFORE 139 #define TK_ATTACH 139
#define TK_BEGIN 140 #define TK_BEFORE 140
#define TK_CASCADE 141 #define TK_BEGIN 141
#define TK_CLUSTER 142 #define TK_CASCADE 142
#define TK_CONFLICT 143 #define TK_CLUSTER 143
#define TK_COPY 144 #define TK_CONFLICT 144
#define TK_DEFERRED 145 #define TK_COPY 145
#define TK_DELIMITERS 146 #define TK_DEFERRED 146
#define TK_DETACH 147 #define TK_DELIMITERS 147
#define TK_EACH 148 #define TK_DETACH 148
#define TK_END 149 #define TK_EACH 149
#define TK_EXPLAIN 150 #define TK_END 150
#define TK_FAIL 151 #define TK_EXPLAIN 151
#define TK_FOR 152 #define TK_FAIL 152
#define TK_IGNORE 153 #define TK_FOR 153
#define TK_IMMEDIATE 154 #define TK_IGNORE 154
#define TK_INITIALLY 155 #define TK_IMMEDIATE 155
#define TK_INSTEAD 156 #define TK_INITIALLY 156
#define TK_MATCH 157 #define TK_INSTEAD 157
#define TK_KEY 158 #define TK_MATCH 158
#define TK_OF 159 #define TK_KEY 159
#define TK_RAISE 160 #define TK_OF 160
#define TK_REPLACE 161 #define TK_RAISE 161
#define TK_RESTRICT 162 #define TK_REPLACE 162
#define TK_ROW 163 #define TK_RESTRICT 163
#define TK_STATEMENT 164 #define TK_ROW 164
#define TK_TRIGGER 165 #define TK_STATEMENT 165
#define TK_VIEW 166 #define TK_TRIGGER 166
#define TK_COUNT 167 #define TK_VIEW 167
#define TK_SUM 168 #define TK_COUNT 168
#define TK_AVG 169 #define TK_SUM 169
#define TK_MIN 170 #define TK_AVG 170
#define TK_MAX 171 #define TK_MIN 171
#define TK_FIRST 172 #define TK_MAX 172
#define TK_LAST 173 #define TK_FIRST 173
#define TK_TOP 174 #define TK_LAST 174
#define TK_BOTTOM 175 #define TK_TOP 175
#define TK_STDDEV 176 #define TK_BOTTOM 176
#define TK_PERCENTILE 177 #define TK_STDDEV 177
#define TK_APERCENTILE 178 #define TK_PERCENTILE 178
#define TK_LEASTSQUARES 179 #define TK_APERCENTILE 179
#define TK_HISTOGRAM 180 #define TK_LEASTSQUARES 180
#define TK_DIFF 181 #define TK_HISTOGRAM 181
#define TK_SPREAD 182 #define TK_DIFF 182
#define TK_TWA 183 #define TK_SPREAD 183
#define TK_INTERP 184 #define TK_TWA 184
#define TK_LAST_ROW 185 #define TK_INTERP 185
#define TK_RATE 186 #define TK_LAST_ROW 186
#define TK_IRATE 187 #define TK_RATE 187
#define TK_SUM_RATE 188 #define TK_IRATE 188
#define TK_SUM_IRATE 189 #define TK_SUM_RATE 189
#define TK_AVG_RATE 190 #define TK_SUM_IRATE 190
#define TK_AVG_IRATE 191 #define TK_AVG_RATE 191
#define TK_TBID 192 #define TK_AVG_IRATE 192
#define TK_SEMI 193 #define TK_TBID 193
#define TK_NONE 194 #define TK_SEMI 194
#define TK_PREV 195 #define TK_NONE 195
#define TK_LINEAR 196 #define TK_PREV 196
#define TK_IMPORT 197 #define TK_LINEAR 197
#define TK_METRIC 198 #define TK_IMPORT 198
#define TK_TBNAME 199 #define TK_METRIC 199
#define TK_JOIN 200 #define TK_TBNAME 200
#define TK_METRICS 201 #define TK_JOIN 201
#define TK_STABLE 202 #define TK_METRICS 202
#define TK_INSERT 203 #define TK_STABLE 203
#define TK_INTO 204 #define TK_INSERT 204
#define TK_VALUES 205 #define TK_INTO 205
#define TK_VALUES 206
#define TK_SPACE 300 #define TK_SPACE 300
#define TK_COMMENT 301 #define TK_COMMENT 301
......
...@@ -171,6 +171,7 @@ typedef struct { ...@@ -171,6 +171,7 @@ typedef struct {
int8_t compression; int8_t compression;
int8_t walLevel; int8_t walLevel;
int8_t replications; int8_t replications;
int8_t quorum;
int8_t reserved[12]; int8_t reserved[12];
} SDbCfg; } SDbCfg;
......
...@@ -301,6 +301,12 @@ static int32_t mnodeCheckDbCfg(SDbCfg *pCfg) { ...@@ -301,6 +301,12 @@ static int32_t mnodeCheckDbCfg(SDbCfg *pCfg) {
return TSDB_CODE_MND_INVALID_DB_OPTION; return TSDB_CODE_MND_INVALID_DB_OPTION;
} }
if (pCfg->quorum < TSDB_MIN_DB_REPLICA_OPTION || pCfg->quorum > TSDB_MAX_DB_REPLICA_OPTION) {
mError("invalid db option quorum:%d valid range: [%d, %d]", pCfg->quorum, TSDB_MIN_DB_REPLICA_OPTION,
TSDB_MAX_DB_REPLICA_OPTION);
return TSDB_CODE_MND_INVALID_DB_OPTION;
}
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -320,6 +326,7 @@ static void mnodeSetDefaultDbCfg(SDbCfg *pCfg) { ...@@ -320,6 +326,7 @@ static void mnodeSetDefaultDbCfg(SDbCfg *pCfg) {
if (pCfg->compression < 0) pCfg->compression = tsCompression; if (pCfg->compression < 0) pCfg->compression = tsCompression;
if (pCfg->walLevel < 0) pCfg->walLevel = tsWAL; if (pCfg->walLevel < 0) pCfg->walLevel = tsWAL;
if (pCfg->replications < 0) pCfg->replications = tsReplications; if (pCfg->replications < 0) pCfg->replications = tsReplications;
if (pCfg->quorum < 0) pCfg->quorum = tsQuorum;
} }
static int32_t mnodeCreateDbCb(SMnodeMsg *pMsg, int32_t code) { static int32_t mnodeCreateDbCb(SMnodeMsg *pMsg, int32_t code) {
...@@ -369,7 +376,8 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs ...@@ -369,7 +376,8 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate, void *pMs
.precision = pCreate->precision, .precision = pCreate->precision,
.compression = pCreate->compression, .compression = pCreate->compression,
.walLevel = pCreate->walLevel, .walLevel = pCreate->walLevel,
.replications = pCreate->replications .replications = pCreate->replications,
.quorum = pCreate->quorum
}; };
mnodeSetDefaultDbCfg(&pDb->cfg); mnodeSetDefaultDbCfg(&pDb->cfg);
...@@ -508,6 +516,12 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn ...@@ -508,6 +516,12 @@ static int32_t mnodeGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn
pSchema[cols].bytes = htons(pShow->bytes[cols]); pSchema[cols].bytes = htons(pShow->bytes[cols]);
cols++; cols++;
pShow->bytes[cols] = 2;
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
strcpy(pSchema[cols].name, "quorum");
pSchema[cols].bytes = htons(pShow->bytes[cols]);
cols++;
pShow->bytes[cols] = 2; pShow->bytes[cols] = 2;
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT; pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
strcpy(pSchema[cols].name, "days"); strcpy(pSchema[cols].name, "days");
...@@ -654,6 +668,10 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void ...@@ -654,6 +668,10 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
*(int16_t *)pWrite = pDb->cfg.replications; *(int16_t *)pWrite = pDb->cfg.replications;
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(int16_t *)pWrite = pDb->cfg.quorum;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(int16_t *)pWrite = pDb->cfg.daysPerFile; *(int16_t *)pWrite = pDb->cfg.daysPerFile;
cols++; cols++;
...@@ -803,6 +821,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { ...@@ -803,6 +821,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
int8_t compression = pAlter->compression; int8_t compression = pAlter->compression;
int8_t walLevel = pAlter->walLevel; int8_t walLevel = pAlter->walLevel;
int8_t replications = pAlter->replications; int8_t replications = pAlter->replications;
int8_t quorum = pAlter->quorum;
int8_t precision = pAlter->precision; int8_t precision = pAlter->precision;
terrno = TSDB_CODE_SUCCESS; terrno = TSDB_CODE_SUCCESS;
...@@ -901,6 +920,11 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { ...@@ -901,6 +920,11 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
} }
} }
if (quorum >= 0 && quorum != pDb->cfg.quorum) {
mDebug("db:%s, quorum:%d change to %d", pDb->name, pDb->cfg.quorum, quorum);
newCfg.compression = quorum;
}
return newCfg; return newCfg;
} }
......
...@@ -784,7 +784,7 @@ static SMDCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) { ...@@ -784,7 +784,7 @@ static SMDCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) {
pCfg->walLevel = pDb->cfg.walLevel; pCfg->walLevel = pDb->cfg.walLevel;
pCfg->replications = (int8_t) pVgroup->numOfVnodes; pCfg->replications = (int8_t) pVgroup->numOfVnodes;
pCfg->wals = 3; pCfg->wals = 3;
pCfg->quorum = 1; pCfg->quorum = pDb->cfg.quorum;
SMDVnodeDesc *pNodes = pVnode->nodes; SMDVnodeDesc *pNodes = pVnode->nodes;
for (int32_t j = 0; j < pVgroup->numOfVnodes; ++j) { for (int32_t j = 0; j < pVgroup->numOfVnodes; ++j) {
......
...@@ -119,6 +119,7 @@ typedef struct SCreateDBInfo { ...@@ -119,6 +119,7 @@ typedef struct SCreateDBInfo {
int32_t fsyncPeriod; int32_t fsyncPeriod;
int64_t commitTime; int64_t commitTime;
int32_t walLevel; int32_t walLevel;
int32_t quorum;
int32_t compressionLevel; int32_t compressionLevel;
SSQLToken precision; SSQLToken precision;
bool ignoreExists; bool ignoreExists;
......
...@@ -215,6 +215,7 @@ keep(Y) ::= KEEP tagitemlist(X). { Y = X; } ...@@ -215,6 +215,7 @@ keep(Y) ::= KEEP tagitemlist(X). { Y = X; }
tables(Y) ::= MAXTABLES INTEGER(X). { Y = X; } tables(Y) ::= MAXTABLES INTEGER(X). { Y = X; }
cache(Y) ::= CACHE INTEGER(X). { Y = X; } cache(Y) ::= CACHE INTEGER(X). { Y = X; }
replica(Y) ::= REPLICA INTEGER(X). { Y = X; } replica(Y) ::= REPLICA INTEGER(X). { Y = X; }
quorum(Y) ::= QUORUM INTEGER(X). { Y = X; }
days(Y) ::= DAYS INTEGER(X). { Y = X; } days(Y) ::= DAYS INTEGER(X). { Y = X; }
minrows(Y) ::= MINROWS INTEGER(X). { Y = X; } minrows(Y) ::= MINROWS INTEGER(X). { Y = X; }
maxrows(Y) ::= MAXROWS INTEGER(X). { Y = X; } maxrows(Y) ::= MAXROWS INTEGER(X). { Y = X; }
...@@ -231,6 +232,7 @@ db_optr(Y) ::= . {setDefaultCreateDbOption(&Y);} ...@@ -231,6 +232,7 @@ db_optr(Y) ::= . {setDefaultCreateDbOption(&Y);}
db_optr(Y) ::= db_optr(Z) tables(X). { Y = Z; Y.maxTablesPerVnode = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) tables(X). { Y = Z; Y.maxTablesPerVnode = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) cache(X). { Y = Z; Y.cacheBlockSize = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) cache(X). { Y = Z; Y.cacheBlockSize = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) quorum(X). { Y = Z; Y.quorum = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) days(X). { Y = Z; Y.daysPerFile = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) days(X). { Y = Z; Y.daysPerFile = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) minrows(X). { Y = Z; Y.minRowsPerBlock = strtod(X.z, NULL); } db_optr(Y) ::= db_optr(Z) minrows(X). { Y = Z; Y.minRowsPerBlock = strtod(X.z, NULL); }
db_optr(Y) ::= db_optr(Z) maxrows(X). { Y = Z; Y.maxRowsPerBlock = strtod(X.z, NULL); } db_optr(Y) ::= db_optr(Z) maxrows(X). { Y = Z; Y.maxRowsPerBlock = strtod(X.z, NULL); }
...@@ -246,6 +248,7 @@ db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; } ...@@ -246,6 +248,7 @@ db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
alter_db_optr(Y) ::= . { setDefaultCreateDbOption(&Y);} alter_db_optr(Y) ::= . { setDefaultCreateDbOption(&Y);}
alter_db_optr(Y) ::= alter_db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); } alter_db_optr(Y) ::= alter_db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) quorum(X). { Y = Z; Y.quorum = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) tables(X). { Y = Z; Y.maxTablesPerVnode = strtol(X.z, NULL, 10); } alter_db_optr(Y) ::= alter_db_optr(Z) tables(X). { Y = Z; Y.maxTablesPerVnode = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) keep(X). { Y = Z; Y.keep = X; } alter_db_optr(Y) ::= alter_db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
alter_db_optr(Y) ::= alter_db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); } alter_db_optr(Y) ::= alter_db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); }
......
...@@ -907,6 +907,7 @@ void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) { ...@@ -907,6 +907,7 @@ void setDefaultCreateDbOption(SCreateDBInfo *pDBInfo) {
pDBInfo->daysPerFile = -1; pDBInfo->daysPerFile = -1;
pDBInfo->replica = -1; pDBInfo->replica = -1;
pDBInfo->quorum = -1;
pDBInfo->keep = NULL; pDBInfo->keep = NULL;
memset(&pDBInfo->precision, 0, sizeof(SSQLToken)); memset(&pDBInfo->precision, 0, sizeof(SSQLToken));
......
...@@ -116,6 +116,7 @@ static SKeyword keywordTable[] = { ...@@ -116,6 +116,7 @@ static SKeyword keywordTable[] = {
{"STATE", TK_STATE}, {"STATE", TK_STATE},
{"KEEP", TK_KEEP}, {"KEEP", TK_KEEP},
{"REPLICA", TK_REPLICA}, {"REPLICA", TK_REPLICA},
{"QUORUM", TK_QUORUM},
{"DAYS", TK_DAYS}, {"DAYS", TK_DAYS},
{"MINROWS", TK_MINROWS}, {"MINROWS", TK_MINROWS},
{"MAXROWS", TK_MAXROWS}, {"MAXROWS", TK_MAXROWS},
......
此差异已折叠。
...@@ -145,6 +145,8 @@ void *syncStart(const SSyncInfo *pInfo) ...@@ -145,6 +145,8 @@ void *syncStart(const SSyncInfo *pInfo)
pNode->vgId = pInfo->vgId; pNode->vgId = pInfo->vgId;
pNode->replica = pCfg->replica; pNode->replica = pCfg->replica;
pNode->quorum = pCfg->quorum; pNode->quorum = pCfg->quorum;
if (pNode->quorum > pNode->replica) pNode->quorum = pNode->replica;
for (int i = 0; i < pCfg->replica; ++i) { for (int i = 0; i < pCfg->replica; ++i) {
const SNodeInfo *pNodeInfo = pCfg->nodeInfo + i; const SNodeInfo *pNodeInfo = pCfg->nodeInfo + i;
pNode->peerInfo[i] = syncAddPeer(pNode, pNodeInfo); pNode->peerInfo[i] = syncAddPeer(pNode, pNodeInfo);
...@@ -260,6 +262,7 @@ int32_t syncReconfig(void *param, const SSyncCfg *pNewCfg) ...@@ -260,6 +262,7 @@ int32_t syncReconfig(void *param, const SSyncCfg *pNewCfg)
pNode->replica = pNewCfg->replica; pNode->replica = pNewCfg->replica;
pNode->quorum = pNewCfg->quorum; pNode->quorum = pNewCfg->quorum;
if (pNode->quorum > pNode->replica) pNode->quorum = pNode->replica;
memcpy(pNode->peerInfo, newPeers, sizeof(SSyncPeer *) * pNewCfg->replica); memcpy(pNode->peerInfo, newPeers, sizeof(SSyncPeer *) * pNewCfg->replica);
for (i = pNewCfg->replica; i < TAOS_SYNC_MAX_REPLICA; ++i) for (i = pNewCfg->replica; i < TAOS_SYNC_MAX_REPLICA; ++i)
......
...@@ -69,8 +69,8 @@ int tsdbCreateTable(TSDB_REPO_T *repo, STableCfg *pCfg) { ...@@ -69,8 +69,8 @@ int tsdbCreateTable(TSDB_REPO_T *repo, STableCfg *pCfg) {
if (tid < pMeta->maxTables && pMeta->tables[tid] != NULL) { if (tid < pMeta->maxTables && pMeta->tables[tid] != NULL) {
if (TABLE_UID(pMeta->tables[tid]) == pCfg->tableId.uid) { if (TABLE_UID(pMeta->tables[tid]) == pCfg->tableId.uid) {
tsdbError("vgId:%d table %s already exists, tid %d uid %" PRId64, REPO_ID(pRepo), TABLE_CHAR_NAME(pTable), tsdbError("vgId:%d table %s already exists, tid %d uid %" PRId64, REPO_ID(pRepo), TABLE_CHAR_NAME(pMeta->tables[tid]),
TABLE_TID(pTable), TABLE_UID(pTable)); TABLE_TID(pMeta->tables[tid]), TABLE_UID(pMeta->tables[tid]));
return TSDB_CODE_TDB_TABLE_ALREADY_EXIST; return TSDB_CODE_TDB_TABLE_ALREADY_EXIST;
} else { } else {
tsdbError("vgId:%d table %s at tid %d uid %" PRIu64 tsdbError("vgId:%d table %s at tid %d uid %" PRIu64
...@@ -1295,4 +1295,4 @@ static int tsdbAdjustMetaTables(STsdbRepo *pRepo, int tid) { ...@@ -1295,4 +1295,4 @@ static int tsdbAdjustMetaTables(STsdbRepo *pRepo, int tid) {
tsdbDebug("vgId:%d tsdb meta maxTables is adjusted as %d", REPO_ID(pRepo), maxTables); tsdbDebug("vgId:%d tsdb meta maxTables is adjusted as %d", REPO_ID(pRepo), maxTables);
return 0; return 0;
} }
\ No newline at end of file
此差异已折叠。
...@@ -24,16 +24,16 @@ endi ...@@ -24,16 +24,16 @@ endi
if $data04 != 1 then if $data04 != 1 then
return -1 return -1
endi endi
if $data05 != 10 then if $data06 != 10 then
return -1 return -1
endi endi
if $data06 != 20,20,20 then if $data07 != 20,20,20 then
return -1 return -1
endi endi
if $data07 != 2 then if $data08 != 2 then
return -1 return -1
endi endi
if $data08 != 4 then if $data09 != 4 then
return -1 return -1
endi endi
......
...@@ -32,10 +32,10 @@ endi ...@@ -32,10 +32,10 @@ endi
if $data04 != 1 then if $data04 != 1 then
return -1 return -1
endi endi
if $data05 != 20 then if $data06 != 20 then
return -1 return -1
endi endi
if $data07 != 16 then if $data08 != 16 then
return -1 return -1
endi endi
...@@ -72,7 +72,7 @@ endi ...@@ -72,7 +72,7 @@ endi
if $data04 != 1 then if $data04 != 1 then
return -1 return -1
endi endi
if $data05 != 15 then if $data06 != 15 then
return -1 return -1
endi endi
......
...@@ -81,7 +81,7 @@ print =============== step2 - no db ...@@ -81,7 +81,7 @@ print =============== step2 - no db
#11 #11
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/rest/sql system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/rest/sql
print 11-> $system_content print 11-> $system_content
if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","days","keep1,keep2,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","precision","status"],"data":[],"rows":0}@ then if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep1,keep2,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","precision","status"],"data":[],"rows":0}@ then
return -1 return -1
endi endi
......
...@@ -122,18 +122,18 @@ endi ...@@ -122,18 +122,18 @@ endi
if $data04 != $replica then if $data04 != $replica then
return -1 return -1
endi endi
if $data05 != $days then if $data06 != $days then
return -1 return -1
endi endi
if $data06 != 365,365,365 then if $data07 != 365,365,365 then
return -1 return -1
endi endi
print data07 = $data07 print data08 = $data07
if $data07 != $cache then if $data08 != $cache then
print expect $cache, actual:$data07 print expect $cache, actual:$data08
return -1 return -1
endi endi
if $data08 != 4 then if $data09 != 4 then
return -1 return -1
endi endi
......
...@@ -57,10 +57,10 @@ while $i < $tblEnd ...@@ -57,10 +57,10 @@ while $i < $tblEnd
endw endw
sql select count(*) from $tb sql select count(*) from $tb
print data00 $data00 rowsPerTbl $rowsPerTbl
if $data00 != $rowsPerTbl then if $data00 != $rowsPerTbl then
print data00 $data00 rowsPerTbl $rowsPerTbl
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ************ client-01 insert data error ***** ***** print ************ client-01 insert data into $tb error ***** *****
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return -1 return -1
endi endi
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
$tblStart = 0 $tblStart = 0
$tblEnd = 10000 $tblEnd = 10000
$tsStart = 1325347200000 # 2012-01-01 00:00:00.000 $tsStart = 1325347200000 # 2012-01-01 00:00:00.000
$c2Binary = ' . client-02- $preBinary = ' . client-02-
############################################################### ###############################################################
sql connect sql connect
...@@ -31,13 +31,14 @@ $rowsPerTbl = 0 ...@@ -31,13 +31,14 @@ $rowsPerTbl = 0
$ts = $tsStart $ts = $tsStart
$rowsPerLoop = 160 $rowsPerLoop = 160
$loop_cnt = 0
loop_run: loop_run:
print ================ client-02 start loop insert data print ================ client-02 start loop insert data ( loop_cnt: $loop_cnt )
$i = $tblStart $i = $tblStart
while $i < $tblEnd while $i < $tblEnd
$tb = tb . $i $tb = tb . $i
$c2Binary = $c2Binary . $i $c2Binary = $preBinary . $i
$c2Binary = $c2Binary . ' $c2Binary = $c2Binary . '
$x = 0 $x = 0
...@@ -46,23 +47,24 @@ while $i < $tblEnd ...@@ -46,23 +47,24 @@ while $i < $tblEnd
sql insert into $tb values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary ) sql insert into $tb values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary )
$x = $x + 40 $x = $x + 40
$ts = $ts + 40a $ts = $ts + 40a
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
endw endw
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
$totalRows = $totalRows + $x $totalRows = $totalRows + $x
$i = $i + 1 $i = $i + 1
endw endw
sql select count(*) from $tblStart sql select count(*) from $tb
print data00 $data00 rowsPerTbl $rowsPerTbl
if $data00 != $rowsPerTbl then if $data00 != $rowsPerTbl then
print data00 $data00 rowsPerTbl $rowsPerTbl
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ************ client-02 insert data error ***** ***** print ************ client-02 insert data into $tb error ***** *****
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return -1 return -1
endi endi
$loop_cnt = $loop_cnt + 1
goto loop_run goto loop_run
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
$tblStart = 0 $tblStart = 0
$tblEnd = 10000 $tblEnd = 10000
$tsStart = 1325347200000 # 2012-01-01 00:00:00.000 $tsStart = 1325347200000 # 2012-01-01 00:00:00.000
$c2Binary = ' . client-03- $preBinary = ' . client-03-
$t2Binary = ' . client-03-
############################################################### ###############################################################
sql connect sql connect
...@@ -33,16 +32,17 @@ $rowsPerTbl = 0 ...@@ -33,16 +32,17 @@ $rowsPerTbl = 0
$ts = $tsStart $ts = $tsStart
$rowsPerLoop = 160 $rowsPerLoop = 160
$loop_cnt = 0
loop_run: loop_run:
print ================ client-03 start loop insert data print ================ client-03 start loop insert data ( loop_cnt: $loop_cnt )
$i = $tblStart $i = $tblStart
while $i < $tblEnd while $i < $tblEnd
$tb = tb . $i $tb = tb . $i
$t2Binary = ' . $i $t2Binary = $preBinary . $i
$t2Binary = $t2Binary . ' $t2Binary = $t2Binary . '
$c2Binary = $c2Binary . $i $c2Binary = $preBinary . $i
$c2Binary = $c2Binary . ' $c2Binary = $c2Binary . '
$x = 0 $x = 0
...@@ -51,32 +51,33 @@ while $i < $tblEnd ...@@ -51,32 +51,33 @@ while $i < $tblEnd
sql insert into $tb using $stb tags ( $i , $t2Binary ) values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary ) sql insert into $tb using $stb tags ( $i , $t2Binary ) values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary )
$x = $x + 40 $x = $x + 40
$ts = $ts + 40a $ts = $ts + 40a
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
endw endw
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
$totalRows = $totalRows + $x $totalRows = $totalRows + $x
$i = $i + 1 $i = $i + 1
endw endw
sql select count(*) from $tblStart sql select count(*) from $tb
print data00 $data00 rowsPerTbl $rowsPerTbl
if $data00 != $rowsPerTbl then if $data00 != $rowsPerTbl then
print data00 $data00 rowsPerTbl $rowsPerTbl
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ****** client-3 insert data into $tblStart error *** print ****** client-3 insert data into $tb error ***
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return -1 return -1
endi endi
sql select count(*) from $stb sql select count(*) from $stb
print data00 $data00 totalRows $totalRows
if $data00 != $totalRows then if $data00 != $totalRows then
print data00 $data00 totalRows $totalRows
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ***** client-3 insert data into $stbl error ******** print ***** client-3 insert data into $stbl error ********
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return -1 return -1
endi endi
$loop_cnt = $loop_cnt + 1
goto loop_run goto loop_run
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
$tblStart = 0 $tblStart = 0
$tblEnd = 10000 $tblEnd = 10000
$tsStart = 1325347200000 # 2012-01-01 00:00:00.000 $tsStart = 1325347200000 # 2012-01-01 00:00:00.000
$c2Binary = ' . client-04- $preBinary = ' . client-04-
############################################################### ###############################################################
$totalRows = 0 $totalRows = 0
...@@ -35,13 +35,13 @@ $rowsPerLoop = 160 ...@@ -35,13 +35,13 @@ $rowsPerLoop = 160
$loopCnt = 0 $loopCnt = 0
loop_run: loop_run:
print ================ client-04 start loop insert data print ================ client-04 start loop insert data ( loopCnt: $loopCnt )
$i = $tblStart $i = $tblStart
while $i < $tblEnd while $i < $tblEnd
$tb = tb . $i $tb = tb . $i
$c2Binary = $c2Binary . $i $c2Binary = $preBinary . $i
$c2Binary = $c2Binary . ' $c2Binary = $c2Binary . '
$x = 0 $x = 0
...@@ -50,22 +50,22 @@ while $i < $tblEnd ...@@ -50,22 +50,22 @@ while $i < $tblEnd
sql insert into $tb values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary ) sql insert into $tb values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary )
$x = $x + 40 $x = $x + 40
$ts = $ts + 40a $ts = $ts + 40a
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
endw endw
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
$totalRows = $totalRows + $x $totalRows = $totalRows + $x
$i = $i + 1 $i = $i + 1
endw endw
sql select count(*) from $tblStart sql select count(*) from $tb
print data00 $data00 rowsPerTbl $rowsPerTbl
if $data00 != $rowsPerTbl then if $data00 != $rowsPerTbl then
print data00 $data00 rowsPerTbl $rowsPerTbl print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ************ client-04 insert data into $tb error ***** *****
print ************ client-04 insert data error ***** ***** print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return -1 return -1
endi endi
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
$tblStart = 0 $tblStart = 0
$tblEnd = 10000 $tblEnd = 10000
$tsStart = 1325347200000 # 2012-01-01 00:00:00.000 $tsStart = 1325347200000 # 2012-01-01 00:00:00.000
$c2Binary = ' . client-05- $preBinary = ' . client-05-
############################################################### ###############################################################
$totalRows = 0 $totalRows = 0
...@@ -35,12 +35,12 @@ $rowsPerLoop = 160 ...@@ -35,12 +35,12 @@ $rowsPerLoop = 160
$loopCnt = 0 $loopCnt = 0
loop_run: loop_run:
print ================ client-05 start loop insert data print ================ client-05 start loop insert data ( loopCnt: $loopCnt )
$i = $tblStart $i = $tblStart
while $i < $tblEnd while $i < $tblEnd
$tb = tb . $i $tb = tb . $i
$c2Binary = $c2Binary . $i $c2Binary = $preBinary . $i
$c2Binary = $c2Binary . ' $c2Binary = $c2Binary . '
$x = 0 $x = 0
...@@ -49,22 +49,22 @@ while $i < $tblEnd ...@@ -49,22 +49,22 @@ while $i < $tblEnd
sql insert into $tb values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary ) sql insert into $tb values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary )
$x = $x + 40 $x = $x + 40
$ts = $ts + 40a $ts = $ts + 40a
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
endw endw
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
$totalRows = $totalRows + $x $totalRows = $totalRows + $x
$i = $i + 1 $i = $i + 1
endw endw
sql select count(*) from $tblStart sql select count(*) from $tb
print data00 $data00 rowsPerTbl $rowsPerTbl
if $data00 != $rowsPerTbl then if $data00 != $rowsPerTbl then
print data00 $data00 rowsPerTbl $rowsPerTbl print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ************ client-05 insert data into $tb error ***** *****
print ************ client-05 insert data error ***** ***** print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return -1 return -1
endi endi
......
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
$tblStart = 0 $tblStart = 0
$tblEnd = 10000 $tblEnd = 10000
$tsStart = 1325347200000 # 2012-01-01 00:00:00.000 $tsStart = 1325347200000 # 2012-01-01 00:00:00.000
$c2Binary = ' . client-06- $preBinary = ' . client-06-
$numPerUpdateTbl = 2000 $numPerUpdateTbl = 2000
############################################################### ###############################################################
$totalRows = 0
$totalRows = 0 $dropTblStart = $tblStart
$dropTblEnd = $dropTblStart
sql connect sql connect
...@@ -20,7 +21,7 @@ sql create database if not exists $db replica 2 ...@@ -20,7 +21,7 @@ sql create database if not exists $db replica 2
sql use $db sql use $db
init_lable: init_lable:
print ================ create table $tb (ts timestamp, c1 int, c2 binary(16)) print ================ create table [ from $tblStart to $tblEnd ] (ts timestamp, c1 int, c2 binary(16))
$i = $tblStart $i = $tblStart
while $i < $tblEnd while $i < $tblEnd
...@@ -30,8 +31,8 @@ while $i < $tblEnd ...@@ -30,8 +31,8 @@ while $i < $tblEnd
$i = $i + 1 $i = $i + 1
endw endw
$dropTblStart = $tblStart $dropTblStart = $dropTblEnd
$dropTblEnd = $tblStart + $numPerUpdateTbl $dropTblEnd = $dropTblStart + $numPerUpdateTbl
$tblStart = $tblEnd $tblStart = $tblEnd
$tblEnd = $tblEnd + $numPerUpdateTbl $tblEnd = $tblEnd + $numPerUpdateTbl
...@@ -43,12 +44,12 @@ $rowsPerLoop = 160 ...@@ -43,12 +44,12 @@ $rowsPerLoop = 160
$loopCnt = 0 $loopCnt = 0
loop_run: loop_run:
print ================ client-06 start loop insert data print ================ client-06 start loop insert data from $dropTblStart to $tblStart ( loopCnt: $loopCnt )
$i = $dropTblStart $i = $dropTblStart
while $i < $tblEnd while $i < $tblStart
$tb = tb . $i $tb = tb . $i
$c2Binary = $c2Binary . $i $c2Binary = $preBinary . $i
$c2Binary = $c2Binary . ' $c2Binary = $c2Binary . '
$x = 0 $x = 0
...@@ -57,29 +58,29 @@ while $i < $tblEnd ...@@ -57,29 +58,29 @@ while $i < $tblEnd
sql insert into $tb values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary ) sql insert into $tb values ( $ts + 1a , $x , $c2Binary ) ( $ts + 3a , $x , $c2Binary ) ( $ts + 5a , $x , $c2Binary ) ( $ts + 7a , $x , $c2Binary ) ( $ts + 9a , $x , $c2Binary ) ( $ts + 11a , $x , $c2Binary ) ( $ts + 13a , $x , $c2Binary ) ( $ts + 15a , $x , $c2Binary ) ( $ts + 17a , $x , $c2Binary ) ( $ts + 19a , $x , $c2Binary ) ( $ts + 21a , $x , $c2Binary ) ( $ts + 23a , $x , $c2Binary ) ( $ts + 25a , $x , $c2Binary ) ( $ts + 27a , $x , $c2Binary ) ( $ts + 29a , $x , $c2Binary ) ( $ts + 31a , $x , $c2Binary ) ( $ts + 33a , $x , $c2Binary ) ( $ts + 35a , $x , $c2Binary ) ( $ts + 37a , $x , $c2Binary ) ( $ts + 39a , $x , $c2Binary )
$x = $x + 40 $x = $x + 40
$ts = $ts + 40a $ts = $ts + 40a
if $i == $tblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
endw endw
if $i == $dropTblStart then
$rowsPerTbl = $rowsPerTbl + $x
endi
$totalRows = $totalRows + $x $totalRows = $totalRows + $x
$i = $i + 1 $i = $i + 1
endw endw
sql select count(*) from $tblStart sql select count(*) from $tb
print data00 $data00 rowsPerTbl $rowsPerTbl
if $data00 != $rowsPerTbl then if $data00 != $rowsPerTbl then
print data00 $data00 rowsPerTbl $rowsPerTbl print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ print ************ client-06 insert data into $tb error ***** *****
print ************ client-06 insert data error ***** ***** print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
print ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
return -1 return -1
endi endi
$loopCnt = $loopCnt + 1 $loopCnt = $loopCnt + 1
if $loopCnt > 100 then if $loopCnt > 2 then
print ================ client-06 drop table from $dropTblStart to $dropTblEnd
$i = $dropTblStart $i = $dropTblStart
while $i < $dropTblEnd while $i < $dropTblEnd
$tb = tb . $i $tb = tb . $i
...@@ -87,7 +88,7 @@ if $loopCnt > 100 then ...@@ -87,7 +88,7 @@ if $loopCnt > 100 then
$i = $i + 1 $i = $i + 1
$totalRows = $totalRows - $rowsPerTbl $totalRows = $totalRows - $rowsPerTbl
endw endw
sleep 20000 sleep 10000
goto init_lable goto init_lable
endi endi
......
...@@ -91,14 +91,14 @@ sql create dnode $hostname3 ...@@ -91,14 +91,14 @@ sql create dnode $hostname3
sleep 3000 sleep 3000
sleep 3000 sleep 3000
print ============== step3: start back client-01.sim print ============== step3: start back client-01.sim
run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim #run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-02.sim
#run_back unique/clusterSimCase/client-03.sim
#run_back unique/clusterSimCase/client-04.sim
#run_back unique/clusterSimCase/client-05.sim
#run_back unique/clusterSimCase/client-06.sim
#run_back unique/clusterSimCase/client-07.sim
run_back unique/clusterSimCase/client-08.sim
#run_back unique/clusterSimCase/client-01.sim #run_back unique/clusterSimCase/client-01.sim
#run_back unique/clusterSimCase/client-01.sim #run_back unique/clusterSimCase/client-01.sim
sleep 20000 sleep 20000
...@@ -242,4 +242,7 @@ endi ...@@ -242,4 +242,7 @@ endi
sleep 3000 sleep 3000
print **** **** **** (loop_cnt: $loop_cnt ) end, continue...... **** **** **** **** print **** **** **** (loop_cnt: $loop_cnt ) end, continue...... **** **** **** ****
$loop_cnt = $loop_cnt + 1 $loop_cnt = $loop_cnt + 1
if $loop_cnt == 50 then
return 0
endi
goto loop_cluster_do goto loop_cluster_do
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册