Merge branch '3.0' of github.com:taosdata/TDengine into szhou/tag-scan-opt
This commit is contained in:
commit
4fdaaba3ce
|
@ -78,6 +78,12 @@ ELSE ()
|
||||||
SET(TD_TAOS_TOOLS TRUE)
|
SET(TD_TAOS_TOOLS TRUE)
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
|
IF (${TD_WINDOWS})
|
||||||
|
SET(TAOS_LIB taos_static)
|
||||||
|
ELSE ()
|
||||||
|
SET(TAOS_LIB taos)
|
||||||
|
ENDIF ()
|
||||||
|
|
||||||
IF (TD_WINDOWS)
|
IF (TD_WINDOWS)
|
||||||
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
|
MESSAGE("${Yellow} set compiler flag for Windows! ${ColourReset}")
|
||||||
SET(COMMON_FLAGS "/w /D_WIN32 /DWIN32 /Zi /MTd")
|
SET(COMMON_FLAGS "/w /D_WIN32 /DWIN32 /Zi /MTd")
|
||||||
|
|
|
@ -23,7 +23,20 @@ By subscribing to a topic, a consumer can obtain the latest data in that topic i
|
||||||
|
|
||||||
To implement these features, TDengine indexes its write-ahead log (WAL) file for fast random access and provides configurable methods for replacing and retaining this file. You can define a retention period and size for this file. For information, see the CREATE DATABASE statement. In this way, the WAL file is transformed into a persistent storage engine that remembers the order in which events occur. However, note that configuring an overly long retention period for your WAL files makes database compression inefficient. TDengine then uses the WAL file instead of the time-series database as its storage engine for queries in the form of topics. TDengine reads the data from the WAL file; uses a unified query engine instance to perform filtering, transformations, and other operations; and finally pushes the data to consumers.
|
To implement these features, TDengine indexes its write-ahead log (WAL) file for fast random access and provides configurable methods for replacing and retaining this file. You can define a retention period and size for this file. For information, see the CREATE DATABASE statement. In this way, the WAL file is transformed into a persistent storage engine that remembers the order in which events occur. However, note that configuring an overly long retention period for your WAL files makes database compression inefficient. TDengine then uses the WAL file instead of the time-series database as its storage engine for queries in the form of topics. TDengine reads the data from the WAL file; uses a unified query engine instance to perform filtering, transformations, and other operations; and finally pushes the data to consumers.
|
||||||
|
|
||||||
Tips: Data subscription is to consume data from the wal. If some wal files are deleted according to WAL retention policy, the deleted data can't be consumed any more. So you need to set a reasonable value for parameter `WAL_RETENTION_PERIOD` or `WAL_RETENTION_SIZE` when creating the database and make sure your application consume the data in a timely way to make sure there is no data loss. This behavior is similar to Kafka and other widely used message queue products.
|
Tips:(c interface for example)
|
||||||
|
1. A consumption group consumes all data under the same topic, and different consumption groups are independent of each other;
|
||||||
|
2. A consumption group consumes all vgroups of the same topic, which can be composed of multiple consumers, but a vgroup is only consumed by one consumer. If the number of consumers exceeds the number of vgroups, the excess consumers do not consume data;
|
||||||
|
3. On the server side, only one offset is saved for each vgroup, and the offsets for each vgroup are monotonically increasing, but not necessarily continuous. There is no correlation between the offsets of various vgroups;
|
||||||
|
4. Each poll server will return a result block, which belongs to a vgroup and may contain data from multiple versions of wal. This block can be accessed through tmq_get_vgroup_offset. The offset interface obtains the offset of the first record in the block;
|
||||||
|
5. If a consumer group has never committed an offset, when its member consumers restart and pull data again, they start consuming from the set value of the parameter auto.offset.reset; In a consumer lifecycle, the client locally records the offset of the most recent pull data and will not pull duplicate data;
|
||||||
|
6. If a consumer terminates abnormally (without calling tmq_close), they need to wait for about 12 seconds to trigger their consumer group rebalance. The consumer's status on the server will change to LOST, and after about 1 day, the consumer will be automatically deleted; Exit normally, and after exiting, the consumer will be deleted; Add a new consumer, wait for about 2 seconds to trigger Rebalance, and the consumer's status on the server will change to ready;
|
||||||
|
7. The consumer group Rebalance will reassign Vgroups to all consumer members in the ready state of the group, and consumers can only assign/see/commit/poll operations to the Vgroups they are responsible for;
|
||||||
|
8. Consumers can tmq_position to obtain the offset of the current consumption, seek to the specified offset, and consume again;
|
||||||
|
9. Seek points the position to the specified offset without executing the commit operation. Once the seek is successful, it can poll the specified offset and subsequent data;
|
||||||
|
10. Before the seek operation, tmq must be call tmq_get_topic_assignment, The assignment interface obtains the vgroup ID and offset range of the consumer. The seek operation will detect whether the vgroup ID and offset are legal, and if they are illegal, an error will be reported;
|
||||||
|
11. Due to the existence of a WAL expiration deletion mechanism, even if the seek operation is successful, it is possible that the offset has expired when polling data. If the offset of poll is less than the WAL minimum version number, it will be consumed from the WAL minimum version number;
|
||||||
|
12. The tmq_get_vgroup_offset interface obtains the offset of the first data in the result block where the record is located. When seeking to this offset, it will consume all the data in this block. Refer to point four;
|
||||||
|
13. Data subscription is to consume data from the wal. If some wal files are deleted according to WAL retention policy, the deleted data can't be consumed any more. So you need to set a reasonable value for parameter `WAL_RETENTION_PERIOD` or `WAL_RETENTION_SIZE` when creating the database and make sure your application consume the data in a timely way to make sure there is no data loss. This behavior is similar to Kafka and other widely used message queue products.
|
||||||
|
|
||||||
## Data Schema and API
|
## Data Schema and API
|
||||||
|
|
||||||
|
@ -33,40 +46,59 @@ The related schemas and APIs in various languages are described as follows:
|
||||||
<TabItem value="c" label="C">
|
<TabItem value="c" label="C">
|
||||||
|
|
||||||
```c
|
```c
|
||||||
typedef struct tmq_t tmq_t;
|
typedef struct tmq_t tmq_t;
|
||||||
typedef struct tmq_conf_t tmq_conf_t;
|
typedef struct tmq_conf_t tmq_conf_t;
|
||||||
typedef struct tmq_list_t tmq_list_t;
|
typedef struct tmq_list_t tmq_list_t;
|
||||||
|
|
||||||
typedef void(tmq_commit_cb(tmq_t *, int32_t code, void *param));
|
typedef void(tmq_commit_cb(tmq_t *tmq, int32_t code, void *param));
|
||||||
|
|
||||||
DLL_EXPORT tmq_list_t *tmq_list_new();
|
typedef enum tmq_conf_res_t {
|
||||||
DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *);
|
|
||||||
DLL_EXPORT void tmq_list_destroy(tmq_list_t *);
|
|
||||||
DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen);
|
|
||||||
DLL_EXPORT const char *tmq_err2str(int32_t code);
|
|
||||||
|
|
||||||
DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
|
|
||||||
DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq);
|
|
||||||
DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout);
|
|
||||||
DLL_EXPORT int32_t tmq_consumer_close(tmq_t *tmq);
|
|
||||||
DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg);
|
|
||||||
DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param);
|
|
||||||
|
|
||||||
enum tmq_conf_res_t {
|
|
||||||
TMQ_CONF_UNKNOWN = -2,
|
TMQ_CONF_UNKNOWN = -2,
|
||||||
TMQ_CONF_INVALID = -1,
|
TMQ_CONF_INVALID = -1,
|
||||||
TMQ_CONF_OK = 0,
|
TMQ_CONF_OK = 0,
|
||||||
};
|
} tmq_conf_res_t;
|
||||||
typedef enum tmq_conf_res_t tmq_conf_res_t;
|
|
||||||
|
|
||||||
DLL_EXPORT tmq_conf_t *tmq_conf_new();
|
typedef struct tmq_topic_assignment {
|
||||||
DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value);
|
int32_t vgId;
|
||||||
DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
|
int64_t currentOffset;
|
||||||
DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
|
int64_t begin;
|
||||||
|
int64_t end;
|
||||||
|
} tmq_topic_assignment;
|
||||||
|
|
||||||
|
DLL_EXPORT tmq_conf_t *tmq_conf_new();
|
||||||
|
DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value);
|
||||||
|
DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
|
||||||
|
DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
|
||||||
|
|
||||||
|
DLL_EXPORT tmq_list_t *tmq_list_new();
|
||||||
|
DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *);
|
||||||
|
DLL_EXPORT void tmq_list_destroy(tmq_list_t *);
|
||||||
|
DLL_EXPORT int32_t tmq_list_get_size(const tmq_list_t *);
|
||||||
|
DLL_EXPORT char **tmq_list_to_c_array(const tmq_list_t *);
|
||||||
|
|
||||||
|
DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen);
|
||||||
|
DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
|
||||||
|
DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq);
|
||||||
|
DLL_EXPORT int32_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics);
|
||||||
|
DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout);
|
||||||
|
DLL_EXPORT int32_t tmq_consumer_close(tmq_t *tmq);
|
||||||
|
DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg);
|
||||||
|
DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param);
|
||||||
|
DLL_EXPORT int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
|
||||||
|
DLL_EXPORT void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb, void *param);
|
||||||
|
DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,int32_t *numOfAssignment);
|
||||||
|
DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment* pAssignment);
|
||||||
|
DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
|
||||||
|
DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId);
|
||||||
|
DLL_EXPORT int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId);
|
||||||
|
|
||||||
|
DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res);
|
||||||
|
DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res);
|
||||||
|
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
|
||||||
|
DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES* res);
|
||||||
|
DLL_EXPORT const char *tmq_err2str(int32_t code);DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information, see [C/C++ Connector](/reference/connector/cpp).
|
|
||||||
|
|
||||||
The following example is based on the smart meter table described in Data Models. For complete sample code, see the C language section below.
|
The following example is based on the smart meter table described in Data Models. For complete sample code, see the C language section below.
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
|
@ -1091,8 +1091,6 @@ public abstract class ConsumerLoop {
|
||||||
config.setProperty("client.id", "1");
|
config.setProperty("client.id", "1");
|
||||||
config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer");
|
config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer");
|
||||||
config.setProperty("value.deserializer.encoding", "UTF-8");
|
config.setProperty("value.deserializer.encoding", "UTF-8");
|
||||||
config.setProperty("experimental.snapshot.enable", "true");
|
|
||||||
|
|
||||||
|
|
||||||
this.consumer = new TaosConsumer<>(config);
|
this.consumer = new TaosConsumer<>(config);
|
||||||
this.topics = Collections.singletonList("topic_speed");
|
this.topics = Collections.singletonList("topic_speed");
|
||||||
|
@ -1176,7 +1174,6 @@ public abstract class ConsumerLoop {
|
||||||
config.setProperty("client.id", "1");
|
config.setProperty("client.id", "1");
|
||||||
config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer");
|
config.setProperty("value.deserializer", "com.taosdata.jdbc.tmq.ConsumerTest.ConsumerLoop$ResultDeserializer");
|
||||||
config.setProperty("value.deserializer.encoding", "UTF-8");
|
config.setProperty("value.deserializer.encoding", "UTF-8");
|
||||||
config.setProperty("experimental.snapshot.enable", "true");
|
|
||||||
|
|
||||||
this.consumer = new TaosConsumer<>(config);
|
this.consumer = new TaosConsumer<>(config);
|
||||||
this.topics = Collections.singletonList("topic_speed");
|
this.topics = Collections.singletonList("topic_speed");
|
||||||
|
|
|
@ -227,12 +227,6 @@ tmq_t* build_consumer() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = tmq_conf_set(conf, "experimental.snapshot.enable", "false");
|
|
||||||
if (TMQ_CONF_OK != code) {
|
|
||||||
tmq_conf_destroy(conf);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
|
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
|
||||||
|
|
||||||
tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
|
tmq_t* tmq = tmq_consumer_new(conf, NULL, 0);
|
||||||
|
|
|
@ -35,7 +35,6 @@ func main() {
|
||||||
"td.connect.port": "6030",
|
"td.connect.port": "6030",
|
||||||
"client.id": "test_tmq_client",
|
"client.id": "test_tmq_client",
|
||||||
"enable.auto.commit": "false",
|
"enable.auto.commit": "false",
|
||||||
"experimental.snapshot.enable": "true",
|
|
||||||
"msg.with.table.name": "true",
|
"msg.with.table.name": "true",
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -25,7 +25,20 @@ import CDemo from "./_sub_c.mdx";
|
||||||
|
|
||||||
本文档不对消息队列本身的基础知识做介绍,如果需要了解,请自行搜索。
|
本文档不对消息队列本身的基础知识做介绍,如果需要了解,请自行搜索。
|
||||||
|
|
||||||
注意:数据订阅是从 WAL 消费数据,如果一些 WAL 文件被基于 WAL 保留策略删除,则已经删除的 WAL 文件中的数据就无法再消费到。需要根据业务需要在创建数据库时合理设置 `WAL_RETENTION_PERIOD` 或 `WAL_RETENTION_SIZE` ,并确保应用及时消费数据,这样才不会产生数据丢失的现象。数据订阅的行为与 Kafka 等广泛使用的消息队列类产品的行为相似。
|
说明(以c接口为例):
|
||||||
|
1. 一个消费组消费同一个topic下的所有数据,不同消费组之间相互独立;
|
||||||
|
2. 一个消费组消费同一个topic所有的vgroup,消费组可由多个消费者组成,但一个vgroup仅被一个消费者消费,如果消费者数量超过了vgroup数量,多余的消费者不消费数据;
|
||||||
|
3. 在服务端每个vgroup仅保存一个offset,每个vgroup的offset是单调递增的,但不一定连续。各个vgroup的offset之间没有关联;
|
||||||
|
4. 每次poll服务端会返回一个结果block,该block属于一个vgroup,可能包含多个wal版本的数据,可以通过 tmq_get_vgroup_offset 接口获得是该block第一条记录的offset;
|
||||||
|
5. 一个消费组如果从未commit过offset,当其成员消费者重启重新拉取数据时,均从参数auto.offset.reset设定值开始消费;在一个消费者生命周期中,客户端本地记录了最近一次拉取数据的offset,不会拉取重复数据;
|
||||||
|
6. 消费者如果异常终止(没有调用tmq_close),需等约12秒后触发其所属消费组rebalance,该消费者在服务端状态变为LOST,约1天后该消费者自动被删除;正常退出,退出后就会删除消费者;新增消费者,需等约2秒触发rebalance,该消费者在服务端状态变为ready;
|
||||||
|
7. 消费组rebalance会对该组所有ready状态的消费者成员重新进行vgroup分配,消费者仅能对自己负责的vgroup进行assignment/seek/commit/poll操作;
|
||||||
|
8. 消费者可利用 tmq_position 获得当前消费的offset,并seek到指定offset,重新消费;
|
||||||
|
9. seek将position指向指定offset,不执行commit操作,一旦seek成功,可poll拉取指定offset及以后的数据;
|
||||||
|
10. seek 操作之前须调用 tmq_get_topic_assignment 接口获取该consumer的vgroup ID和offset范围。seek 操作会检测vgroup ID 和 offset是否合法,如非法将报错;
|
||||||
|
11. tmq_get_vgroup_offset接口获取的是记录所在结果block块里的第一条数据的offset,当seek至该offset时,将消费到这个block里的全部数据。参见第四点;
|
||||||
|
12. 由于存在 WAL 过期删除机制,即使seek 操作成功,poll数据时有可能offset已失效。如果poll 的offset 小于 WAL 最小版本号,将会从WAL最小版本号消费;
|
||||||
|
13. 数据订阅是从 WAL 消费数据,如果一些 WAL 文件被基于 WAL 保留策略删除,则已经删除的 WAL 文件中的数据就无法再消费到。需要根据业务需要在创建数据库时合理设置 `WAL_RETENTION_PERIOD` 或 `WAL_RETENTION_SIZE` ,并确保应用及时消费数据,这样才不会产生数据丢失的现象。数据订阅的行为与 Kafka 等广泛使用的消息队列类产品的行为相似;
|
||||||
|
|
||||||
## 主要数据结构和 API
|
## 主要数据结构和 API
|
||||||
|
|
||||||
|
@ -35,39 +48,60 @@ import CDemo from "./_sub_c.mdx";
|
||||||
<TabItem value="c" label="C">
|
<TabItem value="c" label="C">
|
||||||
|
|
||||||
```c
|
```c
|
||||||
typedef struct tmq_t tmq_t;
|
typedef struct tmq_t tmq_t;
|
||||||
typedef struct tmq_conf_t tmq_conf_t;
|
typedef struct tmq_conf_t tmq_conf_t;
|
||||||
typedef struct tmq_list_t tmq_list_t;
|
typedef struct tmq_list_t tmq_list_t;
|
||||||
|
|
||||||
typedef void(tmq_commit_cb(tmq_t *, int32_t code, void *param));
|
typedef void(tmq_commit_cb(tmq_t *tmq, int32_t code, void *param));
|
||||||
|
|
||||||
DLL_EXPORT tmq_list_t *tmq_list_new();
|
typedef enum tmq_conf_res_t {
|
||||||
DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *);
|
|
||||||
DLL_EXPORT void tmq_list_destroy(tmq_list_t *);
|
|
||||||
DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen);
|
|
||||||
DLL_EXPORT const char *tmq_err2str(int32_t code);
|
|
||||||
|
|
||||||
DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
|
|
||||||
DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq);
|
|
||||||
DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout);
|
|
||||||
DLL_EXPORT int32_t tmq_consumer_close(tmq_t *tmq);
|
|
||||||
DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg);
|
|
||||||
DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param);
|
|
||||||
|
|
||||||
enum tmq_conf_res_t {
|
|
||||||
TMQ_CONF_UNKNOWN = -2,
|
TMQ_CONF_UNKNOWN = -2,
|
||||||
TMQ_CONF_INVALID = -1,
|
TMQ_CONF_INVALID = -1,
|
||||||
TMQ_CONF_OK = 0,
|
TMQ_CONF_OK = 0,
|
||||||
};
|
} tmq_conf_res_t;
|
||||||
typedef enum tmq_conf_res_t tmq_conf_res_t;
|
|
||||||
|
|
||||||
DLL_EXPORT tmq_conf_t *tmq_conf_new();
|
typedef struct tmq_topic_assignment {
|
||||||
DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value);
|
int32_t vgId;
|
||||||
DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
|
int64_t currentOffset;
|
||||||
DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
|
int64_t begin;
|
||||||
|
int64_t end;
|
||||||
|
} tmq_topic_assignment;
|
||||||
|
|
||||||
|
DLL_EXPORT tmq_conf_t *tmq_conf_new();
|
||||||
|
DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value);
|
||||||
|
DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
|
||||||
|
DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
|
||||||
|
|
||||||
|
DLL_EXPORT tmq_list_t *tmq_list_new();
|
||||||
|
DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *);
|
||||||
|
DLL_EXPORT void tmq_list_destroy(tmq_list_t *);
|
||||||
|
DLL_EXPORT int32_t tmq_list_get_size(const tmq_list_t *);
|
||||||
|
DLL_EXPORT char **tmq_list_to_c_array(const tmq_list_t *);
|
||||||
|
|
||||||
|
DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen);
|
||||||
|
DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
|
||||||
|
DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq);
|
||||||
|
DLL_EXPORT int32_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics);
|
||||||
|
DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout);
|
||||||
|
DLL_EXPORT int32_t tmq_consumer_close(tmq_t *tmq);
|
||||||
|
DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg);
|
||||||
|
DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param);
|
||||||
|
DLL_EXPORT int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
|
||||||
|
DLL_EXPORT void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb, void *param);
|
||||||
|
DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,int32_t *numOfAssignment);
|
||||||
|
DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment* pAssignment);
|
||||||
|
DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
|
||||||
|
DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId);
|
||||||
|
DLL_EXPORT int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId);
|
||||||
|
|
||||||
|
DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res);
|
||||||
|
DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res);
|
||||||
|
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
|
||||||
|
DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES* res);
|
||||||
|
DLL_EXPORT const char *tmq_err2str(int32_t code);DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
|
||||||
```
|
```
|
||||||
|
|
||||||
这些 API 的文档请见 [C/C++ Connector](../../connector/cpp),下面介绍一下它们的具体用法(超级表和子表结构请参考“数据建模”一节),完整的示例代码请见下面 C 语言的示例代码。
|
下面介绍一下它们的具体用法(超级表和子表结构请参考“数据建模”一节),完整的示例代码请见下面 C 语言的示例代码。
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem value="java" label="Java">
|
<TabItem value="java" label="Java">
|
||||||
|
|
|
@ -228,11 +228,6 @@ tmq_t* build_consumer() {
|
||||||
tmq_conf_destroy(conf);
|
tmq_conf_destroy(conf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
code = tmq_conf_set(conf, "experimental.snapshot.enable", "false");
|
|
||||||
if (TMQ_CONF_OK != code) {
|
|
||||||
tmq_conf_destroy(conf);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
|
tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL);
|
||||||
tmq = tmq_consumer_new(conf, NULL, 0);
|
tmq = tmq_consumer_new(conf, NULL, 0);
|
||||||
|
|
|
@ -260,7 +260,25 @@ typedef struct tmq_t tmq_t;
|
||||||
typedef struct tmq_conf_t tmq_conf_t;
|
typedef struct tmq_conf_t tmq_conf_t;
|
||||||
typedef struct tmq_list_t tmq_list_t;
|
typedef struct tmq_list_t tmq_list_t;
|
||||||
|
|
||||||
typedef void(tmq_commit_cb(tmq_t *, int32_t code, void *param));
|
typedef void(tmq_commit_cb(tmq_t *tmq, int32_t code, void *param));
|
||||||
|
|
||||||
|
typedef enum tmq_conf_res_t {
|
||||||
|
TMQ_CONF_UNKNOWN = -2,
|
||||||
|
TMQ_CONF_INVALID = -1,
|
||||||
|
TMQ_CONF_OK = 0,
|
||||||
|
} tmq_conf_res_t;
|
||||||
|
|
||||||
|
typedef struct tmq_topic_assignment {
|
||||||
|
int32_t vgId;
|
||||||
|
int64_t currentOffset;
|
||||||
|
int64_t begin;
|
||||||
|
int64_t end;
|
||||||
|
} tmq_topic_assignment;
|
||||||
|
|
||||||
|
DLL_EXPORT tmq_conf_t *tmq_conf_new();
|
||||||
|
DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value);
|
||||||
|
DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
|
||||||
|
DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
|
||||||
|
|
||||||
DLL_EXPORT tmq_list_t *tmq_list_new();
|
DLL_EXPORT tmq_list_t *tmq_list_new();
|
||||||
DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *);
|
DLL_EXPORT int32_t tmq_list_append(tmq_list_t *, const char *);
|
||||||
|
@ -269,17 +287,6 @@ DLL_EXPORT int32_t tmq_list_get_size(const tmq_list_t *);
|
||||||
DLL_EXPORT char **tmq_list_to_c_array(const tmq_list_t *);
|
DLL_EXPORT char **tmq_list_to_c_array(const tmq_list_t *);
|
||||||
|
|
||||||
DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen);
|
DLL_EXPORT tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen);
|
||||||
|
|
||||||
DLL_EXPORT const char *tmq_err2str(int32_t code);
|
|
||||||
|
|
||||||
/* ------------------------TMQ CONSUMER INTERFACE------------------------ */
|
|
||||||
typedef struct tmq_topic_assignment {
|
|
||||||
int32_t vgId;
|
|
||||||
int64_t currentOffset;
|
|
||||||
int64_t begin;
|
|
||||||
int64_t end;
|
|
||||||
} tmq_topic_assignment;
|
|
||||||
|
|
||||||
DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
|
DLL_EXPORT int32_t tmq_subscribe(tmq_t *tmq, const tmq_list_t *topic_list);
|
||||||
DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq);
|
DLL_EXPORT int32_t tmq_unsubscribe(tmq_t *tmq);
|
||||||
DLL_EXPORT int32_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics);
|
DLL_EXPORT int32_t tmq_subscription(tmq_t *tmq, tmq_list_t **topics);
|
||||||
|
@ -289,34 +296,17 @@ DLL_EXPORT int32_t tmq_commit_sync(tmq_t *tmq, const TAOS_RES *msg);
|
||||||
DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param);
|
DLL_EXPORT void tmq_commit_async(tmq_t *tmq, const TAOS_RES *msg, tmq_commit_cb *cb, void *param);
|
||||||
DLL_EXPORT int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
|
DLL_EXPORT int32_t tmq_commit_offset_sync(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
|
||||||
DLL_EXPORT void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb, void *param);
|
DLL_EXPORT void tmq_commit_offset_async(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset, tmq_commit_cb *cb, void *param);
|
||||||
DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,
|
DLL_EXPORT int32_t tmq_get_topic_assignment(tmq_t *tmq, const char *pTopicName, tmq_topic_assignment **assignment,int32_t *numOfAssignment);
|
||||||
int32_t *numOfAssignment);
|
|
||||||
DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment* pAssignment);
|
DLL_EXPORT void tmq_free_assignment(tmq_topic_assignment* pAssignment);
|
||||||
DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
|
DLL_EXPORT int32_t tmq_offset_seek(tmq_t *tmq, const char *pTopicName, int32_t vgId, int64_t offset);
|
||||||
|
DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId);
|
||||||
|
DLL_EXPORT int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId);
|
||||||
|
|
||||||
DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res);
|
DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res);
|
||||||
DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res);
|
DLL_EXPORT const char *tmq_get_db_name(TAOS_RES *res);
|
||||||
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
|
DLL_EXPORT int32_t tmq_get_vgroup_id(TAOS_RES *res);
|
||||||
DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES* res);
|
DLL_EXPORT int64_t tmq_get_vgroup_offset(TAOS_RES* res);
|
||||||
DLL_EXPORT int64_t tmq_position(tmq_t *tmq, const char *pTopicName, int32_t vgId);
|
DLL_EXPORT const char *tmq_err2str(int32_t code);
|
||||||
DLL_EXPORT int64_t tmq_committed(tmq_t *tmq, const char *pTopicName, int32_t vgId);
|
|
||||||
|
|
||||||
/* ----------------------TMQ CONFIGURATION INTERFACE---------------------- */
|
|
||||||
|
|
||||||
enum tmq_conf_res_t {
|
|
||||||
TMQ_CONF_UNKNOWN = -2,
|
|
||||||
TMQ_CONF_INVALID = -1,
|
|
||||||
TMQ_CONF_OK = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum tmq_conf_res_t tmq_conf_res_t;
|
|
||||||
|
|
||||||
DLL_EXPORT tmq_conf_t *tmq_conf_new();
|
|
||||||
DLL_EXPORT tmq_conf_res_t tmq_conf_set(tmq_conf_t *conf, const char *key, const char *value);
|
|
||||||
DLL_EXPORT void tmq_conf_destroy(tmq_conf_t *conf);
|
|
||||||
DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *param);
|
|
||||||
|
|
||||||
/* -------------------------TMQ MSG HANDLE INTERFACE---------------------- */
|
|
||||||
|
|
||||||
/* ------------------------------ TAOSX -----------------------------------*/
|
/* ------------------------------ TAOSX -----------------------------------*/
|
||||||
// note: following apis are unstable
|
// note: following apis are unstable
|
||||||
|
|
|
@ -169,7 +169,7 @@ typedef enum ENodeType {
|
||||||
QUERY_NODE_REVOKE_STMT,
|
QUERY_NODE_REVOKE_STMT,
|
||||||
QUERY_NODE_SHOW_DNODES_STMT,
|
QUERY_NODE_SHOW_DNODES_STMT,
|
||||||
QUERY_NODE_SHOW_MNODES_STMT,
|
QUERY_NODE_SHOW_MNODES_STMT,
|
||||||
QUERY_NODE_SHOW_MODULES_STMT,
|
// QUERY_NODE_SHOW_MODULES_STMT,
|
||||||
QUERY_NODE_SHOW_QNODES_STMT,
|
QUERY_NODE_SHOW_QNODES_STMT,
|
||||||
QUERY_NODE_SHOW_SNODES_STMT,
|
QUERY_NODE_SHOW_SNODES_STMT,
|
||||||
QUERY_NODE_SHOW_BNODES_STMT,
|
QUERY_NODE_SHOW_BNODES_STMT,
|
||||||
|
|
|
@ -16,7 +16,7 @@ target_include_directories(
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
taos
|
taos
|
||||||
INTERFACE api
|
INTERFACE api
|
||||||
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
|
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom geometry
|
||||||
)
|
)
|
||||||
|
|
||||||
if(TD_DARWIN_ARM64)
|
if(TD_DARWIN_ARM64)
|
||||||
|
@ -57,7 +57,7 @@ target_include_directories(
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
taos_static
|
taos_static
|
||||||
INTERFACE api
|
INTERFACE api
|
||||||
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom
|
PRIVATE os util common transport nodes parser command planner catalog scheduler function qcom geometry
|
||||||
)
|
)
|
||||||
|
|
||||||
if(${BUILD_TEST})
|
if(${BUILD_TEST})
|
||||||
|
|
|
@ -33,6 +33,7 @@ extern "C" {
|
||||||
#include "ttime.h"
|
#include "ttime.h"
|
||||||
#include "ttypes.h"
|
#include "ttypes.h"
|
||||||
#include "cJSON.h"
|
#include "cJSON.h"
|
||||||
|
#include "geosWrapper.h"
|
||||||
|
|
||||||
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
|
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
|
||||||
# define expect(expr,value) (__builtin_expect ((expr),(value)) )
|
# define expect(expr,value) (__builtin_expect ((expr),(value)) )
|
||||||
|
@ -192,7 +193,7 @@ typedef struct {
|
||||||
//
|
//
|
||||||
SArray *preLineTagKV;
|
SArray *preLineTagKV;
|
||||||
SArray *maxTagKVs;
|
SArray *maxTagKVs;
|
||||||
SArray *masColKVs;
|
SArray *maxColKVs;
|
||||||
|
|
||||||
SSmlLineInfo preLine;
|
SSmlLineInfo preLine;
|
||||||
STableMeta *currSTableMeta;
|
STableMeta *currSTableMeta;
|
||||||
|
|
|
@ -1073,6 +1073,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle *info) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
taosHashCancelIterate(info->superTables, tmp);
|
||||||
taosHashCleanup(hashTmp);
|
taosHashCleanup(hashTmp);
|
||||||
taosMemoryFreeClear(pTableMeta);
|
taosMemoryFreeClear(pTableMeta);
|
||||||
catalogRefreshTableMeta(info->pCatalog, &conn, &pName, 1);
|
catalogRefreshTableMeta(info->pCatalog, &conn, &pName, 1);
|
||||||
|
@ -1191,6 +1192,7 @@ void freeSSmlKv(void *data) {
|
||||||
SSmlKv *kv = (SSmlKv *)data;
|
SSmlKv *kv = (SSmlKv *)data;
|
||||||
if (kv->keyEscaped) taosMemoryFree((void *)(kv->key));
|
if (kv->keyEscaped) taosMemoryFree((void *)(kv->key));
|
||||||
if (kv->valueEscaped) taosMemoryFree((void *)(kv->value));
|
if (kv->valueEscaped) taosMemoryFree((void *)(kv->value));
|
||||||
|
if (kv->type == TSDB_DATA_TYPE_GEOMETRY) geosFreeBuffer((void *)(kv->value));
|
||||||
}
|
}
|
||||||
|
|
||||||
void smlDestroyInfo(SSmlHandle *info) {
|
void smlDestroyInfo(SSmlHandle *info) {
|
||||||
|
@ -1433,6 +1435,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
|
||||||
code = smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE);
|
code = smlCheckAuth(info, &conn, pName.tname, AUTH_TYPE_WRITE);
|
||||||
if(code != TSDB_CODE_SUCCESS){
|
if(code != TSDB_CODE_SUCCESS){
|
||||||
taosMemoryFree(measure);
|
taosMemoryFree(measure);
|
||||||
|
taosHashCancelIterate(info->childTables, oneTable);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1441,6 +1444,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
uError("SML:0x%" PRIx64 " catalogGetTableHashVgroup failed. table name: %s", info->id, tableData->childTableName);
|
uError("SML:0x%" PRIx64 " catalogGetTableHashVgroup failed. table name: %s", info->id, tableData->childTableName);
|
||||||
taosMemoryFree(measure);
|
taosMemoryFree(measure);
|
||||||
|
taosHashCancelIterate(info->childTables, oneTable);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
taosHashPut(info->pVgHash, (const char *)&vg.vgId, sizeof(vg.vgId), (char *)&vg, sizeof(vg));
|
taosHashPut(info->pVgHash, (const char *)&vg.vgId, sizeof(vg.vgId), (char *)&vg, sizeof(vg));
|
||||||
|
@ -1450,6 +1454,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
|
||||||
if (unlikely(NULL == pMeta || NULL == (*pMeta)->tableMeta)) {
|
if (unlikely(NULL == pMeta || NULL == (*pMeta)->tableMeta)) {
|
||||||
uError("SML:0x%" PRIx64 " NULL == pMeta. table name: %s", info->id, tableData->childTableName);
|
uError("SML:0x%" PRIx64 " NULL == pMeta. table name: %s", info->id, tableData->childTableName);
|
||||||
taosMemoryFree(measure);
|
taosMemoryFree(measure);
|
||||||
|
taosHashCancelIterate(info->childTables, oneTable);
|
||||||
return TSDB_CODE_SML_INTERNAL_ERROR;
|
return TSDB_CODE_SML_INTERNAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1465,6 +1470,7 @@ static int32_t smlInsertData(SSmlHandle *info) {
|
||||||
taosMemoryFree(measure);
|
taosMemoryFree(measure);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
uError("SML:0x%" PRIx64 " smlBindData failed", info->id);
|
uError("SML:0x%" PRIx64 " smlBindData failed", info->id);
|
||||||
|
taosHashCancelIterate(info->childTables, oneTable);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable);
|
oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, oneTable);
|
||||||
|
|
|
@ -102,6 +102,30 @@ int32_t smlParseValue(SSmlKv *pVal, SSmlMsgBuf *msg) {
|
||||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pVal->value[0] == 'g' || pVal->value[0] == 'G') { // geometry
|
||||||
|
if (pVal->value[1] == '"' && pVal->value[pVal->length - 1] == '"' && pVal->length >= sizeof("POINT")+3) {
|
||||||
|
int32_t code = initCtxGeomFromText();
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
char* tmp = taosMemoryCalloc(pVal->length, 1);
|
||||||
|
memcpy(tmp, pVal->value + 2, pVal->length - 3);
|
||||||
|
code = doGeomFromText(tmp, (unsigned char **)&pVal->value, &pVal->length);
|
||||||
|
taosMemoryFree(tmp);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
pVal->type = TSDB_DATA_TYPE_GEOMETRY;
|
||||||
|
if (pVal->length > TSDB_MAX_BINARY_LEN - VARSTR_HEADER_SIZE) {
|
||||||
|
geosFreeBuffer((void*)(pVal->value));
|
||||||
|
return TSDB_CODE_PAR_INVALID_VAR_COLUMN_LEN;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (pVal->value[0] == 't' || pVal->value[0] == 'T') {
|
if (pVal->value[0] == 't' || pVal->value[0] == 'T') {
|
||||||
if (pVal->length == 1 ||
|
if (pVal->length == 1 ||
|
||||||
(pVal->length == 4 && (pVal->value[1] == 'r' || pVal->value[1] == 'R') &&
|
(pVal->length == 4 && (pVal->value[1] == 'r' || pVal->value[1] == 'R') &&
|
||||||
|
@ -390,14 +414,14 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
|
||||||
SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type};
|
SSmlKv kv = {.key = tag->name, .keyLen = strlen(tag->name), .type = tag->type};
|
||||||
if (tag->type == TSDB_DATA_TYPE_NCHAR) {
|
if (tag->type == TSDB_DATA_TYPE_NCHAR) {
|
||||||
kv.length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE;
|
kv.length = (tag->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE;
|
||||||
} else if (tag->type == TSDB_DATA_TYPE_BINARY) {
|
} else if (tag->type == TSDB_DATA_TYPE_BINARY || tag->type == TSDB_DATA_TYPE_GEOMETRY) {
|
||||||
kv.length = tag->bytes - VARSTR_HEADER_SIZE;
|
kv.length = tag->bytes - VARSTR_HEADER_SIZE;
|
||||||
}
|
}
|
||||||
taosArrayPush((*tmp)->cols, &kv);
|
taosArrayPush((*tmp)->cols, &kv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info->currSTableMeta = (*tmp)->tableMeta;
|
info->currSTableMeta = (*tmp)->tableMeta;
|
||||||
info->masColKVs = (*tmp)->cols;
|
info->maxColKVs = (*tmp)->cols;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,13 +536,13 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
|
||||||
freeSSmlKv(&kv);
|
freeSSmlKv(&kv);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
if (cnt >= taosArrayGetSize(info->masColKVs)) {
|
if (cnt >= taosArrayGetSize(info->maxColKVs)) {
|
||||||
info->dataFormat = false;
|
info->dataFormat = false;
|
||||||
info->reRun = true;
|
info->reRun = true;
|
||||||
freeSSmlKv(&kv);
|
freeSSmlKv(&kv);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->masColKVs, cnt);
|
SSmlKv *maxKV = (SSmlKv *)taosArrayGet(info->maxColKVs, cnt);
|
||||||
if (kv.type != maxKV->type) {
|
if (kv.type != maxKV->type) {
|
||||||
info->dataFormat = false;
|
info->dataFormat = false;
|
||||||
info->reRun = true;
|
info->reRun = true;
|
||||||
|
@ -663,14 +687,15 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
|
||||||
if (info->dataFormat) {
|
if (info->dataFormat) {
|
||||||
uDebug("SML:0x%" PRIx64 " smlParseInfluxString format true, ts:%" PRId64, info->id, ts);
|
uDebug("SML:0x%" PRIx64 " smlParseInfluxString format true, ts:%" PRId64, info->id, ts);
|
||||||
ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, 0);
|
ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, 0);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret == TSDB_CODE_SUCCESS) {
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
ret = smlBuildRow(info->currTableDataCtx);
|
ret = smlBuildRow(info->currTableDataCtx);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
}
|
||||||
|
|
||||||
|
clearColValArray(info->currTableDataCtx->pValues);
|
||||||
|
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
||||||
|
smlBuildInvalidDataMsg(&info->msgBuf, "smlBuildCol error", NULL);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
clearColValArray(info->currTableDataCtx->pValues);
|
|
||||||
} else {
|
} else {
|
||||||
uDebug("SML:0x%" PRIx64 " smlParseInfluxString format false, ts:%" PRId64, info->id, ts);
|
uDebug("SML:0x%" PRIx64 " smlParseInfluxString format false, ts:%" PRId64, info->id, ts);
|
||||||
taosArraySet(elements->colArray, 0, &kv);
|
taosArraySet(elements->colArray, 0, &kv);
|
||||||
|
|
|
@ -20,7 +20,7 @@ TARGET_LINK_LIBRARIES(
|
||||||
ADD_EXECUTABLE(smlTest smlTest.cpp)
|
ADD_EXECUTABLE(smlTest smlTest.cpp)
|
||||||
TARGET_LINK_LIBRARIES(
|
TARGET_LINK_LIBRARIES(
|
||||||
smlTest
|
smlTest
|
||||||
PUBLIC os util common transport parser catalog scheduler function gtest taos_static qcom
|
PUBLIC os util common transport parser catalog scheduler function gtest taos_static qcom geometry
|
||||||
)
|
)
|
||||||
|
|
||||||
TARGET_INCLUDE_DIRECTORIES(
|
TARGET_INCLUDE_DIRECTORIES(
|
||||||
|
|
|
@ -314,7 +314,7 @@ static const SSysDbTableSchema userUserPrivilegesSchema[] = {
|
||||||
static const SSysTableMeta infosMeta[] = {
|
static const SSysTableMeta infosMeta[] = {
|
||||||
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true},
|
{TSDB_INS_TABLE_DNODES, dnodesSchema, tListLen(dnodesSchema), true},
|
||||||
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
|
{TSDB_INS_TABLE_MNODES, mnodesSchema, tListLen(mnodesSchema), true},
|
||||||
{TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema), true},
|
// {TSDB_INS_TABLE_MODULES, modulesSchema, tListLen(modulesSchema), true},
|
||||||
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema), true},
|
{TSDB_INS_TABLE_QNODES, qnodesSchema, tListLen(qnodesSchema), true},
|
||||||
{TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema), true},
|
{TSDB_INS_TABLE_SNODES, snodesSchema, tListLen(snodesSchema), true},
|
||||||
{TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema), true},
|
{TSDB_INS_TABLE_CLUSTER, clusterSchema, tListLen(clusterSchema), true},
|
||||||
|
|
|
@ -58,8 +58,10 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
|
||||||
type = TSDB_MGMT_TABLE_DNODE;
|
type = TSDB_MGMT_TABLE_DNODE;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_MNODES, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_MNODES, len) == 0) {
|
||||||
type = TSDB_MGMT_TABLE_MNODE;
|
type = TSDB_MGMT_TABLE_MNODE;
|
||||||
|
/*
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_MODULES, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_MODULES, len) == 0) {
|
||||||
type = TSDB_MGMT_TABLE_MODULE;
|
type = TSDB_MGMT_TABLE_MODULE;
|
||||||
|
*/
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_QNODES, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_QNODES, len) == 0) {
|
||||||
type = TSDB_MGMT_TABLE_QNODE;
|
type = TSDB_MGMT_TABLE_QNODE;
|
||||||
} else if (strncasecmp(name, TSDB_INS_TABLE_SNODES, len) == 0) {
|
} else if (strncasecmp(name, TSDB_INS_TABLE_SNODES, len) == 0) {
|
||||||
|
|
|
@ -489,7 +489,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
|
||||||
SMqVgEp *pVgEp = taosArrayGetP(pConsumerEpNew->vgs, i);
|
SMqVgEp *pVgEp = taosArrayGetP(pConsumerEpNew->vgs, i);
|
||||||
if(pVgEp->vgId == d1->vgId){
|
if(pVgEp->vgId == d1->vgId){
|
||||||
jump = true;
|
jump = true;
|
||||||
mInfo("pSub->offsetRows jump, because consumer id:%"PRIx64 " and vgId:%d not change", pConsumerEp->consumerId, pVgEp->vgId);
|
mInfo("pSub->offsetRows jump, because consumer id:0x%"PRIx64 " and vgId:%d not change", pConsumerEp->consumerId, pVgEp->vgId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1426,36 +1426,37 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR
|
||||||
int nData = 0;
|
int nData = 0;
|
||||||
int lock = 0;
|
int lock = 0;
|
||||||
|
|
||||||
metaRLock(pMeta);
|
if (pReader && !(pReader->flags & META_READER_NOLOCK)) {
|
||||||
|
lock = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!lock) metaRLock(pMeta);
|
||||||
|
|
||||||
// search cache
|
// search cache
|
||||||
if (metaCacheGet(pMeta, uid, pInfo) == 0) {
|
if (metaCacheGet(pMeta, uid, pInfo) == 0) {
|
||||||
metaULock(pMeta);
|
if(!lock) metaULock(pMeta);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// search TDB
|
// search TDB
|
||||||
if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) {
|
if (tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData) < 0) {
|
||||||
// not found
|
// not found
|
||||||
metaULock(pMeta);
|
if(!lock) metaULock(pMeta);
|
||||||
code = TSDB_CODE_NOT_FOUND;
|
code = TSDB_CODE_NOT_FOUND;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
metaULock(pMeta);
|
if(!lock) metaULock(pMeta);
|
||||||
|
|
||||||
pInfo->uid = uid;
|
pInfo->uid = uid;
|
||||||
pInfo->suid = ((SUidIdxVal *)pData)->suid;
|
pInfo->suid = ((SUidIdxVal *)pData)->suid;
|
||||||
pInfo->version = ((SUidIdxVal *)pData)->version;
|
pInfo->version = ((SUidIdxVal *)pData)->version;
|
||||||
pInfo->skmVer = ((SUidIdxVal *)pData)->skmVer;
|
pInfo->skmVer = ((SUidIdxVal *)pData)->skmVer;
|
||||||
|
|
||||||
if (pReader != NULL) {
|
|
||||||
lock = !(pReader->flags & META_READER_NOLOCK);
|
|
||||||
if (lock) {
|
if (lock) {
|
||||||
metaULock(pReader->pMeta);
|
metaULock(pReader->pMeta);
|
||||||
// metaReaderReleaseLock(pReader);
|
// metaReaderReleaseLock(pReader);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// upsert the cache
|
// upsert the cache
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
metaCacheUpsert(pMeta, pInfo);
|
metaCacheUpsert(pMeta, pInfo);
|
||||||
|
|
|
@ -905,6 +905,7 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, int64_t version, void *pReq, void *pMsg,
|
||||||
tb_uid_t *pTbSuid = (tb_uid_t *)taosHashGetKey(pIter, NULL);
|
tb_uid_t *pTbSuid = (tb_uid_t *)taosHashGetKey(pIter, NULL);
|
||||||
if (tdExecuteRSmaAsync(pSma, version, pMsg, len, inputType, *pTbSuid) < 0) {
|
if (tdExecuteRSmaAsync(pSma, version, pMsg, len, inputType, *pTbSuid) < 0) {
|
||||||
smaError("vgId:%d, failed to process rsma submit exec 2 since: %s", SMA_VID(pSma), terrstr());
|
smaError("vgId:%d, failed to process rsma submit exec 2 since: %s", SMA_VID(pSma), terrstr());
|
||||||
|
taosHashCancelIterate(uidStore.uidHash, pIter);
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1088,6 +1088,7 @@ int32_t tqUpdateTbUidList(STQ* pTq, const SArray* tbUidList, bool isAdd) {
|
||||||
if(ret != TDB_CODE_SUCCESS) {
|
if(ret != TDB_CODE_SUCCESS) {
|
||||||
tqError("qGetTableList in tqUpdateTbUidList error:%d handle %s consumer:0x%" PRIx64, ret, pTqHandle->subKey, pTqHandle->consumerId);
|
tqError("qGetTableList in tqUpdateTbUidList error:%d handle %s consumer:0x%" PRIx64, ret, pTqHandle->subKey, pTqHandle->consumerId);
|
||||||
taosArrayDestroy(list);
|
taosArrayDestroy(list);
|
||||||
|
taosHashCancelIterate(pTq->pHandle, pIter);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
tqReaderSetTbUidList(pTqHandle->execHandle.pTqReader, list, NULL);
|
tqReaderSetTbUidList(pTqHandle->execHandle.pTqReader, list, NULL);
|
||||||
|
|
|
@ -99,7 +99,7 @@ struct SExecTaskInfo {
|
||||||
void buildTaskId(uint64_t taskId, uint64_t queryId, char* dst);
|
void buildTaskId(uint64_t taskId, uint64_t queryId, char* dst);
|
||||||
SExecTaskInfo* doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOPTR_EXEC_MODEL model, SStorageAPI* pAPI);
|
SExecTaskInfo* doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOPTR_EXEC_MODEL model, SStorageAPI* pAPI);
|
||||||
void doDestroyTask(SExecTaskInfo* pTaskInfo);
|
void doDestroyTask(SExecTaskInfo* pTaskInfo);
|
||||||
bool isTaskKilled(SExecTaskInfo* pTaskInfo);
|
bool isTaskKilled(void* pTaskInfo);
|
||||||
void setTaskKilled(SExecTaskInfo* pTaskInfo, int32_t rspCode);
|
void setTaskKilled(SExecTaskInfo* pTaskInfo, int32_t rspCode);
|
||||||
void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status);
|
void setTaskStatus(SExecTaskInfo* pTaskInfo, int8_t status);
|
||||||
int32_t createExecTaskInfo(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId,
|
int32_t createExecTaskInfo(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SReadHandle* pHandle, uint64_t taskId,
|
||||||
|
|
|
@ -191,7 +191,8 @@ int32_t getProperSortPageSize(size_t rowSize, uint32_t numOfCols);
|
||||||
bool tsortIsClosed(SSortHandle* pHandle);
|
bool tsortIsClosed(SSortHandle* pHandle);
|
||||||
void tsortSetClosed(SSortHandle* pHandle);
|
void tsortSetClosed(SSortHandle* pHandle);
|
||||||
|
|
||||||
void setSingleTableMerge(SSortHandle* pHandle);
|
void tsortSetSingleTableMerge(SSortHandle* pHandle);
|
||||||
|
void tsortSetAbortCheckFn(SSortHandle* pHandle, bool (*checkFn)(void* param), void* param);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ SExecTaskInfo* doCreateTask(uint64_t queryId, uint64_t taskId, int32_t vgId, EOP
|
||||||
return pTaskInfo;
|
return pTaskInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isTaskKilled(SExecTaskInfo* pTaskInfo) { return (0 != pTaskInfo->code); }
|
bool isTaskKilled(void* pTaskInfo) { return (0 != ((SExecTaskInfo*)pTaskInfo)->code); }
|
||||||
|
|
||||||
void setTaskKilled(SExecTaskInfo* pTaskInfo, int32_t rspCode) {
|
void setTaskKilled(SExecTaskInfo* pTaskInfo, int32_t rspCode) {
|
||||||
pTaskInfo->code = rspCode;
|
pTaskInfo->code = rspCode;
|
||||||
|
|
|
@ -504,7 +504,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
|
|
||||||
// 1. check if it is existed in meta cache
|
// 1. check if it is existed in meta cache
|
||||||
if (pCache == NULL) {
|
if (pCache == NULL) {
|
||||||
pHandle->api.metaReaderFn.initReader(&mr, pHandle->vnode, META_READER_NOLOCK, &pHandle->api.metaFn);
|
pHandle->api.metaReaderFn.initReader(&mr, pHandle->vnode, 0, &pHandle->api.metaFn);
|
||||||
code = pHandle->api.metaReaderFn.getEntryGetUidCache(&mr, pBlock->info.id.uid);
|
code = pHandle->api.metaReaderFn.getEntryGetUidCache(&mr, pBlock->info.id.uid);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
// when encounter the TSDB_CODE_PAR_TABLE_NOT_EXIST error, we proceed.
|
// when encounter the TSDB_CODE_PAR_TABLE_NOT_EXIST error, we proceed.
|
||||||
|
@ -3183,6 +3183,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
|
||||||
pInfo->pSortInputBlock, pTaskInfo->id.str, 0, 0, 0);
|
pInfo->pSortInputBlock, pTaskInfo->id.str, 0, 0, 0);
|
||||||
|
|
||||||
tsortSetMergeLimit(pInfo->pSortHandle, mergeLimit);
|
tsortSetMergeLimit(pInfo->pSortHandle, mergeLimit);
|
||||||
|
tsortSetAbortCheckFn(pInfo->pSortHandle, isTaskKilled, pOperator->pTaskInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
tsortSetFetchRawDataFp(pInfo->pSortHandle, getBlockForTableMergeScan, NULL, NULL);
|
tsortSetFetchRawDataFp(pInfo->pSortHandle, getBlockForTableMergeScan, NULL, NULL);
|
||||||
|
@ -3202,7 +3203,7 @@ int32_t startGroupTableMergeScan(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (numOfTable == 1) {
|
if (numOfTable == 1) {
|
||||||
setSingleTableMerge(pInfo->pSortHandle);
|
tsortSetSingleTableMerge(pInfo->pSortHandle);
|
||||||
} else {
|
} else {
|
||||||
code = tsortOpen(pInfo->pSortHandle);
|
code = tsortOpen(pInfo->pSortHandle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1601,6 +1601,11 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
|
||||||
SSysTableScanInfo* pInfo = pOperator->info;
|
SSysTableScanInfo* pInfo = pOperator->info;
|
||||||
char dbName[TSDB_DB_NAME_LEN] = {0};
|
char dbName[TSDB_DB_NAME_LEN] = {0};
|
||||||
|
|
||||||
|
if (isTaskKilled(pOperator->pTaskInfo)) {
|
||||||
|
setOperatorCompleted(pOperator);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
blockDataCleanup(pInfo->pRes);
|
blockDataCleanup(pInfo->pRes);
|
||||||
|
|
||||||
const char* name = tNameGetTableName(&pInfo->name);
|
const char* name = tNameGetTableName(&pInfo->name);
|
||||||
|
|
|
@ -71,12 +71,20 @@ struct SSortHandle {
|
||||||
SMultiwayMergeTreeInfo* pMergeTree;
|
SMultiwayMergeTreeInfo* pMergeTree;
|
||||||
|
|
||||||
bool singleTableMerge;
|
bool singleTableMerge;
|
||||||
|
|
||||||
|
bool (*abortCheckFn)(void* param);
|
||||||
|
void* abortCheckParam;
|
||||||
};
|
};
|
||||||
|
|
||||||
void setSingleTableMerge(SSortHandle* pHandle) {
|
void tsortSetSingleTableMerge(SSortHandle* pHandle) {
|
||||||
pHandle->singleTableMerge = true;
|
pHandle->singleTableMerge = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tsortSetAbortCheckFn(SSortHandle *pHandle, bool (*checkFn)(void *), void* param) {
|
||||||
|
pHandle->abortCheckFn = checkFn;
|
||||||
|
pHandle->abortCheckParam = param;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t msortComparFn(const void* pLeft, const void* pRight, void* param);
|
static int32_t msortComparFn(const void* pLeft, const void* pRight, void* param);
|
||||||
|
|
||||||
// | offset[0] | offset[1] |....| nullbitmap | data |...|
|
// | offset[0] | offset[1] |....| nullbitmap | data |...|
|
||||||
|
@ -726,11 +734,10 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
|
||||||
|
|
||||||
SArray* pPageIdList = taosArrayInit(4, sizeof(int32_t));
|
SArray* pPageIdList = taosArrayInit(4, sizeof(int32_t));
|
||||||
while (1) {
|
while (1) {
|
||||||
if (tsortIsClosed(pHandle)) {
|
if (tsortIsClosed(pHandle) || (pHandle->abortCheckFn && pHandle->abortCheckFn(pHandle->abortCheckParam))) {
|
||||||
code = terrno = TSDB_CODE_TSC_QUERY_CANCELLED;
|
code = terrno = TSDB_CODE_TSC_QUERY_CANCELLED;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* pDataBlock = getSortedBlockDataInner(pHandle, &pHandle->cmpParam, numOfRows);
|
SSDataBlock* pDataBlock = getSortedBlockDataInner(pHandle, &pHandle->cmpParam, numOfRows);
|
||||||
if (pDataBlock == NULL) {
|
if (pDataBlock == NULL) {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -197,8 +197,10 @@ const char* nodesNodeName(ENodeType type) {
|
||||||
return "ShowDnodesStmt";
|
return "ShowDnodesStmt";
|
||||||
case QUERY_NODE_SHOW_MNODES_STMT:
|
case QUERY_NODE_SHOW_MNODES_STMT:
|
||||||
return "ShowMnodesStmt";
|
return "ShowMnodesStmt";
|
||||||
|
/*
|
||||||
case QUERY_NODE_SHOW_MODULES_STMT:
|
case QUERY_NODE_SHOW_MODULES_STMT:
|
||||||
return "ShowModulesStmt";
|
return "ShowModulesStmt";
|
||||||
|
*/
|
||||||
case QUERY_NODE_SHOW_QNODES_STMT:
|
case QUERY_NODE_SHOW_QNODES_STMT:
|
||||||
return "ShowQnodesStmt";
|
return "ShowQnodesStmt";
|
||||||
case QUERY_NODE_SHOW_SNODES_STMT:
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
|
|
|
@ -406,7 +406,7 @@ SNode* nodesMakeNode(ENodeType type) {
|
||||||
return makeNode(type, sizeof(SRevokeStmt));
|
return makeNode(type, sizeof(SRevokeStmt));
|
||||||
case QUERY_NODE_SHOW_DNODES_STMT:
|
case QUERY_NODE_SHOW_DNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MNODES_STMT:
|
case QUERY_NODE_SHOW_MNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MODULES_STMT:
|
// case QUERY_NODE_SHOW_MODULES_STMT:
|
||||||
case QUERY_NODE_SHOW_QNODES_STMT:
|
case QUERY_NODE_SHOW_QNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_SNODES_STMT:
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_BNODES_STMT:
|
case QUERY_NODE_SHOW_BNODES_STMT:
|
||||||
|
@ -982,7 +982,7 @@ void nodesDestroyNode(SNode* pNode) {
|
||||||
break;
|
break;
|
||||||
case QUERY_NODE_SHOW_DNODES_STMT:
|
case QUERY_NODE_SHOW_DNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MNODES_STMT:
|
case QUERY_NODE_SHOW_MNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MODULES_STMT:
|
// case QUERY_NODE_SHOW_MODULES_STMT:
|
||||||
case QUERY_NODE_SHOW_QNODES_STMT:
|
case QUERY_NODE_SHOW_QNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_SNODES_STMT:
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_BNODES_STMT:
|
case QUERY_NODE_SHOW_BNODES_STMT:
|
||||||
|
|
|
@ -690,8 +690,10 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
return collectMetaKeyFromShowDnodes(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowDnodes(pCxt, (SShowStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_MNODES_STMT:
|
case QUERY_NODE_SHOW_MNODES_STMT:
|
||||||
return collectMetaKeyFromShowMnodes(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowMnodes(pCxt, (SShowStmt*)pStmt);
|
||||||
|
/*
|
||||||
case QUERY_NODE_SHOW_MODULES_STMT:
|
case QUERY_NODE_SHOW_MODULES_STMT:
|
||||||
return collectMetaKeyFromShowModules(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowModules(pCxt, (SShowStmt*)pStmt);
|
||||||
|
*/
|
||||||
case QUERY_NODE_SHOW_QNODES_STMT:
|
case QUERY_NODE_SHOW_QNODES_STMT:
|
||||||
return collectMetaKeyFromShowQnodes(pCxt, (SShowStmt*)pStmt);
|
return collectMetaKeyFromShowQnodes(pCxt, (SShowStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_SNODES_STMT:
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
|
|
|
@ -263,7 +263,7 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
|
||||||
return authAlterTable(pCxt, (SAlterTableStmt*)pStmt);
|
return authAlterTable(pCxt, (SAlterTableStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_DNODES_STMT:
|
case QUERY_NODE_SHOW_DNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MNODES_STMT:
|
case QUERY_NODE_SHOW_MNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MODULES_STMT:
|
// case QUERY_NODE_SHOW_MODULES_STMT:
|
||||||
case QUERY_NODE_SHOW_QNODES_STMT:
|
case QUERY_NODE_SHOW_QNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_SNODES_STMT:
|
case QUERY_NODE_SHOW_SNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_BNODES_STMT:
|
case QUERY_NODE_SHOW_BNODES_STMT:
|
||||||
|
|
|
@ -22,7 +22,7 @@ static void clearColValArray(SArray* pCols) {
|
||||||
int32_t num = taosArrayGetSize(pCols);
|
int32_t num = taosArrayGetSize(pCols);
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
SColVal* pCol = taosArrayGet(pCols, i);
|
SColVal* pCol = taosArrayGet(pCols, i);
|
||||||
if (TSDB_DATA_TYPE_NCHAR == pCol->type) {
|
if (TSDB_DATA_TYPE_NCHAR == pCol->type || TSDB_DATA_TYPE_GEOMETRY == pCol->type) {
|
||||||
taosMemoryFreeClear(pCol->value.pData);
|
taosMemoryFreeClear(pCol->value.pData);
|
||||||
}
|
}
|
||||||
pCol->flag = CV_FLAG_NONE;
|
pCol->flag = CV_FLAG_NONE;
|
||||||
|
@ -237,9 +237,13 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
|
||||||
}
|
}
|
||||||
pVal->value.pData = pUcs4;
|
pVal->value.pData = pUcs4;
|
||||||
pVal->value.nData = len;
|
pVal->value.nData = len;
|
||||||
} else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) {
|
} else if (kv->type == TSDB_DATA_TYPE_BINARY) {
|
||||||
pVal->value.nData = kv->length;
|
pVal->value.nData = kv->length;
|
||||||
pVal->value.pData = (uint8_t*)kv->value;
|
pVal->value.pData = (uint8_t*)kv->value;
|
||||||
|
} else if (kv->type == TSDB_DATA_TYPE_GEOMETRY) {
|
||||||
|
pVal->value.nData = kv->length;
|
||||||
|
pVal->value.pData = taosMemoryMalloc(kv->length);
|
||||||
|
memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length);
|
||||||
} else {
|
} else {
|
||||||
memcpy(&pVal->value.val, &(kv->value), kv->length);
|
memcpy(&pVal->value.val, &(kv->value), kv->length);
|
||||||
}
|
}
|
||||||
|
@ -364,9 +368,13 @@ int32_t smlBindData(SQuery* query, bool dataFormat, SArray* tags, SArray* colsSc
|
||||||
}
|
}
|
||||||
pVal->value.pData = pUcs4;
|
pVal->value.pData = pUcs4;
|
||||||
pVal->value.nData = len;
|
pVal->value.nData = len;
|
||||||
} else if (kv->type == TSDB_DATA_TYPE_BINARY || kv->type == TSDB_DATA_TYPE_GEOMETRY) {
|
} else if (kv->type == TSDB_DATA_TYPE_BINARY) {
|
||||||
pVal->value.nData = kv->length;
|
pVal->value.nData = kv->length;
|
||||||
pVal->value.pData = (uint8_t*)kv->value;
|
pVal->value.pData = (uint8_t*)kv->value;
|
||||||
|
} else if (kv->type == TSDB_DATA_TYPE_GEOMETRY) {
|
||||||
|
pVal->value.nData = kv->length;
|
||||||
|
pVal->value.pData = taosMemoryMalloc(kv->length);
|
||||||
|
memcpy(pVal->value.pData, (uint8_t*)kv->value, kv->length);
|
||||||
} else {
|
} else {
|
||||||
memcpy(&pVal->value.val, &(kv->value), kv->length);
|
memcpy(&pVal->value.val, &(kv->value), kv->length);
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,7 +333,7 @@ int32_t insGetTableDataCxt(SHashObj* pHash, void* id, int32_t idLen, STableMeta*
|
||||||
|
|
||||||
static void destroyColVal(void* p) {
|
static void destroyColVal(void* p) {
|
||||||
SColVal* pVal = p;
|
SColVal* pVal = p;
|
||||||
if (TSDB_DATA_TYPE_NCHAR == pVal->type) {
|
if (TSDB_DATA_TYPE_NCHAR == pVal->type || TSDB_DATA_TYPE_GEOMETRY == pVal->type) {
|
||||||
taosMemoryFree(pVal->value.pData);
|
taosMemoryFree(pVal->value.pData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,7 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
|
||||||
.numOfShowCols = 1,
|
.numOfShowCols = 1,
|
||||||
.pShowCols = {"*"}
|
.pShowCols = {"*"}
|
||||||
},
|
},
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
.showType = QUERY_NODE_SHOW_MODULES_STMT,
|
.showType = QUERY_NODE_SHOW_MODULES_STMT,
|
||||||
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
||||||
|
@ -99,6 +100,7 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
|
||||||
.numOfShowCols = 1,
|
.numOfShowCols = 1,
|
||||||
.pShowCols = {"*"}
|
.pShowCols = {"*"}
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
.showType = QUERY_NODE_SHOW_QNODES_STMT,
|
.showType = QUERY_NODE_SHOW_QNODES_STMT,
|
||||||
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
.pDbName = TSDB_INFORMATION_SCHEMA_DB,
|
||||||
|
@ -9164,7 +9166,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
case QUERY_NODE_SHOW_USERS_STMT:
|
case QUERY_NODE_SHOW_USERS_STMT:
|
||||||
case QUERY_NODE_SHOW_DNODES_STMT:
|
case QUERY_NODE_SHOW_DNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MNODES_STMT:
|
case QUERY_NODE_SHOW_MNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_MODULES_STMT:
|
// case QUERY_NODE_SHOW_MODULES_STMT:
|
||||||
case QUERY_NODE_SHOW_QNODES_STMT:
|
case QUERY_NODE_SHOW_QNODES_STMT:
|
||||||
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
|
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
|
||||||
case QUERY_NODE_SHOW_INDEXES_STMT:
|
case QUERY_NODE_SHOW_INDEXES_STMT:
|
||||||
|
|
|
@ -65,7 +65,7 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
|
tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0, 0, 24)
|
tdSql.checkData(0, 0, 23)
|
||||||
tdSql.checkData(0, 1, 'information_schema')
|
tdSql.checkData(0, 1, 'information_schema')
|
||||||
tdSql.checkData(0, 2, None)
|
tdSql.checkData(0, 2, None)
|
||||||
tdSql.checkData(1, 0, 3)
|
tdSql.checkData(1, 0, 3)
|
||||||
|
@ -77,7 +77,7 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v desc;')
|
tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v desc;')
|
||||||
tdSql.checkRows(3)
|
tdSql.checkRows(3)
|
||||||
tdSql.checkData(0, 0, 24)
|
tdSql.checkData(0, 0, 23)
|
||||||
tdSql.checkData(0, 1, 'information_schema')
|
tdSql.checkData(0, 1, 'information_schema')
|
||||||
tdSql.checkData(0, 2, None)
|
tdSql.checkData(0, 2, None)
|
||||||
tdSql.checkData(1, 0, 5)
|
tdSql.checkData(1, 0, 5)
|
||||||
|
@ -93,7 +93,7 @@ class TDTestCase:
|
||||||
tdSql.checkData(1, 1, 'performance_schema')
|
tdSql.checkData(1, 1, 'performance_schema')
|
||||||
tdSql.checkData(0, 0, 3)
|
tdSql.checkData(0, 0, 3)
|
||||||
tdSql.checkData(0, 1, 'tbl_count')
|
tdSql.checkData(0, 1, 'tbl_count')
|
||||||
tdSql.checkData(2, 0, 24)
|
tdSql.checkData(2, 0, 23)
|
||||||
tdSql.checkData(2, 1, 'information_schema')
|
tdSql.checkData(2, 1, 'information_schema')
|
||||||
|
|
||||||
tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'")
|
tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'")
|
||||||
|
@ -106,7 +106,7 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.query('select count(*) from information_schema.ins_tables')
|
tdSql.query('select count(*) from information_schema.ins_tables')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 32)
|
tdSql.checkData(0, 0, 31)
|
||||||
|
|
||||||
|
|
||||||
tdSql.execute('create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);')
|
tdSql.execute('create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);')
|
||||||
|
@ -189,7 +189,7 @@ class TDTestCase:
|
||||||
tdSql.checkData(2, 0, 5)
|
tdSql.checkData(2, 0, 5)
|
||||||
tdSql.checkData(2, 1, 'performance_schema')
|
tdSql.checkData(2, 1, 'performance_schema')
|
||||||
tdSql.checkData(2, 2, None)
|
tdSql.checkData(2, 2, None)
|
||||||
tdSql.checkData(3, 0, 24)
|
tdSql.checkData(3, 0, 23)
|
||||||
tdSql.checkData(3, 1, 'information_schema')
|
tdSql.checkData(3, 1, 'information_schema')
|
||||||
tdSql.checkData(3, 2, None)
|
tdSql.checkData(3, 2, None)
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ class TDTestCase:
|
||||||
tdSql.checkData(2, 0, 5)
|
tdSql.checkData(2, 0, 5)
|
||||||
tdSql.checkData(2, 1, 'performance_schema')
|
tdSql.checkData(2, 1, 'performance_schema')
|
||||||
tdSql.checkData(2, 2, None)
|
tdSql.checkData(2, 2, None)
|
||||||
tdSql.checkData(3, 0, 24)
|
tdSql.checkData(3, 0, 23)
|
||||||
tdSql.checkData(3, 1, 'information_schema')
|
tdSql.checkData(3, 1, 'information_schema')
|
||||||
tdSql.checkData(3, 2, None)
|
tdSql.checkData(3, 2, None)
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ class TDTestCase:
|
||||||
tdSql.checkData(0, 1, 'tbl_count')
|
tdSql.checkData(0, 1, 'tbl_count')
|
||||||
tdSql.checkData(1, 0, 5)
|
tdSql.checkData(1, 0, 5)
|
||||||
tdSql.checkData(1, 1, 'performance_schema')
|
tdSql.checkData(1, 1, 'performance_schema')
|
||||||
tdSql.checkData(2, 0, 24)
|
tdSql.checkData(2, 0, 23)
|
||||||
tdSql.checkData(2, 1, 'information_schema')
|
tdSql.checkData(2, 1, 'information_schema')
|
||||||
|
|
||||||
tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'")
|
tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'")
|
||||||
|
@ -228,7 +228,7 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.query('select count(*) from information_schema.ins_tables')
|
tdSql.query('select count(*) from information_schema.ins_tables')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 33)
|
tdSql.checkData(0, 0, 32)
|
||||||
|
|
||||||
|
|
||||||
tdSql.execute('drop database tbl_count')
|
tdSql.execute('drop database tbl_count')
|
||||||
|
|
|
@ -456,7 +456,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3
|
||||||
#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3
|
#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3
|
||||||
,,n,system-test,python3 ./test.py -f 6-cluster/manually-test/6dnode3mnodeInsertLessDataAlterRep3to1to3.py -N 6 -M 3
|
,,n,system-test,python3 ./test.py -f 6-cluster/manually-test/6dnode3mnodeInsertLessDataAlterRep3to1to3.py -N 6 -M 3
|
||||||
#,,n,system-test,python ./test.py -f 6-cluster/5dnode3mnodeRoll.py -N 3 -C 1
|
,,n,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeRoll.py -N 3 -C 1
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3
|
||||||
#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5
|
#,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5
|
||||||
|
|
|
@ -58,7 +58,7 @@ endi
|
||||||
|
|
||||||
sql select tbname from information_schema.ins_tables;
|
sql select tbname from information_schema.ins_tables;
|
||||||
print $rows $data00
|
print $rows $data00
|
||||||
if $rows != 33 then
|
if $rows != 32 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data00 != @ins_tables@ then
|
if $data00 != @ins_tables@ then
|
||||||
|
|
|
@ -53,7 +53,7 @@ sql select stable_name,count(table_name) from information_schema.ins_tables grou
|
||||||
if $rows != 3 then
|
if $rows != 3 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data01 != 30 then
|
if $data01 != 29 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data11 != 10 then
|
if $data11 != 10 then
|
||||||
|
@ -72,7 +72,7 @@ endi
|
||||||
if $data11 != 5 then
|
if $data11 != 5 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data21 != 24 then
|
if $data21 != 23 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data31 != 5 then
|
if $data31 != 5 then
|
||||||
|
@ -97,7 +97,7 @@ endi
|
||||||
if $data42 != 3 then
|
if $data42 != 3 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data52 != 24 then
|
if $data52 != 23 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $data62 != 5 then
|
if $data62 != 5 then
|
||||||
|
|
|
@ -17,6 +17,9 @@ rem echo SIM_DIR: %SIM_DIR%
|
||||||
set "TSIM_DIR=%SIM_DIR%tsim\"
|
set "TSIM_DIR=%SIM_DIR%tsim\"
|
||||||
rem echo TSIM_DIR: %TSIM_DIR%
|
rem echo TSIM_DIR: %TSIM_DIR%
|
||||||
|
|
||||||
|
set "DATA_DIR=%TSIM_DIR%data\"
|
||||||
|
rem echo DATA_DIR: %DATA_DIR%
|
||||||
|
|
||||||
set "CFG_DIR=%TSIM_DIR%cfg\"
|
set "CFG_DIR=%TSIM_DIR%cfg\"
|
||||||
rem echo CFG_DIR: %CFG_DIR%
|
rem echo CFG_DIR: %CFG_DIR%
|
||||||
|
|
||||||
|
@ -30,25 +33,30 @@ if not exist %SIM_DIR% mkdir %SIM_DIR%
|
||||||
if not exist %TSIM_DIR% mkdir %TSIM_DIR%
|
if not exist %TSIM_DIR% mkdir %TSIM_DIR%
|
||||||
if exist %CFG_DIR% rmdir /s/q %CFG_DIR%
|
if exist %CFG_DIR% rmdir /s/q %CFG_DIR%
|
||||||
if exist %LOG_DIR% rmdir /s/q %LOG_DIR%
|
if exist %LOG_DIR% rmdir /s/q %LOG_DIR%
|
||||||
|
if exist %DATA_DIR% rmdir /s/q %DATA_DIR%
|
||||||
if not exist %CFG_DIR% mkdir %CFG_DIR%
|
if not exist %CFG_DIR% mkdir %CFG_DIR%
|
||||||
if not exist %LOG_DIR% mkdir %LOG_DIR%
|
if not exist %LOG_DIR% mkdir %LOG_DIR%
|
||||||
|
if not exist %DATA_DIR% mkdir %DATA_DIR%
|
||||||
|
|
||||||
set "fqdn=localhost"
|
set "fqdn=localhost"
|
||||||
for /f "skip=1" %%A in (
|
for /f "skip=1" %%A in (
|
||||||
'wmic computersystem get caption'
|
'wmic computersystem get caption'
|
||||||
) do if not defined fqdn set "fqdn=%%A"
|
) do if not defined fqdn set "fqdn=%%A"
|
||||||
|
|
||||||
echo firstEp %fqdn% > %TAOS_CFG%
|
echo firstEp %fqdn%:7100 > %TAOS_CFG%
|
||||||
|
echo secondEp %fqdn%:7200 >> %TAOS_CFG%
|
||||||
echo fqdn %fqdn% >> %TAOS_CFG%
|
echo fqdn %fqdn% >> %TAOS_CFG%
|
||||||
echo serverPort 7100 >> %TAOS_CFG%
|
echo serverPort 7100 >> %TAOS_CFG%
|
||||||
|
echo dataDir %DATA_DIR% >> %TAOS_CFG%
|
||||||
echo logDir %LOG_DIR% >> %TAOS_CFG%
|
echo logDir %LOG_DIR% >> %TAOS_CFG%
|
||||||
echo scriptDir %SCRIPT_DIR% >> %TAOS_CFG%
|
echo scriptDir %SCRIPT_DIR% >> %TAOS_CFG%
|
||||||
echo numOfLogLines 100000000 >> %TAOS_CFG%
|
echo numOfLogLines 100000000 >> %TAOS_CFG%
|
||||||
echo rpcDebugFlag 143 >> %TAOS_CFG%
|
echo rpcDebugFlag 143 >> %TAOS_CFG%
|
||||||
echo tmrDebugFlag 131 >> %TAOS_CFG%
|
echo tmrDebugFlag 131 >> %TAOS_CFG%
|
||||||
echo cDebugFlag 135 >> %TAOS_CFG%
|
echo cDebugFlag 143 >> %TAOS_CFG%
|
||||||
echo qDebugFlag 143 >> %TAOS_CFG%
|
echo qDebugFlag 143 >> %TAOS_CFG%
|
||||||
echo udebugFlag 135 >> %TAOS_CFG%
|
echo uDebugFlag 143 >> %TAOS_CFG%
|
||||||
|
echo debugFlag 143 >> %TAOS_CFG%
|
||||||
echo wal 0 >> %TAOS_CFG%
|
echo wal 0 >> %TAOS_CFG%
|
||||||
echo asyncLog 0 >> %TAOS_CFG%
|
echo asyncLog 0 >> %TAOS_CFG%
|
||||||
echo locale en_US.UTF-8 >> %TAOS_CFG%
|
echo locale en_US.UTF-8 >> %TAOS_CFG%
|
||||||
|
|
|
@ -55,7 +55,7 @@ class TDTestCase:
|
||||||
]
|
]
|
||||||
self.binary_str = 'taosdata'
|
self.binary_str = 'taosdata'
|
||||||
self.nchar_str = '涛思数据'
|
self.nchar_str = '涛思数据'
|
||||||
self.ins_list = ['ins_dnodes','ins_mnodes','ins_modules','ins_qnodes','ins_snodes','ins_cluster','ins_databases','ins_functions',\
|
self.ins_list = ['ins_dnodes','ins_mnodes','ins_qnodes','ins_snodes','ins_cluster','ins_databases','ins_functions',\
|
||||||
'ins_indexes','ins_stables','ins_tables','ins_tags','ins_columns','ins_users','ins_grants','ins_vgroups','ins_configs','ins_dnode_variables',\
|
'ins_indexes','ins_stables','ins_tables','ins_tags','ins_columns','ins_users','ins_grants','ins_vgroups','ins_configs','ins_dnode_variables',\
|
||||||
'ins_topics','ins_subscriptions','ins_streams','ins_stream_tasks','ins_vnodes','ins_user_privileges']
|
'ins_topics','ins_subscriptions','ins_streams','ins_stream_tasks','ins_vnodes','ins_user_privileges']
|
||||||
self.perf_list = ['perf_connections','perf_queries','perf_consumers','perf_trans','perf_apps']
|
self.perf_list = ['perf_connections','perf_queries','perf_consumers','perf_trans','perf_apps']
|
||||||
|
|
|
@ -110,6 +110,11 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.query(f"select * from ts3724.`stb2.`")
|
tdSql.query(f"select * from ts3724.`stb2.`")
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
|
|
||||||
|
# tdSql.query(f"select * from td24559.stb order by _ts")
|
||||||
|
# tdSql.checkRows(4)
|
||||||
|
# tdSql.checkData(0, 2, "POINT (4.343000 89.342000)")
|
||||||
|
# tdSql.checkData(3, 2, "GEOMETRYCOLLECTION (MULTIPOINT ((0.000000 0.000000), (1.000000 1.000000)), POINT (3.000000 4.000000), LINESTRING (2.000000 3.000000, 3.000000 4.000000))")
|
||||||
return
|
return
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
|
@ -27,7 +27,7 @@ import threading
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
|
||||||
BASEVERSION = "3.1.0.0"
|
BASEVERSION = "3.1.1.0"
|
||||||
|
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ target_link_libraries(
|
||||||
)
|
)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
tmq_sim
|
tmq_sim
|
||||||
PUBLIC taos
|
PUBLIC ${TAOS_LIB}
|
||||||
PUBLIC util
|
PUBLIC util
|
||||||
PUBLIC common
|
PUBLIC common
|
||||||
PUBLIC os
|
PUBLIC os
|
||||||
|
|
|
@ -1552,12 +1552,45 @@ int sml_ts3724_Test() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sml_td24559_Test() {
|
||||||
|
TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0);
|
||||||
|
|
||||||
|
TAOS_RES *pRes = taos_query(taos, "drop database if exists td24559");
|
||||||
|
taos_free_result(pRes);
|
||||||
|
|
||||||
|
pRes = taos_query(taos, "create database if not exists td24559");
|
||||||
|
taos_free_result(pRes);
|
||||||
|
|
||||||
|
const char *sql[] = {
|
||||||
|
"stb,t1=1 f1=283i32,f2=g\"Point(4.343 89.342)\" 1632299372000",
|
||||||
|
"stb,t1=1 f2=G\"Point(4.343 89.342)\",f1=106i32 1632299373000",
|
||||||
|
"stb,t2=1 f2=G\"Point(4.343 89.342)\",f1=106i32 1632299374000",
|
||||||
|
"stb,t1=1 f1=106i32,f2=G\"GEOMETRYCOLLECTION (MULTIPOINT((0 0), (1 1)), POINT(3 4), LINESTRING(2 3, 3 4))\" 1632299378000",
|
||||||
|
};
|
||||||
|
|
||||||
|
pRes = taos_query(taos, "use td24559");
|
||||||
|
taos_free_result(pRes);
|
||||||
|
|
||||||
|
pRes = taos_schemaless_insert(taos, (char **)sql, sizeof(sql) / sizeof(sql[0]), TSDB_SML_LINE_PROTOCOL,
|
||||||
|
TSDB_SML_TIMESTAMP_MILLI_SECONDS);
|
||||||
|
|
||||||
|
int code = taos_errno(pRes);
|
||||||
|
printf("%s result0:%s\n", __FUNCTION__, taos_errstr(pRes));
|
||||||
|
taos_free_result(pRes);
|
||||||
|
|
||||||
|
taos_close(taos);
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
taos_options(TSDB_OPTION_CONFIGDIR, argv[1]);
|
taos_options(TSDB_OPTION_CONFIGDIR, argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
ret = sml_td24559_Test();
|
||||||
|
ASSERT(!ret);
|
||||||
ret = sml_td24070_Test();
|
ret = sml_td24070_Test();
|
||||||
ASSERT(!ret);
|
ASSERT(!ret);
|
||||||
ret = sml_td23881_Test();
|
ret = sml_td23881_Test();
|
||||||
|
|
|
@ -2,7 +2,7 @@ aux_source_directory(src TSIM_SRC)
|
||||||
add_executable(tsim ${TSIM_SRC})
|
add_executable(tsim ${TSIM_SRC})
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
tsim
|
tsim
|
||||||
PUBLIC taos_static
|
PUBLIC ${TAOS_LIB}
|
||||||
PUBLIC util
|
PUBLIC util
|
||||||
PUBLIC common
|
PUBLIC common
|
||||||
PUBLIC os
|
PUBLIC os
|
||||||
|
|
Loading…
Reference in New Issue