Merge branch 'develop' into hotfix/mgmt
This commit is contained in:
commit
ad721970e3
|
@ -53,10 +53,11 @@ STable从属于库,一个STable只属于一个库,但一个库可以有一
|
|||
|
||||
说明:
|
||||
|
||||
1. TAGS列总长度不能超过512 bytes;
|
||||
1. TAGS列总长度不能超过64k bytes;
|
||||
2. TAGS列的数据类型不能是timestamp;
|
||||
3. TAGS列名不能与其他列名相同;
|
||||
4. TAGS列名不能为预留关键字.
|
||||
5. TAGS总数的上限是128.
|
||||
|
||||
- 显示已创建的超级表
|
||||
|
||||
|
@ -114,7 +115,7 @@ INSERT INTO <tb1_name> USING <stb1_name> TAGS (<tag1_value1>, ...) VALUES (<fiel
|
|||
ALTER TABLE <stable_name> ADD TAG <new_tag_name> <TYPE>
|
||||
```
|
||||
|
||||
为STable增加一个新的标签,并指定新标签的类型。标签总数不能超过6个。
|
||||
为STable增加一个新的标签,并指定新标签的类型。标签总数不能超过128个。
|
||||
|
||||
- 删除标签
|
||||
|
||||
|
@ -202,7 +203,7 @@ INSERT INTO therm4 VALUES ('2018-01-01 00:00:00.000', 23);
|
|||
|
||||
###3:按标签聚合查询
|
||||
|
||||
查询位于北京(beijing)和天津(tianjing)两个地区的温度传感器采样值的数量count(*)、平均温度avg(degree)、最高温度max(degree)、最低温度min(degree),并将结果按所处地域(location)和传感器类型(type)进行聚合。
|
||||
查询位于北京(beijing)和天津(tianjin)两个地区的温度传感器采样值的数量count(*)、平均温度avg(degree)、最高温度max(degree)、最低温度min(degree),并将结果按所处地域(location)和传感器类型(type)进行聚合。
|
||||
|
||||
```mysql
|
||||
SELECT COUNT(*), AVG(degree), MAX(degree), MIN(degree)
|
||||
|
|
|
@ -22,11 +22,11 @@ New keyword "tags" is introduced, where tag_name is the tag name, and tag_type i
|
|||
|
||||
Note:
|
||||
|
||||
1. The bytes of all tags together shall be less than 512
|
||||
1. The bytes of all tags together shall be less than 64k
|
||||
2. Tag's data type can not be time stamp
|
||||
3. Tag name shall be different from the field name
|
||||
4. Tag name shall not be the same as system keywords
|
||||
5. Maximum number of tags is 6
|
||||
5. Maximum number of tags is 128
|
||||
|
||||
For example:
|
||||
|
||||
|
@ -168,7 +168,7 @@ You can add, delete and change the tags for a STable, and you can change the tag
|
|||
ALTER TABLE <stable_name> ADD TAG <new_tag_name> <TYPE>
|
||||
```
|
||||
|
||||
It adds a new tag to the STable with a data type. The maximum number of tags is 6.
|
||||
It adds a new tag to the STable with a data type. The maximum number of tags is 128.
|
||||
|
||||
### Drop a Tag
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic
|
|||
| 3 | BIGINT | 8 | 长整型,范围 [-2^63+1, 2^63-1], -2^63用于NULL |
|
||||
| 4 | FLOAT | 4 | 浮点型,有效位数6-7,范围 [-3.4E38, 3.4E38] |
|
||||
| 5 | DOUBLE | 8 | 双精度浮点型,有效位数15-16,范围 [-1.7E308, 1.7E308] |
|
||||
| 6 | BINARY | 自定义 | 用于记录字符串,最长不能超过504 bytes。binary仅支持字符串输入,字符串两端使用单引号引用,否则英文全部自动转化为小写。使用时须指定大小,如binary(20)定义了最长为20个字符的字符串,每个字符占1byte的存储空间。如果用户字符串超出20字节,将被自动截断。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示, 即 **\’**。 |
|
||||
| 6 | BINARY | 自定义 | 用于记录字符串,理论上,最长可以有65526字节,但由于每行数据最多64K字节,实际上限一般小于理论值。 binary仅支持字符串输入,字符串两端使用单引号引用,否则英文全部自动转化为小写。使用时须指定大小,如binary(20)定义了最长为20个字符的字符串,每个字符占1byte的存储空间。如果用户字符串超出20字节,将被自动截断。对于字符串内的单引号,可以用转义字符反斜线加单引号来表示, 即 **\’**。 |
|
||||
| 7 | SMALLINT | 2 | 短整型, 范围 [-32767, 32767], -32768用于NULL |
|
||||
| 8 | TINYINT | 1 | 单字节整型,范围 [-127, 127], -128用于NULL |
|
||||
| 9 | BOOL | 1 | 布尔型,{true, false} |
|
||||
|
@ -106,7 +106,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic
|
|||
```mysql
|
||||
CREATE TABLE [IF NOT EXISTS] tb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...])
|
||||
```
|
||||
说明:1)表的第一个字段必须是TIMESTAMP,并且系统自动将其设为主键;2)表的每行长度不能超过4096字节;3)使用数据类型binary或nchar,需指定其最长的字节数,如binary(20),表示20字节。
|
||||
说明:1)表的第一个字段必须是TIMESTAMP,并且系统自动将其设为主键;2)表的每行长度不能超过64K字节;3)使用数据类型binary或nchar,需指定其最长的字节数,如binary(20),表示20字节。
|
||||
|
||||
|
||||
- **删除数据表**
|
||||
|
@ -402,7 +402,7 @@ count(tbname) |
|
|||
SELECT * FROM tb1 WHERE ts >= NOW - 1h
|
||||
```
|
||||
|
||||
- 查询表tb1从2018-06-01 08:00:00.000 到2018-06-02 08:00:00.000时间范围,并且clo3的字符串是'nny'结尾的记录,结果按照时间戳降序
|
||||
- 查询表tb1从2018-06-01 08:00:00.000 到2018-06-02 08:00:00.000时间范围,并且col3的字符串是'nny'结尾的记录,结果按照时间戳降序
|
||||
|
||||
```mysql
|
||||
SELECT * FROM tb1 WHERE ts > '2018-06-01 08:00:00.000' AND ts <= '2018-06-02 08:00:00.000' AND col3 LIKE '%nny' ORDER BY ts DESC
|
||||
|
|
|
@ -39,7 +39,7 @@ The full list of data types is listed below. For string types of data, we will
|
|||
| 6 | DOUBLE | 8 | A standard nullable double float type with 15-16 significant digits and a range of [-1.7E308, 1.7E308] |
|
||||
| 7 | BOOL | 1 | A nullable boolean type, [**`true`**, **`false`**] |
|
||||
| 8 | TIMESTAMP | 8 | A nullable timestamp type with the same usage as the primary column timestamp |
|
||||
| 9 | BINARY(*M*) | *M* | A nullable string type whose length is *M*, any exceeded chars will be automatically truncated. This type of string only supports ASCii encoded chars. |
|
||||
| 9 | BINARY(*M*) | *M* | A nullable string type whose length is *M*, any exceeded chars will be automatically truncated, the maximum length of *M* is 65526, but as maximum row size is 64K bytes, the actual upper limit will generally less than 65526. This type of string only supports ASCii encoded chars. |
|
||||
| 10 | NCHAR(*M*) | 4 * *M* | A nullable string type whose length is *M*, any exceeded chars will be truncated. The **`NCHAR`** type supports Unicode encoded chars. |
|
||||
|
||||
All the keywords in a SQL statement are case-insensitive, but strings values are case-sensitive and must be quoted by a pair of `'` or `"`. To quote a `'` or a `"` , you can use the escape character `\`.
|
||||
|
@ -86,7 +86,7 @@ All the keywords in a SQL statement are case-insensitive, but strings values are
|
|||
|
||||
1) The first column must be a `timestamp`, and the system will set it as the primary key.
|
||||
|
||||
2) The record size is limited to 4096 bytes
|
||||
2) The record size is limited to 64k bytes
|
||||
|
||||
3) For `binary` or `nchar` data types, the length must be specified. For example, binary(20) means a binary data type with 20 bytes.
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
TDengine提供了丰富的应用程序开发接口,其中包括C/C++、JAVA、Python、RESTful、Go等,便于用户快速开发应用。
|
||||
|
||||
注意:所以执行 SQL 语句的 API,例如 C/C++ Connector 中的 `tao_query`、`taos_query_a`、`taos_subscribe` 等,以及其它语言中与它们对应的API,每次都只能执行一条 SQL 语句,如果实际参数中包含了多条语句,它们的行为是未定义的。
|
||||
注意:所有执行 SQL 语句的 API,例如 C/C++ Connector 中的 `tao_query`、`taos_query_a`、`taos_subscribe` 等,以及其它语言中与它们对应的API,每次都只能执行一条 SQL 语句,如果实际参数中包含了多条语句,它们的行为是未定义的。
|
||||
|
||||
## C/C++ Connector
|
||||
|
||||
|
|
|
@ -1764,6 +1764,11 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
|
|||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* assign the callback function to fetchFp to make sure that the error process function can restore
|
||||
* the callback function (multiVnodeInsertMerge) correctly.
|
||||
*/
|
||||
pNew->fetchFp = pNew->fp;
|
||||
pSql->pSubs[i] = pNew;
|
||||
tscTrace("%p sub:%p create subObj success. orderOfSub:%d", pSql, pNew, i);
|
||||
}
|
||||
|
@ -1888,11 +1893,14 @@ static void transferNcharData(SSqlObj *pSql, int32_t columnIndex, TAOS_FIELD *pF
|
|||
/* string terminated char for binary data*/
|
||||
memset(pRes->buffer[columnIndex], 0, pField->bytes + TSDB_NCHAR_SIZE);
|
||||
|
||||
if (taosUcs4ToMbs(pRes->tsrow[columnIndex], pField->bytes - VARSTR_HEADER_SIZE, pRes->buffer[columnIndex])) {
|
||||
int32_t length = taosUcs4ToMbs(pRes->tsrow[columnIndex], pRes->length[columnIndex], pRes->buffer[columnIndex]);
|
||||
if ( length >= 0 ) {
|
||||
pRes->tsrow[columnIndex] = pRes->buffer[columnIndex];
|
||||
pRes->length[columnIndex] = length;
|
||||
} else {
|
||||
tscError("%p charset:%s to %s. val:%ls convert failed.", pSql, DEFAULT_UNICODE_ENCODEC, tsCharset, pRes->tsrow[columnIndex]);
|
||||
pRes->tsrow[columnIndex] = NULL;
|
||||
pRes->length[columnIndex] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@ void get_history_path(char* history);
|
|||
void cleanup_handler(void* arg);
|
||||
void exitShell();
|
||||
int shellDumpResult(TAOS* con, char* fname, int* error_no, bool printMode);
|
||||
void shellPrintNChar(const char* str, int length, int width);
|
||||
void shellGetGrantInfo(void *con);
|
||||
int isCommentLine(char *line);
|
||||
|
||||
|
|
|
@ -349,31 +349,6 @@ void *shellLoopQuery(void *arg) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void shellPrintNChar(const char *str, int length, int width) {
|
||||
int pos = 0, cols = 0;
|
||||
while (pos < length) {
|
||||
wchar_t wc;
|
||||
pos += mbtowc(&wc, str + pos, MB_CUR_MAX);
|
||||
if (pos > length) {
|
||||
break;
|
||||
}
|
||||
|
||||
int w = wcwidth(wc);
|
||||
if (w > 0) {
|
||||
if (width > 0 && cols + w > width) {
|
||||
break;
|
||||
}
|
||||
printf("%lc", wc);
|
||||
cols += w;
|
||||
}
|
||||
}
|
||||
|
||||
for (; cols < width; cols++) {
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int get_old_terminal_mode(struct termios *tio) {
|
||||
/* Make sure stdin is a terminal. */
|
||||
if (!isatty(STDIN_FILENO)) {
|
||||
|
|
|
@ -435,7 +435,6 @@ static int dumpResultToFile(const char* fname, TAOS_RES* result) {
|
|||
|
||||
int num_fields = taos_num_fields(result);
|
||||
TAOS_FIELD *fields = taos_fetch_fields(result);
|
||||
int32_t* length = taos_fetch_lengths(result);
|
||||
int precision = taos_result_precision(result);
|
||||
|
||||
for (int col = 0; col < num_fields; col++) {
|
||||
|
@ -448,6 +447,7 @@ static int dumpResultToFile(const char* fname, TAOS_RES* result) {
|
|||
|
||||
int numOfRows = 0;
|
||||
do {
|
||||
int32_t* length = taos_fetch_lengths(result);
|
||||
for (int i = 0; i < num_fields; i++) {
|
||||
if (i > 0) {
|
||||
fputc(',', fp);
|
||||
|
@ -465,6 +465,39 @@ static int dumpResultToFile(const char* fname, TAOS_RES* result) {
|
|||
}
|
||||
|
||||
|
||||
static void shellPrintNChar(const char *str, int length, int width) {
|
||||
int pos = 0, cols = 0;
|
||||
while (pos < length) {
|
||||
wchar_t wc;
|
||||
int bytes = mbtowc(&wc, str + pos, MB_CUR_MAX);
|
||||
if (bytes == 0) {
|
||||
break;
|
||||
}
|
||||
pos += bytes;
|
||||
if (pos > length) {
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef WINDOWS
|
||||
int w = bytes;
|
||||
#else
|
||||
int w = wcwidth(wc);
|
||||
#endif
|
||||
if (w > 0) {
|
||||
if (width > 0 && cols + w > width) {
|
||||
break;
|
||||
}
|
||||
printf("%lc", wc);
|
||||
cols += w;
|
||||
}
|
||||
}
|
||||
|
||||
for (; cols < width; cols++) {
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void printField(const char* val, TAOS_FIELD* field, int width, int32_t length, int precision) {
|
||||
if (val == NULL) {
|
||||
int w = width;
|
||||
|
@ -523,7 +556,6 @@ static int verticalPrintResult(TAOS_RES* result) {
|
|||
|
||||
int num_fields = taos_num_fields(result);
|
||||
TAOS_FIELD *fields = taos_fetch_fields(result);
|
||||
int32_t* length = taos_fetch_lengths(result);
|
||||
int precision = taos_result_precision(result);
|
||||
|
||||
int maxColNameLen = 0;
|
||||
|
@ -537,6 +569,7 @@ static int verticalPrintResult(TAOS_RES* result) {
|
|||
int numOfRows = 0;
|
||||
do {
|
||||
printf("*************************** %d.row ***************************\n", numOfRows + 1);
|
||||
int32_t* length = taos_fetch_lengths(result);
|
||||
for (int i = 0; i < num_fields; i++) {
|
||||
TAOS_FIELD* field = fields + i;
|
||||
|
||||
|
@ -631,7 +664,6 @@ static int horizontalPrintResult(TAOS_RES* result) {
|
|||
|
||||
int num_fields = taos_num_fields(result);
|
||||
TAOS_FIELD *fields = taos_fetch_fields(result);
|
||||
int32_t* length = taos_fetch_lengths(result);
|
||||
int precision = taos_result_precision(result);
|
||||
|
||||
int width[TSDB_MAX_COLUMNS];
|
||||
|
@ -643,6 +675,7 @@ static int horizontalPrintResult(TAOS_RES* result) {
|
|||
|
||||
int numOfRows = 0;
|
||||
do {
|
||||
int32_t* length = taos_fetch_lengths(result);
|
||||
for (int i = 0; i < num_fields; i++) {
|
||||
putchar(' ');
|
||||
printField(row[i], fields + i, width[i], length[i], precision);
|
||||
|
|
|
@ -323,30 +323,6 @@ void *shellLoopQuery(void *arg) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void shellPrintNChar(const char *str, int length, int width) {
|
||||
int pos = 0, cols = 0;
|
||||
while (pos < length) {
|
||||
wchar_t wc;
|
||||
pos += mbtowc(&wc, str + pos, MB_CUR_MAX);
|
||||
if (pos > length) {
|
||||
break;
|
||||
}
|
||||
|
||||
int w = wcwidth(wc);
|
||||
if (w > 0) {
|
||||
if (width > 0 && cols + w > width) {
|
||||
break;
|
||||
}
|
||||
printf("%lc", wc);
|
||||
cols += w;
|
||||
}
|
||||
}
|
||||
|
||||
for (; cols < width; cols++) {
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
int get_old_terminal_mode(struct termios *tio) {
|
||||
/* Make sure stdin is a terminal. */
|
||||
if (!isatty(STDIN_FILENO)) {
|
||||
|
|
|
@ -214,32 +214,6 @@ void *shellLoopQuery(void *arg) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void shellPrintNChar(const char *str, int length, int width) {
|
||||
int pos = 0, cols = 0;
|
||||
while (pos < length) {
|
||||
wchar_t wc;
|
||||
int bytes = mbtowc(&wc, str + pos, MB_CUR_MAX);
|
||||
pos += bytes;
|
||||
if (pos > length) {
|
||||
break;
|
||||
}
|
||||
|
||||
int w = bytes;
|
||||
if (w > 0) {
|
||||
if (width > 0 && cols + w > width) {
|
||||
break;
|
||||
}
|
||||
printf("%lc", wc);
|
||||
cols += w;
|
||||
}
|
||||
}
|
||||
|
||||
for (; cols < width; cols++) {
|
||||
putchar(' ');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void get_history_path(char *history) { sprintf(history, "%s/%s", ".", HISTORY_FILE); }
|
||||
|
||||
void exitShell() { exit(EXIT_SUCCESS); }
|
||||
|
|
|
@ -239,7 +239,10 @@ static int32_t mnodeChildTableActionDecode(SSdbOper *pOper) {
|
|||
if (pTable == NULL) return TSDB_CODE_SERV_OUT_OF_MEMORY;
|
||||
|
||||
int32_t len = strlen(pOper->rowData);
|
||||
if (len > TSDB_TABLE_ID_LEN) return TSDB_CODE_INVALID_TABLE_ID;
|
||||
if (len > TSDB_TABLE_ID_LEN) {
|
||||
free(pTable);
|
||||
return TSDB_CODE_INVALID_TABLE_ID;
|
||||
}
|
||||
pTable->info.tableId = strdup(pOper->rowData);
|
||||
len++;
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ bool taosMbsToUcs4(char *mbs, size_t mbs_len, char *ucs4, int32_t ucs4_max_len,
|
|||
|
||||
int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes);
|
||||
|
||||
bool taosUcs4ToMbs(void *ucs4, int32_t ucs4_max_len, char *mbs);
|
||||
int32_t taosUcs4ToMbs(void *ucs4, int32_t ucs4_max_len, char *mbs);
|
||||
|
||||
bool taosValidateEncodec(const char *encodec);
|
||||
|
||||
|
|
|
@ -447,10 +447,10 @@ int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes) {
|
|||
int32_t ucs4_max_len = bytes + 4;
|
||||
char *f1_mbs = calloc(bytes, 1);
|
||||
char *f2_mbs = calloc(bytes, 1);
|
||||
if (!taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs)) {
|
||||
if (taosUcs4ToMbs(f1_ucs4, ucs4_max_len, f1_mbs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (!taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs)) {
|
||||
if (taosUcs4ToMbs(f2_ucs4, ucs4_max_len, f2_mbs) < 0) {
|
||||
return -1;
|
||||
}
|
||||
int32_t ret = strcmp(f1_mbs, f2_mbs);
|
||||
|
@ -464,29 +464,29 @@ int tasoUcs4Compare(void* f1_ucs4, void *f2_ucs4, int bytes) {
|
|||
#endif
|
||||
}
|
||||
|
||||
bool taosUcs4ToMbs(void *ucs4, int32_t ucs4_max_len, char *mbs) {
|
||||
int32_t taosUcs4ToMbs(void *ucs4, int32_t ucs4_max_len, char *mbs) {
|
||||
#ifdef USE_LIBICONV
|
||||
iconv_t cd = iconv_open(tsCharset, DEFAULT_UNICODE_ENCODEC);
|
||||
size_t ucs4_input_len = ucs4_max_len;
|
||||
size_t outLen = ucs4_max_len;
|
||||
if (iconv(cd, (char **)&ucs4, &ucs4_input_len, &mbs, &outLen) == -1) {
|
||||
iconv_close(cd);
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
iconv_close(cd);
|
||||
return true;
|
||||
return (int32_t)(ucs4_max_len - outLen);
|
||||
#else
|
||||
mbstate_t state = {0};
|
||||
int32_t len = (int32_t) wcsnrtombs(NULL, (const wchar_t **) &ucs4, ucs4_max_len / 4, 0, &state);
|
||||
if (len < 0) {
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
memset(&state, 0, sizeof(state));
|
||||
len = wcsnrtombs(mbs, (const wchar_t **) &ucs4, ucs4_max_len / 4, (size_t) len, &state);
|
||||
if (len < 0) {
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
return true;
|
||||
return len;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,266 @@
|
|||
system sh/stop_dnodes.sh
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/deploy.sh -n dnode2 -i 2
|
||||
system sh/deploy.sh -n dnode3 -i 3
|
||||
system sh/deploy.sh -n dnode4 -i 4
|
||||
system sh/deploy.sh -n dnode5 -i 5
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 1
|
||||
system sh/cfg.sh -n dnode2 -c numOfMPeers -v 1
|
||||
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 1
|
||||
system sh/cfg.sh -n dnode4 -c numOfMPeers -v 1
|
||||
system sh/cfg.sh -n dnode5 -c numOfMPeers -v 1
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c walLevel -v 1
|
||||
system sh/cfg.sh -n dnode2 -c walLevel -v 1
|
||||
system sh/cfg.sh -n dnode3 -c walLevel -v 1
|
||||
system sh/cfg.sh -n dnode4 -c walLevel -v 1
|
||||
system sh/cfg.sh -n dnode5 -c walLevel -v 1
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
|
||||
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
|
||||
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
|
||||
system sh/cfg.sh -n dnode4 -c balanceInterval -v 10
|
||||
system sh/cfg.sh -n dnode5 -c balanceInterval -v 10
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 200
|
||||
system sh/cfg.sh -n dnode2 -c numOfTotalVnodes -v 4
|
||||
system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
|
||||
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
|
||||
system sh/cfg.sh -n dnode5 -c numOfTotalVnodes -v 4
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c mgmtEqualVnodeNum -v 200
|
||||
#system sh/cfg.sh -n dnode2 -c mgmtEqualVnodeNum -v 200
|
||||
#system sh/cfg.sh -n dnode3 -c mgmtEqualVnodeNum -v 200
|
||||
#system sh/cfg.sh -n dnode4 -c mgmtEqualVnodeNum -v 200
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
||||
system sh/cfg.sh -n dnode5 -c arbitrator -v $arbitrator
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c offlineThreshold -v 20
|
||||
system sh/cfg.sh -n dnode2 -c offlineThreshold -v 20
|
||||
system sh/cfg.sh -n dnode3 -c offlineThreshold -v 20
|
||||
system sh/cfg.sh -n dnode4 -c offlineThreshold -v 20
|
||||
system sh/cfg.sh -n dnode5 -c offlineThreshold -v 20
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c enableCoreFile -v 1
|
||||
system sh/cfg.sh -n dnode2 -c enableCoreFile -v 1
|
||||
system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1
|
||||
system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1
|
||||
system sh/cfg.sh -n dnode5 -c enableCoreFile -v 1
|
||||
|
||||
print ============== step0: start tarbitrator
|
||||
system sh/exec_tarbitrator.sh -s start
|
||||
|
||||
print ============== step1: start dnode1, only deploy mnode
|
||||
system sh/exec_up.sh -n dnode1 -s start
|
||||
sleep 3000
|
||||
sql connect
|
||||
|
||||
print ============== step2: start dnode2/dnode3 and add into cluster, then create database, create table , and insert data
|
||||
system sh/exec_up.sh -n dnode2 -s start
|
||||
system sh/exec_up.sh -n dnode3 -s start
|
||||
sleep 1000
|
||||
sql create dnode $hostname2
|
||||
sql create dnode $hostname3
|
||||
|
||||
$rowNum = 100
|
||||
$tblNum = 16
|
||||
$totalRows = 0
|
||||
$tsStart = 1420041600000
|
||||
|
||||
$db = db
|
||||
sql create database $db replica 2 maxTables 4
|
||||
sql use $db
|
||||
|
||||
# create table , insert data
|
||||
$stb = stb
|
||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
||||
|
||||
|
||||
$i = 0
|
||||
while $i < $tblNum
|
||||
$tb = tb . $i
|
||||
sql create table $tb using $stb tags( $i )
|
||||
|
||||
$x = 0
|
||||
while $x < $rowNum
|
||||
$ts = $tsStart + $x
|
||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
||||
$x = $x + 60
|
||||
endw
|
||||
$totalRows = $totalRows + $x
|
||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
||||
$i = $i + 1
|
||||
endw
|
||||
|
||||
print info: select count(*) from $stb
|
||||
sleep 1000
|
||||
sql reset query cache
|
||||
sleep 1000
|
||||
sql select count(*) from $stb
|
||||
print data00 $data00
|
||||
if $data00 != $totalRows then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============== step3: add one new dnode4 expect auto balancing
|
||||
system sh/exec_up.sh -n dnode4 -s start
|
||||
sql create dnode $hostname4
|
||||
sleep 10000
|
||||
sql select count(*) from $stb
|
||||
print data00 $data00
|
||||
if $data00 != $totalRows then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
print ============== step4: stop dnode3, after offlineThreshold, dnode3 will be dropped for cluster
|
||||
system sh/exec_up.sh -n dnode3 -s stop
|
||||
sql select count(*) from $stb
|
||||
print data00 $data00
|
||||
if $data00 != $totalRows then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#sleep 3000
|
||||
#sql show dnodes
|
||||
#print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
||||
#print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
||||
#print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
||||
#
|
||||
#$dnode1Status = $data4_1
|
||||
#$dnode2Status = $data4_2
|
||||
#$dnode3Status = $data4_3
|
||||
#$dnode4Status = $data4_4
|
||||
#
|
||||
#if $dnode1Status != ready then
|
||||
# return -1
|
||||
#endi
|
||||
#if $dnode2Status != ready then
|
||||
# return -1
|
||||
#endi
|
||||
#if $dnode3Status != offline then
|
||||
# return -1
|
||||
#endi
|
||||
#if $dnode4Status != ready then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
sleep 30000
|
||||
|
||||
wait_drop:
|
||||
sql show dnodes
|
||||
if $rows != 3 then
|
||||
sleep 3000
|
||||
goto wait_drop
|
||||
endi
|
||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
||||
$dnode1Status = $data4_1
|
||||
$dnode2Status = $data4_2
|
||||
$dnode3Status = $data4_3
|
||||
$dnode4Status = $data4_4
|
||||
|
||||
if $dnode1Status != ready then
|
||||
return -1
|
||||
endi
|
||||
if $dnode2Status != ready then
|
||||
return -1
|
||||
endi
|
||||
if $dnode4Status != ready then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
print ============== step5: start dnode5 and add into cluster , drop database
|
||||
sql drop database $db
|
||||
sleep 1000
|
||||
system sh/exec_up.sh -n dnode5 -s start
|
||||
sql create dnode $hostname5
|
||||
sleep 3000
|
||||
wait_dnode5:
|
||||
sql show dnodes
|
||||
if $rows != 4 then
|
||||
sleep 3000
|
||||
goto wait_dnode5
|
||||
endi
|
||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
||||
print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
||||
$dnode1Status = $data4_1
|
||||
$dnode2Status = $data4_2
|
||||
$dnode4Status = $data4_4
|
||||
$dnode5Status = $data4_5
|
||||
|
||||
if $dnode1Status != ready then
|
||||
return -1
|
||||
endi
|
||||
if $dnode2Status != ready then
|
||||
return -1
|
||||
endi
|
||||
if $dnode4Status != ready then
|
||||
return -1
|
||||
endi
|
||||
if $dnode5Status != ready then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
||||
print ============== step6: create database and table until not free vnodes
|
||||
$rowNum = 100
|
||||
$tblNum = 24
|
||||
$totalRows = 0
|
||||
$tsStart = 1420041600000
|
||||
|
||||
$db = db1
|
||||
sql create database $db replica 2 maxTables 4
|
||||
sql use $db
|
||||
$stb = stb
|
||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
||||
|
||||
|
||||
# create table , insert data
|
||||
$stb = stb
|
||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
||||
|
||||
|
||||
$i = 0
|
||||
while $i < $tblNum
|
||||
$tb = tb . $i
|
||||
sql create table $tb using $stb tags( $i )
|
||||
|
||||
$x = 0
|
||||
while $x < $rowNum
|
||||
$ts = $tsStart + $x
|
||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
||||
$x = $x + 60
|
||||
endw
|
||||
$totalRows = $totalRows + $x
|
||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
||||
$i = $i + 1
|
||||
endw
|
||||
|
||||
print info: select count(*) from $stb
|
||||
sleep 2000
|
||||
sql reset query cache
|
||||
sleep 3000
|
||||
sql select count(*) from $stb
|
||||
print data00 $data00
|
||||
if $data00 != $totalRows then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============== step7: drop dnode3, and system should prompt cannot drop dnodes
|
||||
sql_error drop dnode $hostname3
|
||||
print ============== step8: add one new table, and system should prompt 'need more dnode'
|
||||
sql_error create table tb_more using $stb tags( 1000 )
|
||||
|
Loading…
Reference in New Issue