Merge branch 'develop' into feature/TD-1925_new
This commit is contained in:
commit
e7cf98a266
|
@ -136,6 +136,13 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic
|
|||
4) 子表名只能由字母、数字和下划线组成,且不能以数字开头
|
||||
5) 使用数据类型binary或nchar,需指定其最长的字节数,如binary(20),表示20字节;
|
||||
|
||||
- **以超级表为模板创建数据表**
|
||||
|
||||
```mysql
|
||||
CREATE TABLE [IF NOT EXISTS] tb_name USING stb_name TAGS (tag_value1 [, tag_value2 ...]);
|
||||
```
|
||||
以指定的超级表为模板,指定 tags 的值来创建数据表。
|
||||
|
||||
- **删除数据表**
|
||||
|
||||
```mysql
|
||||
|
@ -190,7 +197,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic
|
|||
1) TAGS 列的数据类型不能是timestamp类型;
|
||||
2) TAGS 列名不能与其他列名相同;
|
||||
3) TAGS 列名不能为预留关键字;
|
||||
4) TAGS 最多允许128个,可以0个,总长度不超过16k个字符
|
||||
4) TAGS 最多允许128个,至少1个,总长度不超过16k个字符。
|
||||
|
||||
- **删除超级表**
|
||||
|
||||
|
@ -551,8 +558,8 @@ Query OK, 1 row(s) in set (0.001091s)
|
|||
| % | match with any char sequences | **`binary`** **`nchar`** |
|
||||
| _ | match with a single char | **`binary`** **`nchar`** |
|
||||
|
||||
1. 同时进行多个字段的范围过滤需要使用关键词AND进行连接不同的查询条件,暂不支持OR连接的不同列之间的查询过滤条件。
|
||||
2. 针对某一字段的过滤只支持单一时间区间过滤条件。但是针对其他的(普通)列或标签列,可以使用``` OR``` 条件进行组合条件的查询过滤。例如:((value > 20 and value < 30) OR (value < 12)) 。
|
||||
1. 同时进行多个字段的范围过滤,需要使用关键词 AND 来连接不同的查询条件,暂不支持 OR 连接的不同列之间的查询过滤条件。
|
||||
2. 针对单一字段的过滤,如果是时间过滤条件,则一条语句中只支持设定一个;但针对其他的(普通)列或标签列,则可以使用``` OR``` 关键字进行组合条件的查询过滤。例如:((value > 20 and value < 30) OR (value < 12)) 。
|
||||
|
||||
### SQL 示例
|
||||
|
||||
|
@ -648,7 +655,7 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
|
|||
功能说明:时间加权平均函数。统计表/超级表中某列在一段时间内的时间加权平均。
|
||||
返回结果数据类型:双精度浮点数Double。
|
||||
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
|
||||
说明:时间加权平均(time weighted average, TWA)查询需要指定查询时间段的 _开始时间_ 和 _结束时间_ 。
|
||||
说明:时间加权平均(time weighted average, TWA)查询需要指定查询时间段的 _开始时间_ 和 _结束时间_ 。
|
||||
适用于:表、超级表。
|
||||
|
||||
- **SUM**
|
||||
|
|
|
@ -105,7 +105,7 @@ taosd -C
|
|||
- queryBufferSize: 为所有并发查询占用保留的内存大小。计算规则可以根据实际应用可能的最大并发数和表的数字相乘,再乘 170 。单位为字节。
|
||||
- ratioOfQueryCores: 设置查询线程的最大数量。最小值0 表示只有1个查询线程;最大值2表示最大建立2倍CPU核数的查询线程。默认为1,表示最大和CPU核数相等的查询线程。该值可以为小数,即0.5表示最大建立CPU核数一半的查询线程。
|
||||
|
||||
**注意:**对于端口,TDengine会使用从serverPort起13个连续的TCP和UDP端口号,请务必在防火墙打开。因此如果是缺省配置,需要打开从6030都6042共13个端口,而且必须TCP和UDP都打开。
|
||||
**注意:**对于端口,TDengine会使用从serverPort起13个连续的TCP和UDP端口号,请务必在防火墙打开。因此如果是缺省配置,需要打开从6030到6042共13个端口,而且必须TCP和UDP都打开。
|
||||
|
||||
不同应用场景的数据往往具有不同的数据特征,比如保留天数、副本数、采集频次、记录大小、采集点的数量、压缩等都可完全不同。为获得在存储上的最高效率,TDengine提供如下存储相关的系统配置参数:
|
||||
|
||||
|
|
|
@ -178,11 +178,11 @@ C/C++的API类似于MySQL的C API。应用程序使用时,需要包含TDengine
|
|||
|
||||
获取客户端版本信息。
|
||||
|
||||
- `TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, int port)`
|
||||
- `TAOS *taos_connect(const char *host, const char *user, const char *pass, const char *db, int port)`
|
||||
|
||||
创建数据库连接,初始化连接上下文。其中需要用户提供的参数包含:
|
||||
|
||||
- ip:TDengine管理主节点的IP地址
|
||||
- host:TDengine管理主节点的FQDN
|
||||
- user:用户名
|
||||
- pass:密码
|
||||
- db:数据库名字,如果用户没有提供,也可以正常连接,用户可以通过该连接创建新的数据库,如果用户提供了数据库名字,则说明该数据库用户已经创建好,缺省使用该数据库
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
"port": 6030,
|
||||
"user": "root",
|
||||
"password": "taosdata",
|
||||
"databases": "db01",
|
||||
"super_table_query":
|
||||
"databases": "db",
|
||||
"specified_table_query":
|
||||
{"concurrent":1, "mode":"sync", "interval":5000, "restart":"yes", "keepProgress":"yes",
|
||||
"sqls": [{"sql": "select avg(c1) from stb01 where col1 > 1;", "result": "./subscribe_res0.txt"}]
|
||||
"sqls": [{"sql": "select avg(col1) from stb01 where col1 > 1;", "result": "./subscribe_res0.txt"}]
|
||||
},
|
||||
"sub_table_query":
|
||||
{"stblname": "stb01", "threads":1, "mode":"sync", "interval":10000, "restart":"yes", "keepProgress":"yes",
|
||||
"super_table_query":
|
||||
{"stblname": "stb", "threads":1, "mode":"sync", "interval":10000, "restart":"yes", "keepProgress":"yes",
|
||||
"sqls": [{"sql": "select col1 from xxxx where col1 > 10;", "result": "./subscribe_res1.txt"}]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4269,23 +4269,24 @@ void *subSubscribeProcess(void *sarg) {
|
|||
} while (0);
|
||||
|
||||
// start loop to consume result
|
||||
TAOS_RES* res = NULL;
|
||||
while (1) {
|
||||
for (int i = 0; i < g_queryInfo.subQueryInfo.sqlCount; i++) {
|
||||
if (1 == g_queryInfo.subQueryInfo.subscribeMode) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TAOS_RES* res = taos_consume(g_queryInfo.subQueryInfo.tsub[i]);
|
||||
res = taos_consume(g_queryInfo.subQueryInfo.tsub[i]);
|
||||
if (res) {
|
||||
char tmpFile[MAX_FILE_NAME_LEN*2] = {0};
|
||||
if (g_queryInfo.subQueryInfo.result[i][0] != 0) {
|
||||
sprintf(tmpFile, "%s-%d", g_queryInfo.subQueryInfo.result[i], winfo->threadID);
|
||||
}
|
||||
getResult(res, tmpFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
taos_free_result(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < g_queryInfo.subQueryInfo.sqlCount; i++) {
|
||||
taos_unsubscribe(g_queryInfo.subQueryInfo.tsub[i], g_queryInfo.subQueryInfo.subscribeKeepProgress);
|
||||
|
@ -4328,23 +4329,24 @@ void *superSubscribeProcess(void *sarg) {
|
|||
} while (0);
|
||||
|
||||
// start loop to consume result
|
||||
TAOS_RES* res = NULL;
|
||||
while (1) {
|
||||
for (int i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) {
|
||||
if (1 == g_queryInfo.superQueryInfo.subscribeMode) {
|
||||
continue;
|
||||
}
|
||||
|
||||
TAOS_RES* res = taos_consume(g_queryInfo.superQueryInfo.tsub[i]);
|
||||
res = taos_consume(g_queryInfo.superQueryInfo.tsub[i]);
|
||||
if (res) {
|
||||
char tmpFile[MAX_FILE_NAME_LEN*2] = {0};
|
||||
if (g_queryInfo.superQueryInfo.result[i][0] != 0) {
|
||||
sprintf(tmpFile, "%s-%d", g_queryInfo.superQueryInfo.result[i], winfo->threadID);
|
||||
}
|
||||
getResult(res, tmpFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
taos_free_result(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) {
|
||||
taos_unsubscribe(g_queryInfo.superQueryInfo.tsub[i], g_queryInfo.superQueryInfo.subscribeKeepProgress);
|
||||
|
|
|
@ -259,7 +259,7 @@ typedef struct {
|
|||
int16_t bytes[TSDB_MAX_COLUMNS];
|
||||
int32_t numOfReads;
|
||||
int8_t maxReplica;
|
||||
int8_t reserved0[0];
|
||||
int8_t reserved0[1];
|
||||
uint16_t payloadLen;
|
||||
char payload[];
|
||||
} SShowObj;
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef struct SSdbRow {
|
|||
int32_t (*fpReq)(SMnodeMsg *pMsg);
|
||||
int32_t (*fpRsp)(SMnodeMsg *pMsg, int32_t code);
|
||||
char reserveForSync[24];
|
||||
SWalHead pHead[];
|
||||
SWalHead pHead;
|
||||
} SSdbRow;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -274,7 +274,7 @@ static int32_t sdbGetSyncVersion(int32_t vgId, uint64_t *fver, uint64_t *vver) {
|
|||
|
||||
// failed to forward, need revert insert
|
||||
static void sdbHandleFailedConfirm(SSdbRow *pRow) {
|
||||
SWalHead *pHead = pRow->pHead;
|
||||
SWalHead *pHead = &pRow->pHead;
|
||||
int32_t action = pHead->msgType % 10;
|
||||
|
||||
sdbError("vgId:1, row:%p:%s hver:%" PRIu64 " action:%s, failed to foward since %s", pRow->pObj,
|
||||
|
@ -1012,7 +1012,7 @@ static void sdbFreeQueue() {
|
|||
}
|
||||
|
||||
static int32_t sdbWriteToQueue(SSdbRow *pRow, int32_t qtype) {
|
||||
SWalHead *pHead = pRow->pHead;
|
||||
SWalHead *pHead = &pRow->pHead;
|
||||
|
||||
if (pHead->len > TSDB_MAX_WAL_SIZE) {
|
||||
sdbError("vgId:1, wal len:%d exceeds limit, hver:%" PRIu64, pHead->len, pHead->version);
|
||||
|
@ -1051,8 +1051,8 @@ static int32_t sdbWriteFwdToQueue(int32_t vgId, void *wparam, int32_t qtype, voi
|
|||
return TSDB_CODE_VND_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
memcpy(pRow->pHead, pHead, sizeof(SWalHead) + pHead->len);
|
||||
pRow->rowData = pRow->pHead->cont;
|
||||
memcpy(&pRow->pHead, pHead, sizeof(SWalHead) + pHead->len);
|
||||
pRow->rowData = pRow->pHead.cont;
|
||||
|
||||
int32_t code = sdbWriteToQueue(pRow, qtype);
|
||||
if (code == TSDB_CODE_MND_ACTION_IN_PROGRESS) code = 0;
|
||||
|
@ -1073,7 +1073,7 @@ static int32_t sdbWriteRowToQueue(SSdbRow *pInputRow, int32_t action) {
|
|||
memcpy(pRow, pInputRow, sizeof(SSdbRow));
|
||||
pRow->processedCount = 1;
|
||||
|
||||
SWalHead *pHead = pRow->pHead;
|
||||
SWalHead *pHead = &pRow->pHead;
|
||||
pRow->rowData = pHead->cont;
|
||||
(*pTable->fpEncode)(pRow);
|
||||
|
||||
|
@ -1103,9 +1103,9 @@ static void *sdbWorkerFp(void *pWorker) {
|
|||
for (int32_t i = 0; i < numOfMsgs; ++i) {
|
||||
taosGetQitem(tsSdbWQall, &qtype, (void **)&pRow);
|
||||
sdbTrace("vgId:1, msg:%p, row:%p hver:%" PRIu64 ", will be processed in sdb queue", pRow->pMsg, pRow->pObj,
|
||||
pRow->pHead->version);
|
||||
pRow->pHead.version);
|
||||
|
||||
pRow->code = sdbProcessWrite((qtype == TAOS_QTYPE_RPC) ? pRow : NULL, pRow->pHead, qtype, NULL);
|
||||
pRow->code = sdbProcessWrite((qtype == TAOS_QTYPE_RPC) ? pRow : NULL, &pRow->pHead, qtype, NULL);
|
||||
if (pRow->code > 0) pRow->code = 0;
|
||||
|
||||
sdbTrace("vgId:1, msg:%p is processed in sdb queue, code:%x", pRow->pMsg, pRow->code);
|
||||
|
@ -1122,7 +1122,7 @@ static void *sdbWorkerFp(void *pWorker) {
|
|||
sdbConfirmForward(1, pRow, pRow->code);
|
||||
} else {
|
||||
if (qtype == TAOS_QTYPE_FWD) {
|
||||
syncConfirmForward(tsSdbMgmt.sync, pRow->pHead->version, pRow->code);
|
||||
syncConfirmForward(tsSdbMgmt.sync, pRow->pHead.version, pRow->code);
|
||||
}
|
||||
sdbFreeFromQueue(pRow);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue