Merge branch '3.0' into enh/TD-31892
|
@ -60,6 +60,10 @@ TDengine 可以高效地从 Kafka 读取数据并将其写入 TDengine,以实
|
||||||
|
|
||||||
在 **主题** 中填写要消费的 Topic 名称。可以配置多个 Topic , Topic 之间用逗号分隔。例如:`tp1,tp2`。
|
在 **主题** 中填写要消费的 Topic 名称。可以配置多个 Topic , Topic 之间用逗号分隔。例如:`tp1,tp2`。
|
||||||
|
|
||||||
|
在 **Client ID** 中填写客户端标识,填写后会生成带有 `taosx` 前缀的客户端 ID (例如,如果填写的标识为 `foo`,则生成的客户端 ID 为 `taosxfoo`)。如果打开末尾处的开关,则会把当前任务的任务 ID 拼接到 `taosx` 之后,输入的标识之前(生成的客户端 ID 形如 `taosx100foo`)。连接到同一个 Kafka 集群的所有客户端 ID 必须保证唯一。
|
||||||
|
|
||||||
|
在 **消费者组 ID** 中填写消费者组标识,填写后会生成带有 `taosx` 前缀的消费者组 ID (例如,如果填写的标识为 `foo`,则生成的消费者组 ID 为 `taosxfoo`)。如果打开末尾处的开关,则会把当前任务的任务 ID 拼接到 `taosx` 之后,输入的标识之前(生成的消费者组 ID 形如 `taosx100foo`)。
|
||||||
|
|
||||||
在 **Offset** 的下拉列表中选择从哪个 Offset 开始消费数据。有三个选项:`Earliest`、`Latest`、`ByTime(ms)`。 默认值为Earliest。
|
在 **Offset** 的下拉列表中选择从哪个 Offset 开始消费数据。有三个选项:`Earliest`、`Latest`、`ByTime(ms)`。 默认值为Earliest。
|
||||||
|
|
||||||
* Earliest:用于请求最早的 offset。
|
* Earliest:用于请求最早的 offset。
|
||||||
|
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 48 KiB |
|
@ -34,13 +34,15 @@ TDengine 消费者的概念跟 Kafka 类似,消费者通过订阅主题来接
|
||||||
| `td.connect.user` | string | 用户名 | |
|
| `td.connect.user` | string | 用户名 | |
|
||||||
| `td.connect.pass` | string | 密码 | |
|
| `td.connect.pass` | string | 密码 | |
|
||||||
| `td.connect.port` | integer | 服务端的端口号 | |
|
| `td.connect.port` | integer | 服务端的端口号 | |
|
||||||
| `group.id` | string | 消费组 ID,同一消费组共享消费进度 | <br />**必填项**。最大长度:192。<br />每个topic最多可建立100个 consumer group |
|
| `group.id` | string | 消费组 ID,同一消费组共享消费进度 | <br />**必填项**。最大长度:192。<br />每个topic最多可建立 100 个 consumer group |
|
||||||
| `client.id` | string | 客户端 ID | 最大长度:192。 |
|
| `client.id` | string | 客户端 ID | 最大长度:192 |
|
||||||
| `auto.offset.reset` | enum | 消费组订阅的初始位置 | <br />`earliest`: default(version < 3.2.0.0);从头开始订阅; <br/>`latest`: default(version >= 3.2.0.0);仅从最新数据开始订阅; <br/>`none`: 没有提交的 offset 无法订阅 |
|
| `auto.offset.reset` | enum | 消费组订阅的初始位置 | <br />`earliest`: default(version < 3.2.0.0);从头开始订阅; <br/>`latest`: default(version >= 3.2.0.0);仅从最新数据开始订阅; <br/>`none`: 没有提交的 offset 无法订阅 |
|
||||||
| `enable.auto.commit` | boolean | 是否启用消费位点自动提交,true: 自动提交,客户端应用无需commit;false:客户端应用需要自行commit | 默认值为 true |
|
| `enable.auto.commit` | boolean | 是否启用消费位点自动提交,true: 自动提交,客户端应用无需commit;false:客户端应用需要自行commit | 默认值为 true |
|
||||||
| `auto.commit.interval.ms` | integer | 消费记录自动提交消费位点时间间隔,单位为毫秒 | 默认值为 5000 |
|
| `auto.commit.interval.ms` | integer | 消费记录自动提交消费位点时间间隔,单位为毫秒 | 默认值为 5000 |
|
||||||
| `msg.with.table.name` | boolean | 是否允许从消息中解析表名, 不适用于列订阅(列订阅时可将 tbname 作为列写入 subquery 语句)(从3.2.0.0版本该参数废弃,恒为true) | 默认关闭 |
|
| `msg.with.table.name` | boolean | 是否允许从消息中解析表名, 不适用于列订阅(列订阅时可将 tbname 作为列写入 subquery 语句)(从3.2.0.0版本该参数废弃,恒为true) | 默认关闭 |
|
||||||
| `enable.replay` | boolean | 是否开启数据回放功能 | 默认关闭 |
|
| `enable.replay` | boolean | 是否开启数据回放功能 | 默认关闭 |
|
||||||
|
| `session.timeout.ms` | integer | consumer 心跳丢失后超时时间,超时后会触发 rebalance 逻辑,成功后该 consumer 会被删除(从3.3.3.0版本开始支持) | 默认值为 12000,取值范围 [6000, 1800000] |
|
||||||
|
| `max.poll.interval.ms` | integer | consumer poll 拉取数据间隔的最长时间,超过该时间,会认为该 consumer 离线,触发rebalance 逻辑,成功后该 consumer 会被删除(从3.3.3.0版本开始支持) | 默认值为 300000,[1000,INT32_MAX] |
|
||||||
|
|
||||||
|
|
||||||
下面是各语言连接器创建参数:
|
下面是各语言连接器创建参数:
|
||||||
|
|
|
@ -118,21 +118,32 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timez
|
||||||
|
|
||||||
### HTTP 响应码
|
### HTTP 响应码
|
||||||
|
|
||||||
从 `TDengine 3.0.3.0` 开始 `taosAdapter` 提供配置参数 `httpCodeServerError` 用来设置当 C 接口返回错误时是否返回非 200 的http状态码。
|
默认情况下,`taosAdapter` 对大多数 C 接口调用出错时也会返回 200 响应码,但是 HTTP body 中包含错误信息。从 `TDengine 3.0.3.0` 开始 `taosAdapter` 提供配置参数 `httpCodeServerError` 用来设置当 C 接口返回错误时是否返回非 200 的 HTTP 响应码。无论是否设置此参数,响应 body 里都有详细的错误码和错误信息,具体请参考 [错误](../rest-api/#错误) 。
|
||||||
无论是否设置此参数,响应 body 里都有详细的错误码和错误信息,具体请参考 [错误](../rest-api/#错误) 。
|
|
||||||
|
|
||||||
| **说明** | **httpCodeServerError false** | **httpCodeServerError true** |
|
**当 httpCodeServerError 为 false 时:**
|
||||||
|--------------------|-------------------------------|---------------------------------------|
|
|
||||||
| taos_errno() 返回 0 | 200 | 200 |
|
|
||||||
| taos_errno() 返回 非0 | 200(除鉴权错误) | 500 (除鉴权错误和 400/502/503 错误) |
|
|
||||||
| 参数错误 | 400(仅处理 HTTP 请求 URL 参数错误) | 400 (处理 HTTP 请求 URL 参数错误和 taosd 返回错误) |
|
|
||||||
| 鉴权错误 | 401 | 401 |
|
|
||||||
| 接口不存在 | 404 | 404 |
|
|
||||||
| 集群不可用错误 | 502 | 502 |
|
|
||||||
| 系统资源不足 | 503 | 503 |
|
|
||||||
|
|
||||||
返回 400 的 C 错误码为:
|
| **分类说明** |**HTTP 响应码** |
|
||||||
|
|--------------------|-------------------------------|
|
||||||
|
| C 接口调用成功 | 200 | 200 |
|
||||||
|
| C 接口调用出错,且不是鉴权错误 | 200 |
|
||||||
|
| HTTP 请求 URL 参数错误 | 400 |
|
||||||
|
| C 接口调用鉴权错误 | 401 |
|
||||||
|
| 接口不存在 | 404 |
|
||||||
|
| 系统资源不足 | 503 |
|
||||||
|
|
||||||
|
**当 httpCodeServerError 为 true 时:**
|
||||||
|
|
||||||
|
| **分类说明** | **HTTP 响应码** |
|
||||||
|
|--------------------|-------------------------------|
|
||||||
|
| C 接口调用成功 | 200 |
|
||||||
|
| HTTP 请求 URL 参数错误和 C 接口调用参数解析错误 | 400 |
|
||||||
|
| C 接口调用鉴权错误 | 401 |
|
||||||
|
| 接口不存在 | 404 |
|
||||||
|
| C 接口调用网络不可用错误 | 502 |
|
||||||
|
| 系统资源不足 |503 |
|
||||||
|
| 其他 C 接口调用错误 | 500 |
|
||||||
|
|
||||||
|
C 接口参数解析相关错误码:
|
||||||
- TSDB_CODE_TSC_SQL_SYNTAX_ERROR (0x0216)
|
- TSDB_CODE_TSC_SQL_SYNTAX_ERROR (0x0216)
|
||||||
- TSDB_CODE_TSC_LINE_SYNTAX_ERROR (0x021B)
|
- TSDB_CODE_TSC_LINE_SYNTAX_ERROR (0x021B)
|
||||||
- TSDB_CODE_PAR_SYNTAX_ERROR (0x2600)
|
- TSDB_CODE_PAR_SYNTAX_ERROR (0x2600)
|
||||||
|
@ -140,7 +151,7 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timez
|
||||||
- TSDB_CODE_TSC_VALUE_OUT_OF_RANGE (0x0224)
|
- TSDB_CODE_TSC_VALUE_OUT_OF_RANGE (0x0224)
|
||||||
- TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE (0x263B)
|
- TSDB_CODE_PAR_INVALID_FILL_TIME_RANGE (0x263B)
|
||||||
|
|
||||||
返回 401 的错误码为:
|
C 接口鉴权相关错误码:
|
||||||
|
|
||||||
- TSDB_CODE_MND_USER_ALREADY_EXIST (0x0350)
|
- TSDB_CODE_MND_USER_ALREADY_EXIST (0x0350)
|
||||||
- TSDB_CODE_MND_USER_NOT_EXIST (0x0351)
|
- TSDB_CODE_MND_USER_NOT_EXIST (0x0351)
|
||||||
|
@ -151,7 +162,7 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name][?tz=timez
|
||||||
- TSDB_CODE_MND_INVALID_ALTER_OPER (0x0356)
|
- TSDB_CODE_MND_INVALID_ALTER_OPER (0x0356)
|
||||||
- TSDB_CODE_MND_AUTH_FAILURE (0x0357)
|
- TSDB_CODE_MND_AUTH_FAILURE (0x0357)
|
||||||
|
|
||||||
返回 502 的错误码为:
|
C 接口网络不可用相关错误码:
|
||||||
|
|
||||||
- TSDB_CODE_RPC_NETWORK_UNAVAIL (0x000B)
|
- TSDB_CODE_RPC_NETWORK_UNAVAIL (0x000B)
|
||||||
|
|
||||||
|
|
|
@ -61,37 +61,37 @@ TDengine 会为 WAL 文件自动创建索引以支持快速随机访问。通过
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
在客户端成功建立与服务器的连接之后,用户须首先指定消费组和主题,以创建相应的消费者实例。随后,客户端便会向服务器提交订阅请求。此刻,消费者的状态被标记为 modify,表示正处于配置阶段。消费者随后会定期向服务器发送请求,以检索并获取待消费的 vnode 列表,直至服务器为其分配相应的 vnode。一旦分配完成,消费者的状态便更新为 ready,标志着订阅流程的成功完成。此刻,客户端便可正式启动向 vnode 发送消费数据请求的过程。
|
在客户端成功建立与服务器的连接之后,用户须首先指定消费组和主题,以创建相应的消费者实例。随后,客户端便会向服务器提交订阅请求。此刻,消费者的状态被标记为 rebalancing,表示正处于 rebalance 阶段。消费者随后会定期向服务器发送请求,以检索并获取待消费的 vnode 列表,直至服务器为其分配相应的 vnode。一旦分配完成,消费者的状态便更新为 ready,标志着订阅流程的成功完成。此刻,客户端便可正式启动向 vnode 发送消费数据请求的过程。
|
||||||
|
|
||||||
在消费数据的过程中,消费者会不断地向每个分配到的 vnode 发送请求,以尝试获取新的数据。一旦收到数据,消费者在完成消费后会继续向该 vnode 发送请求,以便持续消费。若在预设时间内未收到任何数据,消费者便会在 vnode 上注册一个消费 handle。这样一来,一旦 vnode 上有新数据产生,便会立即推送给消费者,从而确保数据消费的即时性,并有效减少消费者频繁主动拉取数据所导致的性能损耗。因此,可以看出,消费者从 vnode 获取数据的方式是一种拉取(pull)与推送(push)相结合的高效模式。
|
在消费数据的过程中,消费者会不断地向每个分配到的 vnode 发送请求,以尝试获取新的数据。一旦收到数据,消费者在完成消费后会继续向该 vnode 发送请求,以便持续消费。若在预设时间内未收到任何数据,消费者便会在 vnode 上注册一个消费 handle。这样一来,一旦 vnode 上有新数据产生,便会立即推送给消费者,从而确保数据消费的即时性,并有效减少消费者频繁主动拉取数据所导致的性能损耗。因此,可以看出,消费者从 vnode 获取数据的方式是一种拉取(pull)与推送(push)相结合的高效模式。
|
||||||
|
|
||||||
消费者在收到数据时,会同时收到数据的版本号,并将其记录为当前在每个 vnode上的消费进度。这一进度仅在消费者内部以内存形式存储,确保仅对该消费者有效。这种设计保证了消费者在每次启动时能够从上次的消费中断处继续,避免了数据的重复处理。然而,若消费者需要退出并希望在之后恢复上次的消费进度,就必须在退出前将消费进度提交至服务器,执行所谓的 commit 操作。这一操作会将消费进度在服务器进行持久化存储,支持自动提交或手动提交两种方式。
|
消费者在收到数据时,会同时收到数据的版本号,并将其记录为当前在每个 vnode 上的消费进度。这一进度仅在消费者内部以内存形式存储,确保仅对该消费者有效。这种设计保证了消费者在每次启动时能够从上次的消费中断处继续,避免了数据的重复处理。然而,若消费者需要退出并希望在之后恢复上次的消费进度,就必须在退出前将消费进度提交至服务器,执行所谓的 commit 操作。这一操作会将消费进度在服务器进行持久化存储,支持自动提交或手动提交两种方式。
|
||||||
|
|
||||||
此外,为了维持消费者的活跃状态,客户端还实施了心跳保活机制。通过定期向服务器发送心跳信号,消费者能够向服务器证明自己仍然在线。若服务器在一定时间内未收到消费者的心跳,便会将其标记为 lost 状态,即认为消费者已离线。服务器依赖心跳机制来监控所有消费者的状态,进而有效地管理整个消费者群体。
|
此外,为了维持消费者的活跃状态,客户端还实施了心跳保活机制。通过定期向服务器发送心跳信号,消费者能够向服务器证明自己仍然在线。若服务器在一定时间内未收到消费者的心跳,便会认为消费者已离线。对于一定时间(可以通过参数控制)不拉取数据的 consumer,服务器也会标记为离线,并从消费组中删除该消费者。服务器依赖心跳机制来监控所有消费者的状态,进而有效地管理整个消费者群体。
|
||||||
|
|
||||||
mnode 主要负责处理订阅过程中的控制消息,包括创建和删除主题、订阅消息、查询 endpoint 消息以及心跳消息等。vnode 则专注于处理消费消息和 commit 消息。当mnode 收到消费者的订阅消息时,如果该消费者尚未订阅过,其状态将被设置为 modify。如果消费者已经订阅过,但订阅的主题发生变更,消费者的状态同样会被设置为 modify。等待再平衡的计时器到来时,mnode 会对 modify 状态的消费者执行再平衡操作,将心跳超过固定时间的消费者设置为 lost 状态,并对关闭或 lost 状态超过一定时间的消费者进行删除操作。
|
mnode 主要负责处理订阅过程中的控制消息,包括创建和删除主题、订阅消息、查询 endpoint 消息以及心跳消息等。vnode 则专注于处理消费消息和 commit 消息。当 mnode 收到消费者的订阅消息时,如果该消费者尚未订阅过,其状态将被设置为 rebalancing。如果消费者已经订阅过,但订阅的主题发生变更,消费者的状态同样会被设置为 rebalancing。然后 mnode 会对 rebalancing 状态的消费者执行 rebalance 操作。心跳超过固定时间的消费者或主动关闭的消费者将被删除。
|
||||||
|
|
||||||
消费者会定期向 mnode 发送查询 endpoint 消息,以获取再平衡后的最新 vnode 分配结果。同时,消费者还会定期发送心跳消息,通知 mnode 自身处于活跃状态。此外,消费者的一些信息也会通过心跳消息上报至 mnode,用户可以查询 mnode 上的这些信息以监测各个消费者的状态。这种设计有助于实现对消费者的有效管理和监控。
|
消费者会定期向 mnode 发送查询 endpoint 消息,以获取再平衡后的最新 vnode 分配结果。同时,消费者还会定期发送心跳消息,通知 mnode 自身处于活跃状态。此外,消费者的一些信息也会通过心跳消息上报至 mnode,用户可以查询 mnode 上的这些信息以监测各个消费者的状态。这种设计有助于实现对消费者的有效管理和监控。
|
||||||
|
|
||||||
## 再平衡过程
|
## rebalance 过程
|
||||||
|
|
||||||
每个主题的数据可能分散在多个 vnode 上。服务器通过执行再平衡过程,将这些vnode 合理地分配给各个消费者,确保数据的均匀分布和高效消费。
|
每个主题的数据可能分散在多个 vnode 上。服务器通过执行 rebalance 过程,将这些 vnode 合理地分配给各个消费者,确保数据的均匀分布和高效消费。
|
||||||
|
|
||||||
如下图所示,c1 表示消费者 1,c2 表示消费者 2,g1 表示消费组 1。起初 g1 中只有 c1 消费数据,c1 发送订阅信息到 mnode,mnode 把数据所在的所有 4 个vnode 分配给 c1。当 c2 增加到 g1 后,c2 将订阅信息发送给 mnode,mnode 将在下一次再平衡计时器到来时检测到这个 g1 需要重新分配,就会启动再平衡过程,随后 c2 分得其中两个 vnode 消费。分配信息还会通过 mnode 发送给 vnode,同时 c1 和 c2 也会获取自己消费的 vnode 信息并开始消费。
|
如下图所示,c1 表示消费者 1,c2 表示消费者 2,g1 表示消费组 1。起初 g1 中只有 c1 消费数据,c1 发送订阅信息到 mnode,mnode 把数据所在的所有 4 个vnode 分配给 c1。当 c2 增加到 g1 后,c2 将订阅信息发送给 mnode,mnode 检测到这个 g1 需要重新分配,就会启动 rebalance 过程,随后 c2 分得其中两个 vnode 消费。分配信息还会通过 mnode 发送给 vnode,同时 c1 和 c2 也会获取自己消费的 vnode 信息并开始消费。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
再平衡计时器每 2s 检测一次是否需要再平衡。在再平衡过程中,如果消费者获取的状态是 not ready,则不能进行消费。只有再平衡正常结束后,消费者获取分配 vnode 的offset 后才可正常消费,否则消费者会重试指定次数后报错。
|
再平衡计时器每 2s 检测一次是否需要再平衡。在再平衡过程中,如果消费者获取的状态是 not ready,则不能进行消费。只有再平衡正常结束后,消费者获取分配 vnode 的offset 后才可正常消费,否则消费者会重试指定次数后报错。
|
||||||
|
|
||||||
## 消费者状态处理
|
## 消费者状态处理
|
||||||
|
|
||||||
消费者的状态转换过程如下图所示。初始状态下,刚发起订阅的消费者处于modify 状态,此时客户端获取的消费者状态为 not ready,表明消费者尚未准备好进行数据消费。一旦 mnode 在再平衡计时器中检测到处于 modify 状态的消费者,便会启动再平衡过程。再平衡成功后,消费者的状态将转变为 ready,表示消费者已准备就绪。随后,当消费者通过定时的查询 endpoint 消息获取自身的 ready 状态以及分配的 vnode 列表后,便能正式开始消费数据。
|
消费者的状态转换过程如下图所示。初始状态下,刚发起订阅的消费者处于 rebalancing 状态,表明消费者尚未准备好进行数据消费。一旦 mnode 检测到处于 rebalancing 状态的消费者,便会启动 rebalance 过程,成功后,消费者的状态将转变为 ready,表示消费者已准备就绪。随后,当消费者通过定时的查询 endpoint 消息获取自身的 ready 状态以及分配的 vnode 列表后,便能正式开始消费数据。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
若消费者的心跳丢失时间超过 12s,经过再平衡过程,其状态将被更新为 lost,表明消费者被认为已离线。如果心跳丢失时间超过 1 天,消费者的状态将进一步转变为 clear,此时消费者将被系统删除。然而,如果在上述过程中消费者重新发送心跳信号,其状态将恢复为 modify,并重新进入下一轮的再平衡过程。
|
若消费者的心跳丢失时间超过 12s,经过 rebalance 过程,其状态将被更新为 clear,然后消费者将被系统删除。
|
||||||
|
|
||||||
当消费者主动退出时,会发送 unsubscribe 消息。该消息将清除消费者订阅的所有主题,并将消费者的状态设置为 modify。随后,在再平衡过程中,一旦消费者的状态变为ready 且无订阅的主题,mnode 将在再平衡的计时器中检测到此状态变化,并据此删除该消费者。这一系列措施确保了消费者退出的有序性和系统的稳定性。
|
当消费者主动退出时,会发送 unsubscribe 消息。该消息将清除消费者订阅的所有主题,并将消费者的状态设置为 rebalancing。随后,检测到处于 rebalancing 状态的消费者,便会启动 rebalance 过程,成功后,其状态将被更新为 clear,然后消费者将被系统删除。这一系列措施确保了消费者退出的有序性和系统的稳定性。
|
||||||
|
|
||||||
## 消费数据
|
## 消费数据
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 232 KiB After Width: | Height: | Size: 282 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 56 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 215 KiB After Width: | Height: | Size: 103 KiB |
|
@ -2817,8 +2817,8 @@ enum {
|
||||||
TOPIC_SUB_TYPE__COLUMN,
|
TOPIC_SUB_TYPE__COLUMN,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DEFAULT_MAX_POLL_INTERVAL 3000000
|
#define DEFAULT_MAX_POLL_INTERVAL 300000
|
||||||
#define DEFAULT_SESSION_TIMEOUT 12000
|
#define DEFAULT_SESSION_TIMEOUT 12000
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic
|
char name[TSDB_TOPIC_FNAME_LEN]; // accout.topic
|
||||||
|
|
|
@ -49,7 +49,7 @@ int32_t toUInteger(const char *z, int32_t n, int32_t base, uint64_t *value);
|
||||||
*/
|
*/
|
||||||
int32_t toIntegerPure(const char *z, int32_t n, int32_t base, int64_t *value);
|
int32_t toIntegerPure(const char *z, int32_t n, int32_t base, int64_t *value);
|
||||||
|
|
||||||
void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type);
|
int32_t taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type);
|
||||||
|
|
||||||
void taosVariantDestroy(SVariant *pV);
|
void taosVariantDestroy(SVariant *pV);
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ typedef struct {
|
||||||
} SAuditRecord;
|
} SAuditRecord;
|
||||||
|
|
||||||
int32_t auditInit(const SAuditCfg *pCfg);
|
int32_t auditInit(const SAuditCfg *pCfg);
|
||||||
|
void auditSetDnodeId(int32_t dnodeId);
|
||||||
void auditCleanup();
|
void auditCleanup();
|
||||||
int32_t auditSend(SJson *pJson);
|
int32_t auditSend(SJson *pJson);
|
||||||
void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2,
|
void auditRecord(SRpcMsg *pReq, int64_t clusterId, char *operation, char *target1, char *target2,
|
||||||
|
|
|
@ -218,6 +218,7 @@ typedef struct {
|
||||||
} SDmNotifyHandle;
|
} SDmNotifyHandle;
|
||||||
|
|
||||||
int32_t monInit(const SMonCfg *pCfg);
|
int32_t monInit(const SMonCfg *pCfg);
|
||||||
|
void monSetDnodeId(int32_t dnodeId);
|
||||||
void monInitVnode();
|
void monInitVnode();
|
||||||
void monCleanup();
|
void monCleanup();
|
||||||
void monRecordLog(int64_t ts, ELogLevel level, const char *content);
|
void monRecordLog(int64_t ts, ELogLevel level, const char *content);
|
||||||
|
|
|
@ -173,6 +173,7 @@ int32_t nodesNodeToSQL(SNode* pNode, char* buf, int32_t bufSize, int32_t* len);
|
||||||
char* nodesGetNameFromColumnNode(SNode* pNode);
|
char* nodesGetNameFromColumnNode(SNode* pNode);
|
||||||
int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots);
|
int32_t nodesGetOutputNumFromSlotList(SNodeList* pSlots);
|
||||||
void nodesSortList(SNodeList** pList, int32_t (*)(SNode* pNode1, SNode* pNode2));
|
void nodesSortList(SNodeList** pList, int32_t (*)(SNode* pNode1, SNode* pNode2));
|
||||||
|
void destroyFuncParam(void* pFuncStruct);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,11 @@ typedef enum { HTTP_GZIP, HTTP_FLAT } EHttpCompFlag;
|
||||||
int32_t taosSendHttpReport(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen,
|
int32_t taosSendHttpReport(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen,
|
||||||
EHttpCompFlag flag);
|
EHttpCompFlag flag);
|
||||||
|
|
||||||
|
int32_t taosSendHttpReportWithQID(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen,
|
||||||
|
EHttpCompFlag flag, const char* qid);
|
||||||
int64_t taosInitHttpChan();
|
int64_t taosInitHttpChan();
|
||||||
int32_t taosSendHttpReportByChan(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen,
|
int32_t taosSendHttpReportByChan(const char* server, const char* uri, uint16_t port, char* pCont, int32_t contLen,
|
||||||
EHttpCompFlag flag, int64_t chanId);
|
EHttpCompFlag flag, int64_t chanId, const char* qid);
|
||||||
void taosDestroyHttpChan(int64_t chanId);
|
void taosDestroyHttpChan(int64_t chanId);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -149,7 +149,7 @@ void setBufPageDirty(void* pPage, bool dirty);
|
||||||
* Set the compress/ no-compress flag for paged buffer, when flushing data in disk.
|
* Set the compress/ no-compress flag for paged buffer, when flushing data in disk.
|
||||||
* @param pBuf
|
* @param pBuf
|
||||||
*/
|
*/
|
||||||
void setBufPageCompressOnDisk(SDiskbasedBuf* pBuf, bool comp);
|
int32_t setBufPageCompressOnDisk(SDiskbasedBuf* pBuf, bool comp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the pageId page buffer is not need
|
* Set the pageId page buffer is not need
|
||||||
|
|
|
@ -37,3 +37,14 @@ int32_t tGenIdPI32(void);
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int64_t tGenIdPI64(void);
|
int64_t tGenIdPI64(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate an qid
|
||||||
|
*+------------+-----+-----------+---------------+
|
||||||
|
*| nodeid| 0| serial number | 0 |
|
||||||
|
*+------------+-----+-----------+---------------+
|
||||||
|
*| 8bit | 16bit|32bit |8bit |
|
||||||
|
*+------------+-----+-----------+---------------+
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int64_t tGenQid64(int8_t dnodeId);
|
||||||
|
|
|
@ -1001,7 +1001,7 @@ int stmtSetTbTags2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* tags) {
|
||||||
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
STMT_ERR_RET(TSDB_CODE_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pStmt->bInfo.inExecCache && (!pStmt->sql.autoCreateTbl || (*pDataBlock)->pData->pCreateTbReq)) {
|
if (pStmt->bInfo.inExecCache && !pStmt->sql.autoCreateTbl) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2620,11 +2620,15 @@ int32_t dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf
|
||||||
}
|
}
|
||||||
len += snprintf(dumpBuf + len, size - len, "%s |end\n", flag);
|
len += snprintf(dumpBuf + len, size - len, "%s |end\n", flag);
|
||||||
|
|
||||||
*pDataBuf = dumpBuf;
|
|
||||||
dumpBuf = NULL;
|
|
||||||
_exit:
|
_exit:
|
||||||
if (dumpBuf) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
taosMemoryFree(dumpBuf);
|
*pDataBuf = dumpBuf;
|
||||||
|
dumpBuf = NULL;
|
||||||
|
} else {
|
||||||
|
uError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
|
||||||
|
if (dumpBuf) {
|
||||||
|
taosMemoryFree(dumpBuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ bool tNameIsValid(const SName* name) {
|
||||||
|
|
||||||
SName* tNameDup(const SName* name) {
|
SName* tNameDup(const SName* name) {
|
||||||
SName* p = taosMemoryMalloc(sizeof(SName));
|
SName* p = taosMemoryMalloc(sizeof(SName));
|
||||||
memcpy(p, name, sizeof(SName));
|
if (p) TAOS_MEMCPY(p, name, sizeof(SName));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ int32_t toUInteger(const char *z, int32_t n, int32_t base, uint64_t *value) {
|
||||||
* @param len
|
* @param len
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type) {
|
int32_t taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uint32_t type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TSDB_DATA_TYPE_BOOL:
|
case TSDB_DATA_TYPE_BOOL:
|
||||||
case TSDB_DATA_TYPE_TINYINT: {
|
case TSDB_DATA_TYPE_TINYINT: {
|
||||||
|
@ -426,6 +426,7 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin
|
||||||
size_t lenInwchar = len / TSDB_NCHAR_SIZE;
|
size_t lenInwchar = len / TSDB_NCHAR_SIZE;
|
||||||
|
|
||||||
pVar->ucs4 = taosMemoryCalloc(1, (lenInwchar + 1) * TSDB_NCHAR_SIZE);
|
pVar->ucs4 = taosMemoryCalloc(1, (lenInwchar + 1) * TSDB_NCHAR_SIZE);
|
||||||
|
if(!pVar->ucs4) return terrno;
|
||||||
(void)memcpy(pVar->ucs4, pz, lenInwchar * TSDB_NCHAR_SIZE);
|
(void)memcpy(pVar->ucs4, pz, lenInwchar * TSDB_NCHAR_SIZE);
|
||||||
pVar->nLen = (int32_t)len;
|
pVar->nLen = (int32_t)len;
|
||||||
|
|
||||||
|
@ -446,6 +447,7 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin
|
||||||
}
|
}
|
||||||
|
|
||||||
pVar->nType = type;
|
pVar->nType = type;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosVariantDestroy(SVariant *pVar) {
|
void taosVariantDestroy(SVariant *pVar) {
|
||||||
|
|
|
@ -14,7 +14,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
|
#include "audit.h"
|
||||||
#include "dmInt.h"
|
#include "dmInt.h"
|
||||||
|
#include "monitor.h"
|
||||||
#include "systable.h"
|
#include "systable.h"
|
||||||
#include "tchecksum.h"
|
#include "tchecksum.h"
|
||||||
|
|
||||||
|
@ -27,6 +29,8 @@ static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) {
|
||||||
(void)taosThreadRwlockWrlock(&pMgmt->pData->lock);
|
(void)taosThreadRwlockWrlock(&pMgmt->pData->lock);
|
||||||
pMgmt->pData->dnodeId = pCfg->dnodeId;
|
pMgmt->pData->dnodeId = pCfg->dnodeId;
|
||||||
pMgmt->pData->clusterId = pCfg->clusterId;
|
pMgmt->pData->clusterId = pCfg->clusterId;
|
||||||
|
monSetDnodeId(pCfg->dnodeId);
|
||||||
|
auditSetDnodeId(pCfg->dnodeId);
|
||||||
code = dmWriteEps(pMgmt->pData);
|
code = dmWriteEps(pMgmt->pData);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
dInfo("failed to set local info, dnodeId:%d clusterId:%" PRId64 " reason:%s", pCfg->dnodeId, pCfg->clusterId,
|
dInfo("failed to set local info, dnodeId:%d clusterId:%" PRId64 " reason:%s", pCfg->dnodeId, pCfg->clusterId,
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
#include "dmMgmt.h"
|
#include "dmMgmt.h"
|
||||||
|
#include "dmUtil.h"
|
||||||
|
#include "monitor.h"
|
||||||
|
#include "audit.h"
|
||||||
|
|
||||||
int32_t dmOpenNode(SMgmtWrapper *pWrapper) {
|
int32_t dmOpenNode(SMgmtWrapper *pWrapper) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -98,6 +101,9 @@ static int32_t dmOpenNodes(SDnode *pDnode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auditSetDnodeId(dmGetDnodeId(&pDnode->data));
|
||||||
|
monSetDnodeId(dmGetDnodeId(&pDnode->data));
|
||||||
|
|
||||||
dmSetStatus(pDnode, DND_STAT_RUNNING);
|
dmSetStatus(pDnode, DND_STAT_RUNNING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,6 +217,7 @@ int32_t dmInitDndInfo(SDnodeData *pData);
|
||||||
|
|
||||||
// dmEps.c
|
// dmEps.c
|
||||||
int32_t dmGetDnodeSize(SDnodeData *pData);
|
int32_t dmGetDnodeSize(SDnodeData *pData);
|
||||||
|
int32_t dmGetDnodeId(SDnodeData *pData);
|
||||||
int32_t dmReadEps(SDnodeData *pData);
|
int32_t dmReadEps(SDnodeData *pData);
|
||||||
int32_t dmWriteEps(SDnodeData *pData);
|
int32_t dmWriteEps(SDnodeData *pData);
|
||||||
void dmUpdateEps(SDnodeData *pData, SArray *pDnodeEps);
|
void dmUpdateEps(SDnodeData *pData, SArray *pDnodeEps);
|
||||||
|
|
|
@ -88,3 +88,5 @@ void dmGetMonitorSystemInfo(SMonSysInfo *pInfo) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t dmGetDnodeId(SDnodeData *pData) { return pData->dnodeId; }
|
|
@ -81,7 +81,7 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
|
||||||
code = terrno;
|
code = terrno;
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_READY));
|
||||||
|
|
||||||
mInfo("acct:%s, will be created when deploying, raw:%p", acctObj.acct, pRaw);
|
mInfo("acct:%s, will be created when deploying, raw:%p", acctObj.acct, pRaw);
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,9 @@ static int32_t mndArbGroupActionUpdate(SSdb *pSdb, SArbGroup *pOld, SArbGroup *p
|
||||||
_OVER:
|
_OVER:
|
||||||
(void)taosThreadMutexUnlock(&pOld->mutex);
|
(void)taosThreadMutexUnlock(&pOld->mutex);
|
||||||
|
|
||||||
(void)taosHashRemove(arbUpdateHash, &pOld->vgId, sizeof(int32_t));
|
if (taosHashRemove(arbUpdateHash, &pOld->vgId, sizeof(int32_t)) != 0) {
|
||||||
|
mError("arbgroup:%d, failed to remove from arbUpdateHash", pOld->vgId);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +453,7 @@ static int32_t mndProcessArbHbTimer(SRpcMsg *pReq) {
|
||||||
int64_t mndTerm = mndGetTerm(pMnode);
|
int64_t mndTerm = mndGetTerm(pMnode);
|
||||||
|
|
||||||
if (mndIsDnodeOnline(pDnode, nowMs)) {
|
if (mndIsDnodeOnline(pDnode, nowMs)) {
|
||||||
(void)mndSendArbHeartBeatReq(pDnode, arbToken, mndTerm, hbMembers);
|
TAOS_CHECK_RETURN(mndSendArbHeartBeatReq(pDnode, arbToken, mndTerm, hbMembers));
|
||||||
}
|
}
|
||||||
|
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
|
@ -684,7 +686,7 @@ static int32_t mndProcessArbCheckSyncTimer(SRpcMsg *pReq) {
|
||||||
sdbRelease(pSdb, pArbGroup);
|
sdbRelease(pSdb, pArbGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)mndPullupArbUpdateGroupBatch(pMnode, pUpdateArray);
|
TAOS_CHECK_RETURN(mndPullupArbUpdateGroupBatch(pMnode, pUpdateArray));
|
||||||
|
|
||||||
taosArrayDestroy(pUpdateArray);
|
taosArrayDestroy(pUpdateArray);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -795,7 +797,9 @@ _OVER:
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
for (size_t i = 0; i < sz; i++) {
|
for (size_t i = 0; i < sz; i++) {
|
||||||
SArbGroup *pNewGroup = taosArrayGet(newGroupArray, i);
|
SArbGroup *pNewGroup = taosArrayGet(newGroupArray, i);
|
||||||
(void)taosHashRemove(arbUpdateHash, &pNewGroup->vgId, sizeof(pNewGroup->vgId));
|
if (taosHashRemove(arbUpdateHash, &pNewGroup->vgId, sizeof(pNewGroup->vgId)) != 0) {
|
||||||
|
mError("failed to remove vgId:%d from arbUpdateHash", pNewGroup->vgId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,7 +843,9 @@ static int32_t mndProcessArbUpdateGroupBatchReq(SRpcMsg *pReq) {
|
||||||
SArbGroup *pOldGroup = sdbAcquire(pMnode->pSdb, SDB_ARBGROUP, &newGroup.vgId);
|
SArbGroup *pOldGroup = sdbAcquire(pMnode->pSdb, SDB_ARBGROUP, &newGroup.vgId);
|
||||||
if (!pOldGroup) {
|
if (!pOldGroup) {
|
||||||
mInfo("vgId:%d, arb skip to update arbgroup, since no obj found", newGroup.vgId);
|
mInfo("vgId:%d, arb skip to update arbgroup, since no obj found", newGroup.vgId);
|
||||||
(void)taosHashRemove(arbUpdateHash, &newGroup.vgId, sizeof(int32_t));
|
if (taosHashRemove(arbUpdateHash, &newGroup.vgId, sizeof(int32_t)) != 0) {
|
||||||
|
mError("failed to remove vgId:%d from arbUpdateHash", newGroup.vgId);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,7 +875,9 @@ _OVER:
|
||||||
// failed to update arbgroup
|
// failed to update arbgroup
|
||||||
for (size_t i = 0; i < sz; i++) {
|
for (size_t i = 0; i < sz; i++) {
|
||||||
SMArbUpdateGroup *pUpdateGroup = taosArrayGet(req.updateArray, i);
|
SMArbUpdateGroup *pUpdateGroup = taosArrayGet(req.updateArray, i);
|
||||||
(void)taosHashRemove(arbUpdateHash, &pUpdateGroup->vgId, sizeof(int32_t));
|
if (taosHashRemove(arbUpdateHash, &pUpdateGroup->vgId, sizeof(int32_t)) != 0) {
|
||||||
|
mError("failed to remove vgId:%d from arbUpdateHash", pUpdateGroup->vgId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1010,7 +1018,7 @@ static int32_t mndUpdateArbHeartBeat(SMnode *pMnode, int32_t dnodeId, SArray *me
|
||||||
sdbRelease(pMnode->pSdb, pGroup);
|
sdbRelease(pMnode->pSdb, pGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)mndPullupArbUpdateGroupBatch(pMnode, pUpdateArray);
|
TAOS_CHECK_RETURN(mndPullupArbUpdateGroupBatch(pMnode, pUpdateArray));
|
||||||
|
|
||||||
taosArrayDestroy(pUpdateArray);
|
taosArrayDestroy(pUpdateArray);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1102,7 +1110,7 @@ static int32_t mndProcessArbHbRsp(SRpcMsg *pRsp) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)mndUpdateArbHeartBeat(pMnode, arbHbRsp.dnodeId, arbHbRsp.hbMembers);
|
TAOS_CHECK_GOTO(mndUpdateArbHeartBeat(pMnode, arbHbRsp.dnodeId, arbHbRsp.hbMembers), NULL, _OVER);
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
@ -1249,6 +1257,8 @@ static int32_t mndRetrieveArbGroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
SArbGroup *pGroup = NULL;
|
SArbGroup *pGroup = NULL;
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = sdbFetch(pSdb, SDB_ARBGROUP, pShow->pIter, (void **)&pGroup);
|
pShow->pIter = sdbFetch(pSdb, SDB_ARBGROUP, pShow->pIter, (void **)&pGroup);
|
||||||
|
@ -1264,33 +1274,40 @@ static int32_t mndRetrieveArbGroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
||||||
sdbRelease(pSdb, pGroup);
|
sdbRelease(pSdb, pGroup);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
char dbNameInGroup[TSDB_DB_FNAME_LEN];
|
||||||
|
strncpy(dbNameInGroup, pVgObj->dbName, TSDB_DB_FNAME_LEN);
|
||||||
|
sdbRelease(pSdb, pVgObj);
|
||||||
|
|
||||||
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pVgObj->dbName), TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE);
|
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(dbNameInGroup), TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false), pGroup, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->vgId, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->vgId, false), pGroup, &lino, _OVER);
|
||||||
|
|
||||||
for (int i = 0; i < TSDB_ARB_GROUP_MEMBER_NUM; i++) {
|
for (int i = 0; i < TSDB_ARB_GROUP_MEMBER_NUM; i++) {
|
||||||
SArbGroupMember *pMember = &pGroup->members[i];
|
SArbGroupMember *pMember = &pGroup->members[i];
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pMember->info.dnodeId, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pMember->info.dnodeId, false), pGroup,
|
||||||
|
&lino, _OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->isSync, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->isSync, false), pGroup, &lino, _OVER);
|
||||||
|
|
||||||
if (pGroup->assignedLeader.dnodeId != 0) {
|
if (pGroup->assignedLeader.dnodeId != 0) {
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->assignedLeader.dnodeId, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->assignedLeader.dnodeId, false),
|
||||||
|
pGroup, &lino, _OVER);
|
||||||
|
|
||||||
char token[TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE] = {0};
|
char token[TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(token, pGroup->assignedLeader.token, TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE);
|
STR_WITH_MAXSIZE_TO_VARSTR(token, pGroup->assignedLeader.token, TSDB_ARB_TOKEN_SIZE + VARSTR_HEADER_SIZE);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)token, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)token, false), pGroup, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->assignedLeader.acked, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pGroup->assignedLeader.acked, false),
|
||||||
|
pGroup, &lino, _OVER);
|
||||||
} else {
|
} else {
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataSetNULL(pColInfo, numOfRows);
|
colDataSetNULL(pColInfo, numOfRows);
|
||||||
|
@ -1305,10 +1322,11 @@ static int32_t mndRetrieveArbGroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
||||||
(void)taosThreadMutexUnlock(&pGroup->mutex);
|
(void)taosThreadMutexUnlock(&pGroup->mutex);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pVgObj);
|
|
||||||
sdbRelease(pSdb, pGroup);
|
sdbRelease(pSdb, pGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) mError("failed to restrieve arb group at line:%d, since %s", lino, tstrerror(code));
|
||||||
pShow->numOfRows += numOfRows;
|
pShow->numOfRows += numOfRows;
|
||||||
|
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
|
|
|
@ -287,6 +287,8 @@ int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock,
|
||||||
SCompactObj *pCompact = NULL;
|
SCompactObj *pCompact = NULL;
|
||||||
char *sep = NULL;
|
char *sep = NULL;
|
||||||
SDbObj *pDb = NULL;
|
SDbObj *pDb = NULL;
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
if (strlen(pShow->db) > 0) {
|
if (strlen(pShow->db) > 0) {
|
||||||
sep = strchr(pShow->db, '.');
|
sep = strchr(pShow->db, '.');
|
||||||
|
@ -310,26 +312,30 @@ int32_t mndRetrieveCompact(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock,
|
||||||
char tmpBuf[TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE] = {0};
|
char tmpBuf[TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->compactId, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->compactId, false), pCompact, &lino,
|
||||||
|
_OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
if (pDb != NULL || !IS_SYS_DBNAME(pCompact->dbname)) {
|
if (pDb != NULL || !IS_SYS_DBNAME(pCompact->dbname)) {
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
(void)tNameFromString(&name, pCompact->dbname, T_NAME_ACCT | T_NAME_DB);
|
TAOS_CHECK_GOTO(tNameFromString(&name, pCompact->dbname, T_NAME_ACCT | T_NAME_DB), &lino, _OVER);
|
||||||
(void)tNameGetDbName(&name, varDataVal(tmpBuf));
|
(void)tNameGetDbName(&name, varDataVal(tmpBuf));
|
||||||
} else {
|
} else {
|
||||||
(void)strncpy(varDataVal(tmpBuf), pCompact->dbname, TSDB_SHOW_SQL_LEN);
|
(void)strncpy(varDataVal(tmpBuf), pCompact->dbname, TSDB_SHOW_SQL_LEN);
|
||||||
}
|
}
|
||||||
varDataSetLen(tmpBuf, strlen(varDataVal(tmpBuf)));
|
varDataSetLen(tmpBuf, strlen(varDataVal(tmpBuf)));
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)tmpBuf, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)tmpBuf, false), pCompact, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->startTime, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pCompact->startTime, false), pCompact, &lino,
|
||||||
|
_OVER);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pCompact);
|
sdbRelease(pSdb, pCompact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||||
pShow->numOfRows += numOfRows;
|
pShow->numOfRows += numOfRows;
|
||||||
mndReleaseDb(pMnode, pDb);
|
mndReleaseDb(pMnode, pDb);
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
|
@ -468,7 +474,7 @@ static int32_t mndKillCompact(SMnode *pMnode, SRpcMsg *pReq, SCompactObj *pCompa
|
||||||
mndTransDrop(pTrans);
|
mndTransDrop(pTrans);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
|
sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -981,7 +981,8 @@ static int32_t mndProcessCreateDbReq(SRpcMsg *pReq) {
|
||||||
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
|
||||||
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
(void)tNameFromString(&name, createReq.db, T_NAME_ACCT | T_NAME_DB);
|
if (tNameFromString(&name, createReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
|
||||||
|
mError("db:%s, failed to parse db name", createReq.db);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "createDB", name.dbname, "", createReq.sql, createReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "createDB", name.dbname, "", createReq.sql, createReq.sqlLen);
|
||||||
|
|
||||||
|
@ -1135,7 +1136,10 @@ static int32_t mndSetAlterDbPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
|
if ((code = sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY)) != 0) {
|
||||||
|
sdbFreeRaw(pRedoRaw);
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1152,7 +1156,10 @@ static int32_t mndSetAlterDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY);
|
if ((code = sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY)) != 0) {
|
||||||
|
sdbFreeRaw(pCommitRaw);
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
}
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1284,7 +1291,8 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
(void)tNameFromString(&name, alterReq.db, T_NAME_ACCT | T_NAME_DB);
|
if (tNameFromString(&name, alterReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
|
||||||
|
mError("db:%s, failed to parse db name", alterReq.db);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "alterDB", name.dbname, "", alterReq.sql, alterReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "alterDB", name.dbname, "", alterReq.sql, alterReq.sqlLen);
|
||||||
|
|
||||||
|
@ -1371,7 +1379,11 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)tSerializeSDbCfgRsp(pRsp, contLen, &cfgRsp);
|
int32_t ret = 0;
|
||||||
|
if ((ret = tSerializeSDbCfgRsp(pRsp, contLen, &cfgRsp)) < 0) {
|
||||||
|
code = ret;
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
pReq->info.rsp = pRsp;
|
pReq->info.rsp = pRsp;
|
||||||
pReq->info.rspLen = contLen;
|
pReq->info.rspLen = contLen;
|
||||||
|
@ -1473,7 +1485,11 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pVgRaw, SDB_STATUS_DROPPED);
|
if ((code = sdbSetRawStatus(pVgRaw, SDB_STATUS_DROPPED)) != 0) {
|
||||||
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
sdbRelease(pSdb, pVgroup);
|
||||||
|
TAOS_RETURN(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sdbRelease(pSdb, pVgroup);
|
sdbRelease(pSdb, pVgroup);
|
||||||
|
@ -1498,7 +1514,11 @@ static int32_t mndSetDropDbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
||||||
sdbRelease(pSdb, pStbRaw);
|
sdbRelease(pSdb, pStbRaw);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED);
|
if ((code = sdbSetRawStatus(pStbRaw, SDB_STATUS_DROPPED)) != 0) {
|
||||||
|
sdbCancelFetch(pSdb, pIter);
|
||||||
|
sdbRelease(pSdb, pStbRaw);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sdbRelease(pSdb, pStb);
|
sdbRelease(pSdb, pStb);
|
||||||
|
@ -1562,7 +1582,8 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)tSerializeSDropDbRsp(pRsp, rspLen, &dropRsp);
|
int32_t ret = 0;
|
||||||
|
if ((ret = tSerializeSDropDbRsp(pRsp, rspLen, &dropRsp)) < 0) return ret;
|
||||||
*pRspLen = rspLen;
|
*pRspLen = rspLen;
|
||||||
*ppRsp = pRsp;
|
*ppRsp = pRsp;
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
|
@ -1643,7 +1664,8 @@ static int32_t mndProcessDropDbReq(SRpcMsg *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
(void)tNameFromString(&name, dropReq.db, T_NAME_ACCT | T_NAME_DB);
|
if (tNameFromString(&name, dropReq.db, T_NAME_ACCT | T_NAME_DB) < 0)
|
||||||
|
mError("db:%s, failed to parse db name", dropReq.db);
|
||||||
|
|
||||||
auditRecord(pReq, pMnode->clusterId, "dropDB", name.dbname, "", dropReq.sql, dropReq.sqlLen);
|
auditRecord(pReq, pMnode->clusterId, "dropDB", name.dbname, "", dropReq.sql, dropReq.sqlLen);
|
||||||
|
|
||||||
|
@ -1805,14 +1827,18 @@ static int32_t mndProcessUseDbReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)tSerializeSUseDbRsp(pRsp, contLen, &usedbRsp);
|
int32_t ret = 0;
|
||||||
|
if ((ret = tSerializeSUseDbRsp(pRsp, contLen, &usedbRsp)) < 0) {
|
||||||
|
code = ret;
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
pReq->info.rsp = pRsp;
|
pReq->info.rsp = pRsp;
|
||||||
pReq->info.rspLen = contLen;
|
pReq->info.rspLen = contLen;
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
mError("db:%s, failed to process use db req since %s", usedbReq.db, terrstr());
|
mError("db:%s, failed to process use db req since %s", usedbReq.db, tstrerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
mndReleaseDb(pMnode, pDb);
|
mndReleaseDb(pMnode, pDb);
|
||||||
|
@ -1964,7 +1990,8 @@ int32_t mndValidateDbInfo(SMnode *pMnode, SDbCacheInfo *pDbs, int32_t numOfDbs,
|
||||||
tFreeSDbHbBatchRsp(&batchRsp);
|
tFreeSDbHbBatchRsp(&batchRsp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)tSerializeSDbHbBatchRsp(pRsp, rspLen, &batchRsp);
|
int32_t ret = 0;
|
||||||
|
if ((ret = tSerializeSDbHbBatchRsp(pRsp, rspLen, &batchRsp)) < 0) return ret;
|
||||||
|
|
||||||
*ppRsp = pRsp;
|
*ppRsp = pRsp;
|
||||||
*pRspLen = rspLen;
|
*pRspLen = rspLen;
|
||||||
|
@ -1977,6 +2004,7 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
SVgObj *pVgroup = NULL;
|
SVgObj *pVgroup = NULL;
|
||||||
void *pIter = NULL;
|
void *pIter = NULL;
|
||||||
|
int32_t code = 0;
|
||||||
SVTrimDbReq trimReq = {.timestamp = taosGetTimestampSec()};
|
SVTrimDbReq trimReq = {.timestamp = taosGetTimestampSec()};
|
||||||
int32_t reqLen = tSerializeSVTrimDbReq(NULL, 0, &trimReq);
|
int32_t reqLen = tSerializeSVTrimDbReq(NULL, 0, &trimReq);
|
||||||
int32_t contLen = reqLen + sizeof(SMsgHead);
|
int32_t contLen = reqLen + sizeof(SMsgHead);
|
||||||
|
@ -1993,7 +2021,11 @@ static int32_t mndTrimDb(SMnode *pMnode, SDbObj *pDb) {
|
||||||
}
|
}
|
||||||
pHead->contLen = htonl(contLen);
|
pHead->contLen = htonl(contLen);
|
||||||
pHead->vgId = htonl(pVgroup->vgId);
|
pHead->vgId = htonl(pVgroup->vgId);
|
||||||
(void)tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), contLen, &trimReq);
|
int32_t ret = 0;
|
||||||
|
if ((ret = tSerializeSVTrimDbReq((char *)pHead + sizeof(SMsgHead), contLen, &trimReq)) < 0) {
|
||||||
|
sdbRelease(pSdb, pVgroup);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {.msgType = TDMT_VND_TRIM, .pCont = pHead, .contLen = contLen};
|
SRpcMsg rpcMsg = {.msgType = TDMT_VND_TRIM, .pCont = pHead, .contLen = contLen};
|
||||||
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||||
|
@ -2046,6 +2078,7 @@ static int32_t mndS3MigrateDb(SMnode *pMnode, SDbObj *pDb) {
|
||||||
SVS3MigrateDbReq s3migrateReq = {.timestamp = taosGetTimestampSec()};
|
SVS3MigrateDbReq s3migrateReq = {.timestamp = taosGetTimestampSec()};
|
||||||
int32_t reqLen = tSerializeSVS3MigrateDbReq(NULL, 0, &s3migrateReq);
|
int32_t reqLen = tSerializeSVS3MigrateDbReq(NULL, 0, &s3migrateReq);
|
||||||
int32_t contLen = reqLen + sizeof(SMsgHead);
|
int32_t contLen = reqLen + sizeof(SMsgHead);
|
||||||
|
int32_t code = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||||
|
@ -2061,7 +2094,11 @@ static int32_t mndS3MigrateDb(SMnode *pMnode, SDbObj *pDb) {
|
||||||
}
|
}
|
||||||
pHead->contLen = htonl(contLen);
|
pHead->contLen = htonl(contLen);
|
||||||
pHead->vgId = htonl(pVgroup->vgId);
|
pHead->vgId = htonl(pVgroup->vgId);
|
||||||
(void)tSerializeSVS3MigrateDbReq((char *)pHead + sizeof(SMsgHead), contLen, &s3migrateReq);
|
int32_t ret = 0;
|
||||||
|
if ((ret = tSerializeSVS3MigrateDbReq((char *)pHead + sizeof(SMsgHead), contLen, &s3migrateReq)) < 0) {
|
||||||
|
sdbRelease(pSdb, pVgroup);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {.msgType = TDMT_VND_S3MIGRATE, .pCont = pHead, .contLen = contLen};
|
SRpcMsg rpcMsg = {.msgType = TDMT_VND_S3MIGRATE, .pCont = pHead, .contLen = contLen};
|
||||||
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
SEpSet epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||||
|
@ -2243,6 +2280,8 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
int32_t bytes = pShow->pMeta->pSchemas[cols].bytes;
|
int32_t bytes = pShow->pMeta->pSchemas[cols].bytes;
|
||||||
char *buf = taosMemoryMalloc(bytes);
|
char *buf = taosMemoryMalloc(bytes);
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
const char *name = mndGetDbStr(pDb->name);
|
const char *name = mndGetDbStr(pDb->name);
|
||||||
if (name != NULL) {
|
if (name != NULL) {
|
||||||
|
@ -2286,47 +2325,47 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
||||||
for (int32_t i = 0; i < pShow->numOfColumns; ++i) {
|
for (int32_t i = 0; i < pShow->numOfColumns; ++i) {
|
||||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
(void)colDataSetVal(pColInfo, rows, buf, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, buf, false), &lino, _OVER);
|
||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false), &lino, _OVER);
|
||||||
} else if (i == 3) {
|
} else if (i == 3) {
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false), &lino, _OVER);
|
||||||
} else if (i == 14) {
|
} else if (i == 14) {
|
||||||
(void)colDataSetVal(pColInfo, rows, precVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, precVstr, false), &lino, _OVER);
|
||||||
} else if (i == 15) {
|
} else if (i == 15) {
|
||||||
(void)colDataSetVal(pColInfo, rows, statusVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, statusVstr, false), &lino, _OVER);
|
||||||
} else {
|
} else {
|
||||||
colDataSetNULL(pColInfo, rows);
|
colDataSetNULL(pColInfo, rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, buf, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, buf, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->createdTime, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfVgroups, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfVgroups, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&numOfTables, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.replications, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.replications, false), &lino, _OVER);
|
||||||
|
|
||||||
const char *strictStr = pDb->cfg.strict ? "on" : "off";
|
const char *strictStr = pDb->cfg.strict ? "on" : "off";
|
||||||
char strictVstr[24] = {0};
|
char strictVstr[24] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(strictVstr, strictStr, 24);
|
STR_WITH_MAXSIZE_TO_VARSTR(strictVstr, strictStr, 24);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)strictVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)strictVstr, false), &lino, _OVER);
|
||||||
|
|
||||||
char durationVstr[128] = {0};
|
char durationVstr[128] = {0};
|
||||||
int32_t len = formatDurationOrKeep(&durationVstr[VARSTR_HEADER_SIZE], pDb->cfg.daysPerFile);
|
int32_t len = formatDurationOrKeep(&durationVstr[VARSTR_HEADER_SIZE], pDb->cfg.daysPerFile);
|
||||||
|
|
||||||
varDataSetLen(durationVstr, len);
|
varDataSetLen(durationVstr, len);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)durationVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)durationVstr, false), &lino, _OVER);
|
||||||
|
|
||||||
char keepVstr[512] = {0};
|
char keepVstr[512] = {0};
|
||||||
char keep0Str[128] = {0};
|
char keep0Str[128] = {0};
|
||||||
|
@ -2344,67 +2383,67 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
||||||
}
|
}
|
||||||
varDataSetLen(keepVstr, len);
|
varDataSetLen(keepVstr, len);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)keepVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)keepVstr, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.buffer, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.buffer, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pageSize, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pageSize, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pages, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.pages, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.minRows, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.minRows, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.maxRows, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.maxRows, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.compression, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.compression, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)precVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)precVstr, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)statusVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)statusVstr, false), &lino, _OVER);
|
||||||
|
|
||||||
char *rentensionVstr = buildRetension(pDb->cfg.pRetensions);
|
char *rentensionVstr = buildRetension(pDb->cfg.pRetensions);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
if (rentensionVstr == NULL) {
|
if (rentensionVstr == NULL) {
|
||||||
colDataSetNULL(pColInfo, rows);
|
colDataSetNULL(pColInfo, rows);
|
||||||
} else {
|
} else {
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)rentensionVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)rentensionVstr, false), &lino, _OVER);
|
||||||
taosMemoryFree(rentensionVstr);
|
taosMemoryFree(rentensionVstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfStables, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.numOfStables, false), &lino, _OVER);
|
||||||
|
|
||||||
const char *cacheModelStr = getCacheModelStr(pDb->cfg.cacheLast);
|
const char *cacheModelStr = getCacheModelStr(pDb->cfg.cacheLast);
|
||||||
char cacheModelVstr[24] = {0};
|
char cacheModelVstr[24] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(cacheModelVstr, cacheModelStr, 24);
|
STR_WITH_MAXSIZE_TO_VARSTR(cacheModelVstr, cacheModelStr, 24);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)cacheModelVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)cacheModelVstr, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.cacheLastSize, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.cacheLastSize, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walLevel, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walLevel, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walFsyncPeriod, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walFsyncPeriod, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.sstTrigger, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.sstTrigger, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
int16_t hashPrefix = pDb->cfg.hashPrefix;
|
int16_t hashPrefix = pDb->cfg.hashPrefix;
|
||||||
|
@ -2413,39 +2452,40 @@ static void mndDumpDbInfoData(SMnode *pMnode, SSDataBlock *pBlock, SDbObj *pDb,
|
||||||
} else if (hashPrefix < 0) {
|
} else if (hashPrefix < 0) {
|
||||||
hashPrefix = pDb->cfg.hashPrefix + strlen(pDb->name) + 1;
|
hashPrefix = pDb->cfg.hashPrefix + strlen(pDb->name) + 1;
|
||||||
}
|
}
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&hashPrefix, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&hashPrefix, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.hashSuffix, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.hashSuffix, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.tsdbPageSize, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.tsdbPageSize, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.keepTimeOffset, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.keepTimeOffset, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3ChunkSize, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3ChunkSize, false), &lino, _OVER);
|
||||||
|
|
||||||
char keeplocalVstr[128] = {0};
|
char keeplocalVstr[128] = {0};
|
||||||
len = sprintf(&keeplocalVstr[VARSTR_HEADER_SIZE], "%dm", pDb->cfg.s3KeepLocal);
|
len = sprintf(&keeplocalVstr[VARSTR_HEADER_SIZE], "%dm", pDb->cfg.s3KeepLocal);
|
||||||
varDataSetLen(keeplocalVstr, len);
|
varDataSetLen(keeplocalVstr, len);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)keeplocalVstr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)keeplocalVstr, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3Compact, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.s3Compact, false), &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.withArbitrator, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)&pDb->cfg.withArbitrator, false), &lino, _OVER);
|
||||||
|
|
||||||
const char *encryptAlgorithmStr = getEncryptAlgorithmStr(pDb->cfg.encryptAlgorithm);
|
const char *encryptAlgorithmStr = getEncryptAlgorithmStr(pDb->cfg.encryptAlgorithm);
|
||||||
char encryptAlgorithmVStr[24] = {0};
|
char encryptAlgorithmVStr[24] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(encryptAlgorithmVStr, encryptAlgorithmStr, 24);
|
STR_WITH_MAXSIZE_TO_VARSTR(encryptAlgorithmVStr, encryptAlgorithmStr, 24);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, rows, (const char *)encryptAlgorithmVStr, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, rows, (const char *)encryptAlgorithmVStr, false), &lino, _OVER);
|
||||||
}
|
}
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1694,6 +1694,8 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
char cfgVals[TSDB_CONFIG_NUMBER][TSDB_CONFIG_VALUE_LEN + 1] = {0};
|
char cfgVals[TSDB_CONFIG_NUMBER][TSDB_CONFIG_VALUE_LEN + 1] = {0};
|
||||||
char *pWrite = NULL;
|
char *pWrite = NULL;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
cfgOpts[totalRows] = "statusInterval";
|
cfgOpts[totalRows] = "statusInterval";
|
||||||
(void)snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsStatusInterval);
|
(void)snprintf(cfgVals[totalRows], TSDB_CONFIG_VALUE_LEN, "%d", tsStatusInterval);
|
||||||
|
@ -1741,15 +1743,17 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
|
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(buf, cfgOpts[i], TSDB_CONFIG_OPTION_LEN);
|
STR_WITH_MAXSIZE_TO_VARSTR(buf, cfgOpts[i], TSDB_CONFIG_OPTION_LEN);
|
||||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)buf, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)buf, false), &lino, _OVER);
|
||||||
|
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(bufVal, cfgVals[i], TSDB_CONFIG_VALUE_LEN);
|
STR_WITH_MAXSIZE_TO_VARSTR(bufVal, cfgVals[i], TSDB_CONFIG_VALUE_LEN);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)bufVal, false);
|
TAOS_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)bufVal, false), &lino, _OVER);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) mError("failed to retrieve configs at line:%d since %s", lino, tstrerror(code));
|
||||||
pShow->numOfRows += numOfRows;
|
pShow->numOfRows += numOfRows;
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
@ -1765,6 +1769,8 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
SDnodeObj *pDnode = NULL;
|
SDnodeObj *pDnode = NULL;
|
||||||
int64_t curMs = taosGetTimestampMs();
|
int64_t curMs = taosGetTimestampMs();
|
||||||
char buf[TSDB_EP_LEN + VARSTR_HEADER_SIZE];
|
char buf[TSDB_EP_LEN + VARSTR_HEADER_SIZE];
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = sdbFetchAll(pSdb, SDB_DNODE, pShow->pIter, (void **)&pDnode, &objStatus, true);
|
pShow->pIter = sdbFetchAll(pSdb, SDB_DNODE, pShow->pIter, (void **)&pDnode, &objStatus, true);
|
||||||
|
@ -1774,19 +1780,20 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
||||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->id, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->id, false), pDnode, &lino, _OVER);
|
||||||
|
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(buf, pDnode->ep, pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(buf, pDnode->ep, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, buf, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, buf, false), pDnode, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
int16_t id = mndGetVnodesNum(pMnode, pDnode->id);
|
int16_t id = mndGetVnodesNum(pMnode, pDnode->id);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&id, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&id, false), pDnode, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->numOfSupportVnodes, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->numOfSupportVnodes, false), pDnode,
|
||||||
|
&lino, _OVER);
|
||||||
|
|
||||||
const char *status = "ready";
|
const char *status = "ready";
|
||||||
if (objStatus == SDB_STATUS_CREATING) status = "creating";
|
if (objStatus == SDB_STATUS_CREATING) status = "creating";
|
||||||
|
@ -1802,31 +1809,36 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
|
|
||||||
STR_TO_VARSTR(buf, status);
|
STR_TO_VARSTR(buf, status);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, buf, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, buf, false), pDnode, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false), pDnode, &lino,
|
||||||
|
_OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->rebootTime, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->rebootTime, false), pDnode, &lino,
|
||||||
|
_OVER);
|
||||||
|
|
||||||
char *b = taosMemoryCalloc(VARSTR_HEADER_SIZE + strlen(offlineReason[pDnode->offlineReason]) + 1, 1);
|
char *b = taosMemoryCalloc(VARSTR_HEADER_SIZE + strlen(offlineReason[pDnode->offlineReason]) + 1, 1);
|
||||||
STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]);
|
STR_TO_VARSTR(b, online ? "" : offlineReason[pDnode->offlineReason]);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, b, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, b, false), pDnode, &lino, _OVER);
|
||||||
taosMemoryFreeClear(b);
|
taosMemoryFreeClear(b);
|
||||||
|
|
||||||
#ifdef TD_ENTERPRISE
|
#ifdef TD_ENTERPRISE
|
||||||
STR_TO_VARSTR(buf, pDnode->machineId);
|
STR_TO_VARSTR(buf, pDnode->machineId);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, buf, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, buf, false), pDnode, &lino, _OVER);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pDnode);
|
sdbRelease(pSdb, pDnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) mError("failed to retrieve dnodes at line:%d since %s", lino, tstrerror(code));
|
||||||
|
|
||||||
pShow->numOfRows += numOfRows;
|
pShow->numOfRows += numOfRows;
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,6 @@ int mndSetCreateIdxRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStb
|
||||||
}
|
}
|
||||||
static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbObj, SIdxObj *pIdx, int32_t *contLen) {
|
static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbObj, SIdxObj *pIdx, int32_t *contLen) {
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
int32_t ret = 0;
|
|
||||||
|
|
||||||
SDropIndexReq req = {0};
|
SDropIndexReq req = {0};
|
||||||
memcpy(req.colName, pIdx->colName, sizeof(pIdx->colName));
|
memcpy(req.colName, pIdx->colName, sizeof(pIdx->colName));
|
||||||
|
@ -159,7 +158,11 @@ static void *mndBuildDropIdxReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStbOb
|
||||||
pHead->vgId = htonl(pVgroup->vgId);
|
pHead->vgId = htonl(pVgroup->vgId);
|
||||||
|
|
||||||
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
|
void *pBuf = POINTER_SHIFT(pHead, sizeof(SMsgHead));
|
||||||
(void)tSerializeSDropIdxReq(pBuf, len - sizeof(SMsgHead), &req);
|
int32_t ret = 0;
|
||||||
|
if ((ret = tSerializeSDropIdxReq(pBuf, len - sizeof(SMsgHead), &req)) < 0) {
|
||||||
|
terrno = ret;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
*contLen = len;
|
*contLen = len;
|
||||||
return pHead;
|
return pHead;
|
||||||
_err:
|
_err:
|
||||||
|
@ -333,7 +336,7 @@ void mndReleaseIdx(SMnode *pMnode, SIdxObj *pIdx) {
|
||||||
|
|
||||||
SDbObj *mndAcquireDbByIdx(SMnode *pMnode, const char *idxName) {
|
SDbObj *mndAcquireDbByIdx(SMnode *pMnode, const char *idxName) {
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
(void)tNameFromString(&name, idxName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
if ((terrno = tNameFromString(&name, idxName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) < 0) return NULL;
|
||||||
|
|
||||||
char db[TSDB_TABLE_FNAME_LEN] = {0};
|
char db[TSDB_TABLE_FNAME_LEN] = {0};
|
||||||
(void)tNameGetFullDbName(&name, db);
|
(void)tNameGetFullDbName(&name, db);
|
||||||
|
@ -559,6 +562,8 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
SIdxObj *pIdx = NULL;
|
SIdxObj *pIdx = NULL;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
SDbObj *pDb = NULL;
|
SDbObj *pDb = NULL;
|
||||||
if (strlen(pShow->db) > 0) {
|
if (strlen(pShow->db) > 0) {
|
||||||
|
@ -578,7 +583,10 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
||||||
SName idxName = {0};
|
SName idxName = {0};
|
||||||
(void)tNameFromString(&idxName, pIdx->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
if ((code = tNameFromString(&idxName, pIdx->name, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
|
||||||
|
sdbRelease(pSdb, pIdx);
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
char n1[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char n1[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
|
|
||||||
STR_TO_VARSTR(n1, (char *)tNameGetTableName(&idxName));
|
STR_TO_VARSTR(n1, (char *)tNameGetTableName(&idxName));
|
||||||
|
@ -587,42 +595,49 @@ int32_t mndRetrieveTagIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, i
|
||||||
STR_TO_VARSTR(n2, (char *)mndGetDbStr(pIdx->db));
|
STR_TO_VARSTR(n2, (char *)mndGetDbStr(pIdx->db));
|
||||||
|
|
||||||
SName stbName = {0};
|
SName stbName = {0};
|
||||||
(void)tNameFromString(&stbName, pIdx->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE);
|
if ((code = tNameFromString(&stbName, pIdx->stb, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE)) != 0) {
|
||||||
|
sdbRelease(pSdb, pIdx);
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
char n3[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char n3[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_TO_VARSTR(n3, (char *)tNameGetTableName(&stbName));
|
STR_TO_VARSTR(n3, (char *)tNameGetTableName(&stbName));
|
||||||
|
|
||||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n1, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n1, false), pIdx, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n2, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n2, false), pIdx, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)n3, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)n3, false), pIdx, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, NULL, true);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, NULL, true), pIdx, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pIdx->createdTime, false), pIdx, &lino,
|
||||||
|
_OVER);
|
||||||
|
|
||||||
char col[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char col[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_TO_VARSTR(col, (char *)pIdx->colName);
|
STR_TO_VARSTR(col, (char *)pIdx->colName);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)col, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)col, false), pIdx, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
|
||||||
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char tag[TSDB_TABLE_FNAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_TO_VARSTR(tag, (char *)"tag_index");
|
STR_TO_VARSTR(tag, (char *)"tag_index");
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)tag, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)tag, false), pIdx, &lino, _OVER);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pIdx);
|
sdbRelease(pSdb, pIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||||
|
|
||||||
mndReleaseDb(pMnode, pDb);
|
mndReleaseDb(pMnode, pDb);
|
||||||
pShow->numOfRows += numOfRows;
|
pShow->numOfRows += numOfRows;
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
|
|
|
@ -95,7 +95,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
|
||||||
if (terrno != 0) code = terrno;
|
if (terrno != 0) code = terrno;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_READY));
|
||||||
|
|
||||||
mInfo("mnode:%d, will be created when deploying, raw:%p", mnodeObj.id, pRaw);
|
mInfo("mnode:%d, will be created when deploying, raw:%p", mnodeObj.id, pRaw);
|
||||||
|
|
||||||
|
|
|
@ -846,6 +846,7 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
if (pShow->pIter == NULL) {
|
if (pShow->pIter == NULL) {
|
||||||
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
||||||
pShow->pIter = taosCacheCreateIter(pMgmt->connCache);
|
pShow->pIter = taosCacheCreateIter(pMgmt->connCache);
|
||||||
|
if (!pShow->pIter) return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
|
@ -1005,6 +1006,7 @@ static int32_t mndRetrieveQueries(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
if (pShow->pIter == NULL) {
|
if (pShow->pIter == NULL) {
|
||||||
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
||||||
pShow->pIter = taosCacheCreateIter(pMgmt->connCache);
|
pShow->pIter = taosCacheCreateIter(pMgmt->connCache);
|
||||||
|
if (!pShow->pIter) return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
// means fetched some data last time for this conn
|
// means fetched some data last time for this conn
|
||||||
|
@ -1042,6 +1044,7 @@ static int32_t mndRetrieveApps(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
||||||
if (pShow->pIter == NULL) {
|
if (pShow->pIter == NULL) {
|
||||||
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
SProfileMgmt *pMgmt = &pMnode->profileMgmt;
|
||||||
pShow->pIter = taosCacheCreateIter(pMgmt->appCache);
|
pShow->pIter = taosCacheCreateIter(pMgmt->appCache);
|
||||||
|
if (!pShow->pIter) return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
|
|
|
@ -651,6 +651,9 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
||||||
streamObj.targetDbUid = pDb->uid;
|
streamObj.targetDbUid = pDb->uid;
|
||||||
streamObj.version = 1;
|
streamObj.version = 1;
|
||||||
streamObj.sql = taosStrdup(pCreate->sql);
|
streamObj.sql = taosStrdup(pCreate->sql);
|
||||||
|
if (!streamObj.sql) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
streamObj.smaId = smaObj.uid;
|
streamObj.smaId = smaObj.uid;
|
||||||
streamObj.conf.watermark = pCreate->watermark;
|
streamObj.conf.watermark = pCreate->watermark;
|
||||||
streamObj.deleteMark = pCreate->deleteMark;
|
streamObj.deleteMark = pCreate->deleteMark;
|
||||||
|
@ -658,6 +661,10 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
||||||
streamObj.conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE;
|
streamObj.conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE;
|
||||||
streamObj.conf.triggerParam = pCreate->maxDelay;
|
streamObj.conf.triggerParam = pCreate->maxDelay;
|
||||||
streamObj.ast = taosStrdup(smaObj.ast);
|
streamObj.ast = taosStrdup(smaObj.ast);
|
||||||
|
if (!streamObj.ast) {
|
||||||
|
taosMemoryFree(streamObj.sql);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
streamObj.indexForMultiAggBalance = -1;
|
streamObj.indexForMultiAggBalance = -1;
|
||||||
|
|
||||||
// check the maxDelay
|
// check the maxDelay
|
||||||
|
@ -1509,6 +1516,9 @@ static int32_t mndRetrieveIdx(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
|
||||||
if (pShow->pIter == NULL) {
|
if (pShow->pIter == NULL) {
|
||||||
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
||||||
}
|
}
|
||||||
|
if (!pShow->pIter) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
int32_t read = mndRetrieveSma(pReq, pShow, pBlock, rows);
|
int32_t read = mndRetrieveSma(pReq, pShow, pBlock, rows);
|
||||||
if (read < rows) {
|
if (read < rows) {
|
||||||
read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read);
|
read += mndRetrieveTagIdx(pReq, pShow, pBlock, rows - read);
|
||||||
|
@ -1555,27 +1565,6 @@ static void initSMAObj(SCreateTSMACxt* pCxt) {
|
||||||
pCxt->pSma->ast = pCxt->pCreateSmaReq->ast;
|
pCxt->pSma->ast = pCxt->pCreateSmaReq->ast;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initStreamObj(SStreamObj *pStream, const char *streamName, const SMCreateSmaReq *pCreateReq,
|
|
||||||
const SDbObj *pDb, SSmaObj *pSma) {
|
|
||||||
tstrncpy(pStream->name, streamName, TSDB_STREAM_FNAME_LEN);
|
|
||||||
tstrncpy(pStream->sourceDb, pDb->name, TSDB_DB_FNAME_LEN);
|
|
||||||
tstrncpy(pStream->targetDb, pDb->name, TSDB_DB_FNAME_LEN);
|
|
||||||
pStream->createTime = taosGetTimestampMs();
|
|
||||||
pStream->updateTime = pStream->createTime;
|
|
||||||
pStream->uid = mndGenerateUid(streamName, strlen(streamName));
|
|
||||||
pStream->sourceDbUid = pDb->uid;
|
|
||||||
pStream->targetDbUid = pDb->uid;
|
|
||||||
pStream->version = 1;
|
|
||||||
pStream->sql = taosStrdup(pCreateReq->sql);
|
|
||||||
pStream->smaId = pSma->uid;
|
|
||||||
pStream->conf.watermark = 0;
|
|
||||||
pStream->deleteMark = 0;
|
|
||||||
pStream->conf.fillHistory = STREAM_FILL_HISTORY_ON;
|
|
||||||
pStream->conf.trigger = STREAM_TRIGGER_WINDOW_CLOSE;
|
|
||||||
pStream->conf.triggerParam = 10000;
|
|
||||||
pStream->ast = taosStrdup(pSma->ast);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
static int32_t mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
||||||
tstrncpy(pCxt->pCreateStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
tstrncpy(pCxt->pCreateStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
||||||
tstrncpy(pCxt->pCreateStreamReq->sourceDB, pCxt->pDb->name, TSDB_DB_FNAME_LEN);
|
tstrncpy(pCxt->pCreateStreamReq->sourceDB, pCxt->pDb->name, TSDB_DB_FNAME_LEN);
|
||||||
|
@ -1653,11 +1642,15 @@ static int32_t mndCreateTSMABuildCreateStreamReq(SCreateTSMACxt *pCxt) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mndCreateTSMABuildDropStreamReq(SCreateTSMACxt* pCxt) {
|
static int32_t mndCreateTSMABuildDropStreamReq(SCreateTSMACxt* pCxt) {
|
||||||
tstrncpy(pCxt->pDropStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
tstrncpy(pCxt->pDropStreamReq->name, pCxt->streamName, TSDB_STREAM_FNAME_LEN);
|
||||||
pCxt->pDropStreamReq->igNotExists = false;
|
pCxt->pDropStreamReq->igNotExists = false;
|
||||||
pCxt->pDropStreamReq->sql = taosStrdup(pCxt->pDropSmaReq->name);
|
pCxt->pDropStreamReq->sql = taosStrdup(pCxt->pDropSmaReq->name);
|
||||||
|
if (!pCxt->pDropStreamReq->sql) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
pCxt->pDropStreamReq->sqlLen = strlen(pCxt->pDropStreamReq->sql);
|
pCxt->pDropStreamReq->sqlLen = strlen(pCxt->pDropStreamReq->sql);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndSetUpdateDbTsmaVersionPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOld, SDbObj *pNew) {
|
static int32_t mndSetUpdateDbTsmaVersionPrepareLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pOld, SDbObj *pNew) {
|
||||||
|
@ -1815,7 +1808,10 @@ static int32_t mndCreateTSMA(SCreateTSMACxt *pCxt) {
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
mndCreateTSMABuildDropStreamReq(pCxt);
|
code = mndCreateTSMABuildDropStreamReq(pCxt);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != (code = mndCreateTSMATxnPrepare(pCxt))) {
|
if (TSDB_CODE_SUCCESS != (code = mndCreateTSMATxnPrepare(pCxt))) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
@ -1985,7 +1981,10 @@ static int32_t mndDropTSMA(SCreateTSMACxt* pCxt) {
|
||||||
}
|
}
|
||||||
SMDropStreamReq dropStreamReq = {0};
|
SMDropStreamReq dropStreamReq = {0};
|
||||||
pCxt->pDropStreamReq = &dropStreamReq;
|
pCxt->pDropStreamReq = &dropStreamReq;
|
||||||
mndCreateTSMABuildDropStreamReq(pCxt);
|
code = mndCreateTSMABuildDropStreamReq(pCxt);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
mndTransSetDbName(pTrans, pCxt->pDb->name, NULL);
|
mndTransSetDbName(pTrans, pCxt->pDb->name, NULL);
|
||||||
if (mndTransCheckConflict(pCxt->pMnode, pTrans) != 0) goto _OVER;
|
if (mndTransCheckConflict(pCxt->pMnode, pTrans) != 0) goto _OVER;
|
||||||
mndTransSetSerial(pTrans);
|
mndTransSetSerial(pTrans);
|
||||||
|
@ -2141,12 +2140,15 @@ static int32_t mndRetrieveTSMA(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
||||||
SMnode * pMnode = pReq->info.node;
|
SMnode * pMnode = pReq->info.node;
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SColumnInfoData *pColInfo;
|
SColumnInfoData *pColInfo;
|
||||||
if (pShow->db[0]) {
|
|
||||||
pDb = mndAcquireDb(pMnode, pShow->db);
|
|
||||||
}
|
|
||||||
if (pShow->pIter == NULL) {
|
if (pShow->pIter == NULL) {
|
||||||
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
pShow->pIter = taosMemoryCalloc(1, sizeof(SSmaAndTagIter));
|
||||||
}
|
}
|
||||||
|
if (!pShow->pIter) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
if (pShow->db[0]) {
|
||||||
|
pDb = mndAcquireDb(pMnode, pShow->db);
|
||||||
|
}
|
||||||
SSmaAndTagIter *pIter = pShow->pIter;
|
SSmaAndTagIter *pIter = pShow->pIter;
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pIter->pSmaIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter->pSmaIter, (void **)&pSma);
|
pIter->pSmaIter = sdbFetch(pMnode->pSdb, SDB_SMA, pIter->pSmaIter, (void **)&pSma);
|
||||||
|
@ -2273,7 +2275,7 @@ static int32_t mndRetrieveTSMA(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
|
||||||
mndReleaseDb(pMnode, pSrcDb);
|
mndReleaseDb(pMnode, pSrcDb);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
sdbCancelFetch(pMnode->pSdb, pIter->pSmaIter);
|
sdbCancelFetch(pMnode->pSdb, pIter->pSmaIter);
|
||||||
numOfRows = -1;
|
numOfRows = code;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2195,8 +2195,9 @@ static int32_t refreshNodeListFromExistedStreams(SMnode *pMnode, SArray *pNodeLi
|
||||||
|
|
||||||
SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId, .lastHbMsgId = -1};
|
SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId, .lastHbMsgId = -1};
|
||||||
epsetAssign(&entry.epset, &pTask->info.epSet);
|
epsetAssign(&entry.epset, &pTask->info.epSet);
|
||||||
if (taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry)) != 0) {
|
int32_t ret = taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry));
|
||||||
mError("failed to put entry into hash map, nodeId:%d", entry.nodeId);
|
if (ret != 0 && ret != TSDB_CODE_DUP_KEY) {
|
||||||
|
mError("failed to put entry into hash map, nodeId:%d, code:%s", entry.nodeId, tstrerror(code));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -628,6 +628,7 @@ static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupCha
|
||||||
code = tEncodeStreamTaskUpdateMsg(&encoder, &req);
|
code = tEncodeStreamTaskUpdateMsg(&encoder, &req);
|
||||||
if (code == -1) {
|
if (code == -1) {
|
||||||
tEncoderClear(&encoder);
|
tEncoderClear(&encoder);
|
||||||
|
taosMemoryFree(buf);
|
||||||
taosArrayDestroy(req.pNodeList);
|
taosArrayDestroy(req.pNodeList);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -648,21 +649,25 @@ static int32_t doBuildStreamTaskUpdateMsg(void **pBuf, int32_t *pLen, SVgroupCha
|
||||||
static int32_t doSetUpdateTaskAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, SVgroupChangeInfo *pInfo) {
|
static int32_t doSetUpdateTaskAction(SMnode *pMnode, STrans *pTrans, SStreamTask *pTask, SVgroupChangeInfo *pInfo) {
|
||||||
void *pBuf = NULL;
|
void *pBuf = NULL;
|
||||||
int32_t len = 0;
|
int32_t len = 0;
|
||||||
|
SEpSet epset = {0};
|
||||||
|
bool hasEpset = false;
|
||||||
|
|
||||||
bool unusedRet = streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList);
|
bool unusedRet = streamTaskUpdateEpsetInfo(pTask, pInfo->pUpdateNodeList);
|
||||||
int32_t code = doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id);
|
int32_t code = doBuildStreamTaskUpdateMsg(&pBuf, &len, pInfo, pTask->info.nodeId, &pTask->id, pTrans->id);
|
||||||
if (code) {
|
if (code) {
|
||||||
|
mError("failed to build stream task epset update msg, code:%s", tstrerror(code));
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
SEpSet epset = {0};
|
|
||||||
bool hasEpset = false;
|
|
||||||
code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
code = extractNodeEpset(pMnode, &epset, &hasEpset, pTask->id.taskId, pTask->info.nodeId);
|
||||||
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
if (code != TSDB_CODE_SUCCESS || !hasEpset) {
|
||||||
|
mError("failed to extract epset during create update epset, code:%s", tstrerror(code));
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
code = setTransAction(pTrans, pBuf, len, TDMT_VND_STREAM_TASK_UPDATE, &epset, 0, TSDB_CODE_VND_INVALID_VGROUP_ID);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
mError("failed to create update task epset trans, code:%s", tstrerror(code));
|
||||||
taosMemoryFree(pBuf);
|
taosMemoryFree(pBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,54 +68,64 @@ static void mndGetStat(SMnode* pMnode, SMnodeStat* pStat) {
|
||||||
|
|
||||||
static void mndBuildRuntimeInfo(SMnode* pMnode, SJson* pJson) {
|
static void mndBuildRuntimeInfo(SMnode* pMnode, SJson* pJson) {
|
||||||
SMnodeStat mstat = {0};
|
SMnodeStat mstat = {0};
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
mndGetStat(pMnode, &mstat);
|
mndGetStat(pMnode, &mstat);
|
||||||
|
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfDnode", mstat.numOfDnode);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfDnode", mstat.numOfDnode), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfMnode", mstat.numOfMnode);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfMnode", mstat.numOfMnode), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfVgroup", mstat.numOfVgroup);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfVgroup", mstat.numOfVgroup), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfDatabase", mstat.numOfDatabase);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfDatabase", mstat.numOfDatabase), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfSuperTable", mstat.numOfSuperTable);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfSuperTable", mstat.numOfSuperTable), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfChildTable", mstat.numOfChildTable);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfChildTable", mstat.numOfChildTable), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfColumn", mstat.numOfColumn);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfColumn", mstat.numOfColumn), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfPoint", mstat.totalPoints);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfPoint", mstat.totalPoints), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "totalStorage", mstat.totalStorage);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "totalStorage", mstat.totalStorage), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "compStorage", mstat.compStorage);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "compStorage", mstat.compStorage), &lino, _OVER);
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) mError("failed to mndBuildRuntimeInfo at line:%d since %s", lino, tstrerror(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* mndBuildTelemetryReport(SMnode* pMnode) {
|
static char* mndBuildTelemetryReport(SMnode* pMnode) {
|
||||||
char tmp[4096] = {0};
|
char tmp[4096] = {0};
|
||||||
STelemMgmt* pMgmt = &pMnode->telemMgmt;
|
STelemMgmt* pMgmt = &pMnode->telemMgmt;
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
SJson* pJson = tjsonCreateObject();
|
SJson* pJson = tjsonCreateObject();
|
||||||
if (pJson == NULL) return NULL;
|
if (pJson == NULL) return NULL;
|
||||||
|
|
||||||
char clusterName[64] = {0};
|
char clusterName[64] = {0};
|
||||||
if ((terrno = mndGetClusterName(pMnode, clusterName, sizeof(clusterName))) != 0) return NULL;
|
if ((terrno = mndGetClusterName(pMnode, clusterName, sizeof(clusterName))) != 0) return NULL;
|
||||||
(void)tjsonAddStringToObject(pJson, "instanceId", clusterName);
|
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "instanceId", clusterName), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "reportVersion", 1);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "reportVersion", 1), &lino, _OVER);
|
||||||
|
|
||||||
if (taosGetOsReleaseName(tmp, NULL, NULL, sizeof(tmp)) == 0) {
|
if (taosGetOsReleaseName(tmp, NULL, NULL, sizeof(tmp)) == 0) {
|
||||||
(void)tjsonAddStringToObject(pJson, "os", tmp);
|
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "os", tmp), &lino, _OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
float numOfCores = 0;
|
float numOfCores = 0;
|
||||||
if (taosGetCpuInfo(tmp, sizeof(tmp), &numOfCores) == 0) {
|
if (taosGetCpuInfo(tmp, sizeof(tmp), &numOfCores) == 0) {
|
||||||
(void)tjsonAddStringToObject(pJson, "cpuModel", tmp);
|
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "cpuModel", tmp), &lino, _OVER);
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfCpu", numOfCores);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfCpu", numOfCores), &lino, _OVER);
|
||||||
} else {
|
} else {
|
||||||
(void)tjsonAddDoubleToObject(pJson, "numOfCpu", tsNumOfCores);
|
TAOS_CHECK_GOTO(tjsonAddDoubleToObject(pJson, "numOfCpu", tsNumOfCores), &lino, _OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB);
|
snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB);
|
||||||
(void)tjsonAddStringToObject(pJson, "memory", tmp);
|
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "memory", tmp), &lino, _OVER);
|
||||||
|
|
||||||
(void)tjsonAddStringToObject(pJson, "version", version);
|
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "version", version), &lino, _OVER);
|
||||||
(void)tjsonAddStringToObject(pJson, "buildInfo", buildinfo);
|
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "buildInfo", buildinfo), &lino, _OVER);
|
||||||
(void)tjsonAddStringToObject(pJson, "gitInfo", gitinfo);
|
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "gitInfo", gitinfo), &lino, _OVER);
|
||||||
(void)tjsonAddStringToObject(pJson, "email", pMgmt->email);
|
TAOS_CHECK_GOTO(tjsonAddStringToObject(pJson, "email", pMgmt->email), &lino, _OVER);
|
||||||
|
|
||||||
mndBuildRuntimeInfo(pMnode, pJson);
|
mndBuildRuntimeInfo(pMnode, pJson);
|
||||||
|
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) {
|
||||||
|
mError("failed to build telemetry report at lino:%d, since %s", lino, tstrerror(code));
|
||||||
|
}
|
||||||
char* pCont = tjsonToString(pJson);
|
char* pCont = tjsonToString(pJson);
|
||||||
tjsonDelete(pJson);
|
tjsonDelete(pJson);
|
||||||
return pCont;
|
return pCont;
|
||||||
|
|
|
@ -795,7 +795,7 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
|
||||||
mError("trans:%d, failed to encode while sync trans since %s", pTrans->id, tstrerror(code));
|
mError("trans:%d, failed to encode while sync trans since %s", pTrans->id, tstrerror(code));
|
||||||
TAOS_RETURN(code);
|
TAOS_RETURN(code);
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_READY);
|
TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_READY));
|
||||||
|
|
||||||
mInfo("trans:%d, sync to other mnodes, stage:%s createTime:%" PRId64, pTrans->id, mndTransStr(pTrans->stage),
|
mInfo("trans:%d, sync to other mnodes, stage:%s createTime:%" PRId64, pTrans->id, mndTransStr(pTrans->stage),
|
||||||
pTrans->createdTime);
|
pTrans->createdTime);
|
||||||
|
@ -1778,7 +1778,7 @@ static bool mndTransPerformFinishStage(SMnode *pMnode, STrans *pTrans, bool topH
|
||||||
mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr());
|
mError("trans:%d, failed to encode while finish trans since %s", pTrans->id, terrstr());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
(void)sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED);
|
TAOS_CHECK_RETURN(sdbSetRawStatus(pRaw, SDB_STATUS_DROPPED));
|
||||||
|
|
||||||
int32_t code = sdbWrite(pMnode->pSdb, pRaw);
|
int32_t code = sdbWrite(pMnode->pSdb, pRaw);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
@ -1943,6 +1943,8 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
STrans *pTrans = NULL;
|
STrans *pTrans = NULL;
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t lino = 0;
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = sdbFetch(pSdb, SDB_TRANS, pShow->pIter, (void **)&pTrans);
|
pShow->pIter = sdbFetch(pSdb, SDB_TRANS, pShow->pIter, (void **)&pTrans);
|
||||||
|
@ -1951,36 +1953,39 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
||||||
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->id, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->id, false), pTrans, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->createdTime, false), pTrans, &lino,
|
||||||
|
_OVER);
|
||||||
|
|
||||||
char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0};
|
char stage[TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(stage, mndTransStr(pTrans->stage), pShow->pMeta->pSchemas[cols].bytes);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stage, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)stage, false), pTrans, &lino, _OVER);
|
||||||
|
|
||||||
char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0};
|
char opername[TSDB_TRANS_OPER_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(opername, pTrans->opername, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)opername, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)opername, false), pTrans, &lino, _OVER);
|
||||||
|
|
||||||
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char dbname[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(dbname, mndGetDbStr(pTrans->dbname), pShow->pMeta->pSchemas[cols].bytes);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)dbname, false), pTrans, &lino, _OVER);
|
||||||
|
|
||||||
char stbname[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
char stbname[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(stbname, mndGetDbStr(pTrans->stbname), pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(stbname, mndGetDbStr(pTrans->stbname), pShow->pMeta->pSchemas[cols].bytes);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)stbname, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)stbname, false), pTrans, &lino, _OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->failedTimes, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->failedTimes, false), pTrans, &lino,
|
||||||
|
_OVER);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)&pTrans->lastExecTime, false), pTrans, &lino,
|
||||||
|
_OVER);
|
||||||
|
|
||||||
char lastInfo[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0};
|
char lastInfo[TSDB_TRANS_ERROR_LEN + VARSTR_HEADER_SIZE] = {0};
|
||||||
char detail[TSDB_TRANS_ERROR_LEN + 1] = {0};
|
char detail[TSDB_TRANS_ERROR_LEN + 1] = {0};
|
||||||
|
@ -1996,12 +2001,14 @@ static int32_t mndRetrieveTrans(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
|
||||||
}
|
}
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(lastInfo, detail, pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(lastInfo, detail, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
(void)colDataSetVal(pColInfo, numOfRows, (const char *)lastInfo, false);
|
RETRIEVE_CHECK_GOTO(colDataSetVal(pColInfo, numOfRows, (const char *)lastInfo, false), pTrans, &lino, _OVER);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pTrans);
|
sdbRelease(pSdb, pTrans);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_OVER:
|
||||||
|
if (code != 0) mError("failed to retrieve at line:%d, since %s", lino, tstrerror(code));
|
||||||
pShow->numOfRows += numOfRows;
|
pShow->numOfRows += numOfRows;
|
||||||
return numOfRows;
|
return numOfRows;
|
||||||
}
|
}
|
||||||
|
|
|
@ -286,7 +286,7 @@ int32_t metaCacheUpsert(SMeta* pMeta, SMetaInfo* pInfo) {
|
||||||
|
|
||||||
SMetaCacheEntry* pEntryNew = (SMetaCacheEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
SMetaCacheEntry* pEntryNew = (SMetaCacheEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
||||||
if (pEntryNew == NULL) {
|
if (pEntryNew == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ int32_t metaStatsCacheUpsert(SMeta* pMeta, SMetaStbStats* pInfo) {
|
||||||
|
|
||||||
SMetaStbStatsEntry* pEntryNew = (SMetaStbStatsEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
SMetaStbStatsEntry* pEntryNew = (SMetaStbStatsEntry*)taosMemoryMalloc(sizeof(*pEntryNew));
|
||||||
if (pEntryNew == NULL) {
|
if (pEntryNew == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ static int checkAllEntriesInCache(const STagFilterResEntry* pEntry, SArray* pInv
|
||||||
LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len);
|
LRUHandle* pRes = taosLRUCacheLookup(pCache, buf, len);
|
||||||
if (pRes == NULL) { // remove the item in the linked list
|
if (pRes == NULL) { // remove the item in the linked list
|
||||||
if (taosArrayPush(pInvalidRes, &pNode) == NULL) {
|
if (taosArrayPush(pInvalidRes, &pNode) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(void)taosLRUCacheRelease(pCache, pRes, false);
|
(void)taosLRUCacheRelease(pCache, pRes, false);
|
||||||
|
@ -612,7 +612,7 @@ static void freeUidCachePayload(const void* key, size_t keyLen, void* value, voi
|
||||||
static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyLen, uint64_t suid) {
|
static int32_t addNewEntry(SHashObj* pTableEntry, const void* pKey, int32_t keyLen, uint64_t suid) {
|
||||||
STagFilterResEntry* p = taosMemoryMalloc(sizeof(STagFilterResEntry));
|
STagFilterResEntry* p = taosMemoryMalloc(sizeof(STagFilterResEntry));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->hitTimes = 0;
|
p->hitTimes = 0;
|
||||||
|
|
|
@ -39,7 +39,7 @@ int meteDecodeColCmprEntry(SDecoder *pDecoder, SMetaEntry *pME) {
|
||||||
uDebug("dencode cols:%d", pWrapper->nCols);
|
uDebug("dencode cols:%d", pWrapper->nCols);
|
||||||
pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
|
pWrapper->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pWrapper->nCols * sizeof(SColCmpr));
|
||||||
if (pWrapper->pColCmpr == NULL) {
|
if (pWrapper->pColCmpr == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < pWrapper->nCols; i++) {
|
for (int i = 0; i < pWrapper->nCols; i++) {
|
||||||
|
@ -53,7 +53,7 @@ static FORCE_INLINE int32_t metatInitDefaultSColCmprWrapper(SDecoder *pDecoder,
|
||||||
SSchemaWrapper *pSchema) {
|
SSchemaWrapper *pSchema) {
|
||||||
pCmpr->nCols = pSchema->nCols;
|
pCmpr->nCols = pSchema->nCols;
|
||||||
if ((pCmpr->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pCmpr->nCols * sizeof(SColCmpr))) == NULL) {
|
if ((pCmpr->pColCmpr = (SColCmpr *)tDecoderMalloc(pDecoder, pCmpr->nCols * sizeof(SColCmpr))) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pCmpr->nCols; i++) {
|
for (int32_t i = 0; i < pCmpr->nCols; i++) {
|
||||||
|
@ -149,7 +149,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
|
||||||
} else if (pME->type == TSDB_TSMA_TABLE) {
|
} else if (pME->type == TSDB_TSMA_TABLE) {
|
||||||
pME->smaEntry.tsma = tDecoderMalloc(pCoder, sizeof(STSma));
|
pME->smaEntry.tsma = tDecoderMalloc(pCoder, sizeof(STSma));
|
||||||
if (!pME->smaEntry.tsma) {
|
if (!pME->smaEntry.tsma) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pME->smaEntry.tsma, true));
|
TAOS_CHECK_RETURN(tDecodeTSma(pCoder, pME->smaEntry.tsma, true));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -27,15 +27,15 @@ static int taskIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int k
|
||||||
static int btimeIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
|
static int btimeIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
|
||||||
static int ncolIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
|
static int ncolIdxCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
|
||||||
|
|
||||||
static int32_t metaInitLock(SMeta *pMeta) {
|
static void metaInitLock(SMeta *pMeta) {
|
||||||
TdThreadRwlockAttr attr;
|
TdThreadRwlockAttr attr;
|
||||||
(void)taosThreadRwlockAttrInit(&attr);
|
(void)taosThreadRwlockAttrInit(&attr);
|
||||||
(void)taosThreadRwlockAttrSetKindNP(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
(void)taosThreadRwlockAttrSetKindNP(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
|
||||||
(void)taosThreadRwlockInit(&pMeta->lock, &attr);
|
(void)taosThreadRwlockInit(&pMeta->lock, &attr);
|
||||||
(void)taosThreadRwlockAttrDestroy(&attr);
|
(void)taosThreadRwlockAttrDestroy(&attr);
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); }
|
static void metaDestroyLock(SMeta *pMeta) { (void)taosThreadRwlockDestroy(&pMeta->lock); }
|
||||||
|
|
||||||
static void metaCleanup(SMeta **ppMeta);
|
static void metaCleanup(SMeta **ppMeta);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ int32_t metaOpen(SVnode *pVnode, SMeta **ppMeta, int8_t rollback) {
|
||||||
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)metaInitLock(pMeta);
|
metaInitLock(pMeta);
|
||||||
|
|
||||||
pMeta->path = (char *)&pMeta[1];
|
pMeta->path = (char *)&pMeta[1];
|
||||||
strcpy(pMeta->path, path);
|
strcpy(pMeta->path, path);
|
||||||
|
@ -188,17 +188,23 @@ int metaAlterCache(SMeta *pMeta, int32_t nPage) {
|
||||||
|
|
||||||
void metaRLock(SMeta *pMeta) {
|
void metaRLock(SMeta *pMeta) {
|
||||||
metaTrace("meta rlock %p", &pMeta->lock);
|
metaTrace("meta rlock %p", &pMeta->lock);
|
||||||
(void)taosThreadRwlockRdlock(&pMeta->lock);
|
if (taosThreadRwlockRdlock(&pMeta->lock) != 0) {
|
||||||
|
metaError("vgId:%d failed to lock %p", TD_VID(pMeta->pVnode), &pMeta->lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void metaWLock(SMeta *pMeta) {
|
void metaWLock(SMeta *pMeta) {
|
||||||
metaTrace("meta wlock %p", &pMeta->lock);
|
metaTrace("meta wlock %p", &pMeta->lock);
|
||||||
(void)taosThreadRwlockWrlock(&pMeta->lock);
|
if (taosThreadRwlockWrlock(&pMeta->lock) != 0) {
|
||||||
|
metaError("vgId:%d failed to lock %p", TD_VID(pMeta->pVnode), &pMeta->lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void metaULock(SMeta *pMeta) {
|
void metaULock(SMeta *pMeta) {
|
||||||
metaTrace("meta ulock %p", &pMeta->lock);
|
metaTrace("meta ulock %p", &pMeta->lock);
|
||||||
(void)taosThreadRwlockUnlock(&pMeta->lock);
|
if (taosThreadRwlockUnlock(&pMeta->lock) != 0) {
|
||||||
|
metaError("vgId:%d failed to unlock %p", TD_VID(pMeta->pVnode), &pMeta->lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void metaCleanup(SMeta **ppMeta) {
|
static void metaCleanup(SMeta **ppMeta) {
|
||||||
|
@ -223,7 +229,7 @@ static void metaCleanup(SMeta **ppMeta) {
|
||||||
if (pMeta->pSkmDb) tdbTbClose(pMeta->pSkmDb);
|
if (pMeta->pSkmDb) tdbTbClose(pMeta->pSkmDb);
|
||||||
if (pMeta->pTbDb) tdbTbClose(pMeta->pTbDb);
|
if (pMeta->pTbDb) tdbTbClose(pMeta->pTbDb);
|
||||||
if (pMeta->pEnv) tdbClose(pMeta->pEnv);
|
if (pMeta->pEnv) tdbClose(pMeta->pEnv);
|
||||||
(void)metaDestroyLock(pMeta);
|
metaDestroyLock(pMeta);
|
||||||
|
|
||||||
taosMemoryFreeClear(*ppMeta);
|
taosMemoryFreeClear(*ppMeta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,11 @@ int32_t metaTbCursorPrev(SMTbCursor *pTbCur, ETableType jumpTableType) {
|
||||||
|
|
||||||
tDecoderClear(&pTbCur->mr.coder);
|
tDecoderClear(&pTbCur->mr.coder);
|
||||||
|
|
||||||
(void)metaGetTableEntryByVersion(&pTbCur->mr, ((SUidIdxVal *)pTbCur->pVal)[0].version, *(tb_uid_t *)pTbCur->pKey);
|
ret = metaGetTableEntryByVersion(&pTbCur->mr, ((SUidIdxVal *)pTbCur->pVal)[0].version, *(tb_uid_t *)pTbCur->pKey);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (pTbCur->mr.me.type == jumpTableType) {
|
if (pTbCur->mr.me.type == jumpTableType) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -387,7 +391,10 @@ _query:
|
||||||
|
|
||||||
SMetaEntry me = {0};
|
SMetaEntry me = {0};
|
||||||
tDecoderInit(&dc, pData, nData);
|
tDecoderInit(&dc, pData, nData);
|
||||||
(void)metaDecodeEntry(&dc, &me);
|
int32_t code = metaDecodeEntry(&dc, &me);
|
||||||
|
if (code) {
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
if (me.type == TSDB_SUPER_TABLE) {
|
if (me.type == TSDB_SUPER_TABLE) {
|
||||||
if (sver == -1 || sver == me.stbEntry.schemaRow.version) {
|
if (sver == -1 || sver == me.stbEntry.schemaRow.version) {
|
||||||
pSchema = tCloneSSchemaWrapper(&me.stbEntry.schemaRow);
|
pSchema = tCloneSSchemaWrapper(&me.stbEntry.schemaRow);
|
||||||
|
@ -502,17 +509,17 @@ int32_t metaResumeCtbCursor(SMCtbCursor *pCtbCur, int8_t first) {
|
||||||
ctbIdxKey.suid = pCtbCur->suid;
|
ctbIdxKey.suid = pCtbCur->suid;
|
||||||
ctbIdxKey.uid = INT64_MIN;
|
ctbIdxKey.uid = INT64_MIN;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
(void)tdbTbcMoveTo(pCtbCur->pCur, &ctbIdxKey, sizeof(ctbIdxKey), &c);
|
ret = tdbTbcMoveTo(pCtbCur->pCur, &ctbIdxKey, sizeof(ctbIdxKey), &c);
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
(void)tdbTbcMoveToNext(pCtbCur->pCur);
|
ret = tdbTbcMoveToNext(pCtbCur->pCur);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int c = 0;
|
int c = 0;
|
||||||
ret = tdbTbcMoveTo(pCtbCur->pCur, pCtbCur->pKey, pCtbCur->kLen, &c);
|
ret = tdbTbcMoveTo(pCtbCur->pCur, pCtbCur->pKey, pCtbCur->kLen, &c);
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
(void)tdbTbcMoveToPrev(pCtbCur->pCur);
|
ret = tdbTbcMoveToPrev(pCtbCur->pCur);
|
||||||
} else {
|
} else {
|
||||||
(void)tdbTbcMoveToNext(pCtbCur->pCur);
|
ret = tdbTbcMoveToNext(pCtbCur->pCur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,9 +577,9 @@ SMStbCursor *metaOpenStbCursor(SMeta *pMeta, tb_uid_t suid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// move to the suid
|
// move to the suid
|
||||||
(void)tdbTbcMoveTo(pStbCur->pCur, &suid, sizeof(suid), &c);
|
ret = tdbTbcMoveTo(pStbCur->pCur, &suid, sizeof(suid), &c);
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
(void)tdbTbcMoveToNext(pStbCur->pCur);
|
ret = tdbTbcMoveToNext(pStbCur->pCur);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pStbCur;
|
return pStbCur;
|
||||||
|
@ -670,12 +677,12 @@ int32_t metaGetTbTSchemaEx(SMeta *pMeta, tb_uid_t suid, tb_uid_t uid, int32_t sv
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
(void)tdbTbcMoveToPrev(pSkmDbC);
|
int32_t ret = tdbTbcMoveToPrev(pSkmDbC);
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *pKey = NULL;
|
const void *pKey = NULL;
|
||||||
int32_t nKey = 0;
|
int32_t nKey = 0;
|
||||||
(void)tdbTbcGet(pSkmDbC, &pKey, &nKey, NULL, NULL);
|
int32_t ret = tdbTbcGet(pSkmDbC, &pKey, &nKey, NULL, NULL);
|
||||||
|
|
||||||
if (((SSkmDbKey *)pKey)->uid != skmDbKey.uid) {
|
if (((SSkmDbKey *)pKey)->uid != skmDbKey.uid) {
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
@ -805,9 +812,9 @@ SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid) {
|
||||||
// move to the suid
|
// move to the suid
|
||||||
smaIdxKey.uid = uid;
|
smaIdxKey.uid = uid;
|
||||||
smaIdxKey.smaUid = INT64_MIN;
|
smaIdxKey.smaUid = INT64_MIN;
|
||||||
(void)tdbTbcMoveTo(pSmaCur->pCur, &smaIdxKey, sizeof(smaIdxKey), &c);
|
ret = tdbTbcMoveTo(pSmaCur->pCur, &smaIdxKey, sizeof(smaIdxKey), &c);
|
||||||
if (c > 0) {
|
if (c > 0) {
|
||||||
(void)tdbTbcMoveToNext(pSmaCur->pCur);
|
ret = tdbTbcMoveToNext(pSmaCur->pCur);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pSmaCur;
|
return pSmaCur;
|
||||||
|
@ -916,7 +923,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
|
||||||
_err:
|
_err:
|
||||||
metaReaderClear(&mr);
|
metaReaderClear(&mr);
|
||||||
taosArrayDestroy(pSmaIds);
|
taosArrayDestroy(pSmaIds);
|
||||||
(void)tFreeTSmaWrapper(pSW, deepCopy);
|
pSW = tFreeTSmaWrapper(pSW, deepCopy);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1453,7 +1460,7 @@ int32_t metaGetTableTagsByUids(void *pVnode, int64_t suid, SArray *uidList) {
|
||||||
if (!p->pTagVal) {
|
if (!p->pTagVal) {
|
||||||
if (isLock) metaULock(pMeta);
|
if (isLock) metaULock(pMeta);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
memcpy(p->pTagVal, val, len);
|
memcpy(p->pTagVal, val, len);
|
||||||
tdbFree(val);
|
tdbFree(val);
|
||||||
|
@ -1504,13 +1511,13 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
||||||
if (!info.pTagVal) {
|
if (!info.pTagVal) {
|
||||||
metaCloseCtbCursor(pCur);
|
metaCloseCtbCursor(pCur);
|
||||||
taosHashCleanup(pSepecifiedUidMap);
|
taosHashCleanup(pSepecifiedUidMap);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(info.pTagVal, pCur->pVal, pCur->vLen);
|
memcpy(info.pTagVal, pCur->pVal, pCur->vLen);
|
||||||
if (taosArrayPush(pUidTagInfo, &info) == NULL) {
|
if (taosArrayPush(pUidTagInfo, &info) == NULL) {
|
||||||
metaCloseCtbCursor(pCur);
|
metaCloseCtbCursor(pCur);
|
||||||
taosHashCleanup(pSepecifiedUidMap);
|
taosHashCleanup(pSepecifiedUidMap);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // only the specified tables need to be added
|
} else { // only the specified tables need to be added
|
||||||
|
@ -1531,7 +1538,7 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *pUidTagInfo) {
|
||||||
if (!pTagInfo->pTagVal) {
|
if (!pTagInfo->pTagVal) {
|
||||||
metaCloseCtbCursor(pCur);
|
metaCloseCtbCursor(pCur);
|
||||||
taosHashCleanup(pSepecifiedUidMap);
|
taosHashCleanup(pSepecifiedUidMap);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(pTagInfo->pTagVal, pCur->pVal, pCur->vLen);
|
memcpy(pTagInfo->pTagVal, pCur->pVal, pCur->vLen);
|
||||||
}
|
}
|
||||||
|
@ -1583,7 +1590,10 @@ int32_t metaGetInfo(SMeta *pMeta, int64_t uid, SMetaInfo *pInfo, SMetaReader *pR
|
||||||
}
|
}
|
||||||
// upsert the cache
|
// upsert the cache
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
(void)metaCacheUpsert(pMeta, pInfo);
|
int32_t ret = metaCacheUpsert(pMeta, pInfo);
|
||||||
|
if (ret != 0) {
|
||||||
|
metaError("vgId:%d, failed to upsert cache, uid:%" PRId64, TD_VID(pMeta->pVnode), uid);
|
||||||
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
if (lock) {
|
if (lock) {
|
||||||
|
@ -1633,7 +1643,12 @@ int32_t metaGetStbStats(void *pVnode, int64_t uid, int64_t *numOfTables, int32_t
|
||||||
|
|
||||||
// upsert the cache
|
// upsert the cache
|
||||||
metaWLock(pVnodeObj->pMeta);
|
metaWLock(pVnodeObj->pMeta);
|
||||||
(void)metaStatsCacheUpsert(pVnodeObj->pMeta, &state);
|
|
||||||
|
int32_t ret = metaStatsCacheUpsert(pVnodeObj->pMeta, &state);
|
||||||
|
if (ret) {
|
||||||
|
metaError("failed to upsert stats, uid:%" PRId64 ", ctbNum:%" PRId64 ", colNum:%d", uid, ctbNum, colNum);
|
||||||
|
}
|
||||||
|
|
||||||
metaULock(pVnodeObj->pMeta);
|
metaULock(pVnodeObj->pMeta);
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
@ -1646,6 +1661,10 @@ void metaUpdateStbStats(SMeta *pMeta, int64_t uid, int64_t deltaCtb, int32_t del
|
||||||
if (metaStatsCacheGet(pMeta, uid, &stats) == TSDB_CODE_SUCCESS) {
|
if (metaStatsCacheGet(pMeta, uid, &stats) == TSDB_CODE_SUCCESS) {
|
||||||
stats.ctbNum += deltaCtb;
|
stats.ctbNum += deltaCtb;
|
||||||
stats.colNum += deltaCol;
|
stats.colNum += deltaCol;
|
||||||
(void)metaStatsCacheUpsert(pMeta, &stats);
|
int32_t code = metaStatsCacheUpsert(pMeta, &stats);
|
||||||
|
if (code) {
|
||||||
|
metaError("vgId:%d, failed to update stats, uid:%" PRId64 ", ctbNum:%" PRId64 ", colNum:%d",
|
||||||
|
TD_VID(pMeta->pVnode), uid, deltaCtb, deltaCol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ static int metaSaveSmaToDB(SMeta *pMeta, const SMetaEntry *pME) {
|
||||||
|
|
||||||
pVal = taosMemoryMalloc(vLen);
|
pVal = taosMemoryMalloc(vLen);
|
||||||
if (pVal == NULL) {
|
if (pVal == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ int32_t metaSnapRead(SMetaSnapReader* pReader, uint8_t** ppData) {
|
||||||
|
|
||||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData);
|
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + nData);
|
||||||
if (*ppData == NULL) {
|
if (*ppData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ static int32_t saveSuperTableInfoForChildTable(SMetaEntry* me, SHashObj* suidInf
|
||||||
STableInfoForChildTable dataTmp = {0};
|
STableInfoForChildTable dataTmp = {0};
|
||||||
dataTmp.tableName = taosStrdup(me->name);
|
dataTmp.tableName = taosStrdup(me->name);
|
||||||
if (dataTmp.tableName == NULL) {
|
if (dataTmp.tableName == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
dataTmp.schemaRow = tCloneSSchemaWrapper(&me->stbEntry.schemaRow);
|
dataTmp.schemaRow = tCloneSSchemaWrapper(&me->stbEntry.schemaRow);
|
||||||
|
|
|
@ -151,7 +151,7 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
||||||
if (pTagVal->nData > 0) {
|
if (pTagVal->nData > 0) {
|
||||||
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||||
}
|
}
|
||||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
|
@ -175,7 +175,11 @@ static int metaSaveJsonVarToIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (term != NULL) {
|
if (term != NULL) {
|
||||||
(void)indexMultiTermAdd(terms, term);
|
int32_t ret = indexMultiTermAdd(terms, term);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to add term to multi term, uid: %" PRId64 ", key: %s, type: %d, ret: %d",
|
||||||
|
TD_VID(pMeta->pVnode), tuid, key, type, ret);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
code = terrno;
|
code = terrno;
|
||||||
goto _exception;
|
goto _exception;
|
||||||
|
@ -213,7 +217,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
||||||
|
|
||||||
SIndexMultiTerm *terms = indexMultiTermCreate();
|
SIndexMultiTerm *terms = indexMultiTermCreate();
|
||||||
if (terms == NULL) {
|
if (terms == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t nCols = taosArrayGetSize(pTagVals);
|
int16_t nCols = taosArrayGetSize(pTagVals);
|
||||||
|
@ -231,7 +235,7 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
||||||
if (pTagVal->nData > 0) {
|
if (pTagVal->nData > 0) {
|
||||||
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
char *val = taosMemoryCalloc(1, pTagVal->nData + VARSTR_HEADER_SIZE);
|
||||||
if (val == NULL) {
|
if (val == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _exception);
|
TAOS_CHECK_GOTO(terrno, NULL, _exception);
|
||||||
}
|
}
|
||||||
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
int32_t len = taosUcs4ToMbs((TdUcs4 *)pTagVal->pData, pTagVal->nData, val + VARSTR_HEADER_SIZE);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
|
@ -254,7 +258,11 @@ int metaDelJsonVarFromIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry, const SSche
|
||||||
term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len);
|
term = indexTermCreate(suid, DEL_VALUE, TSDB_DATA_TYPE_BOOL, key, nKey, (const char *)&val, len);
|
||||||
}
|
}
|
||||||
if (term != NULL) {
|
if (term != NULL) {
|
||||||
(void)indexMultiTermAdd(terms, term);
|
int32_t ret = indexMultiTermAdd(terms, term);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to add term to multi term, uid: %" PRId64 ", key: %s, type: %d, ret: %d",
|
||||||
|
TD_VID(pMeta->pVnode), tuid, key, type, ret);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
code = terrno;
|
code = terrno;
|
||||||
goto _exception;
|
goto _exception;
|
||||||
|
@ -351,6 +359,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
||||||
int c = 0;
|
int c = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int32_t lino;
|
int32_t lino;
|
||||||
|
int32_t ret;
|
||||||
|
|
||||||
// check if super table exists
|
// check if super table exists
|
||||||
rc = tdbTbGet(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, &pData, &nData);
|
rc = tdbTbGet(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, &pData, &nData);
|
||||||
|
@ -393,25 +402,56 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq, SArray *tb
|
||||||
|
|
||||||
tdbTbcClose(pCtbIdxc);
|
tdbTbcClose(pCtbIdxc);
|
||||||
|
|
||||||
(void)tsdbCacheDropSubTables(pMeta->pVnode->pTsdb, tbUidList, pReq->suid);
|
ret = tsdbCacheDropSubTables(pMeta->pVnode->pTsdb, tbUidList, pReq->suid);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to drop stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name, pReq->suid,
|
||||||
|
tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
|
|
||||||
for (int32_t iChild = 0; iChild < taosArrayGetSize(tbUidList); iChild++) {
|
for (int32_t iChild = 0; iChild < taosArrayGetSize(tbUidList); iChild++) {
|
||||||
tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUidList, iChild);
|
tb_uid_t uid = *(tb_uid_t *)taosArrayGet(tbUidList, iChild);
|
||||||
(void)metaDropTableByUid(pMeta, uid, NULL, NULL, NULL);
|
ret = metaDropTableByUid(pMeta, uid, NULL, NULL, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to drop stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(terrno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop super table
|
// drop super table
|
||||||
_drop_super_table:
|
_drop_super_table:
|
||||||
tdbTbGet(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pData, &nData);
|
tdbTbGet(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), &pData, &nData);
|
||||||
(void)tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = ((SUidIdxVal *)pData)[0].version, .uid = pReq->suid},
|
ret = tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = ((SUidIdxVal *)pData)[0].version, .uid = pReq->suid},
|
||||||
sizeof(STbDbKey), pMeta->txn);
|
sizeof(STbDbKey), pMeta->txn);
|
||||||
(void)tdbTbDelete(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, pMeta->txn);
|
if (ret < 0) {
|
||||||
(void)tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
metaError("vgId:%d, failed to drop stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name, pReq->suid,
|
||||||
(void)tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
(void)metaStatsCacheDrop(pMeta, pReq->suid);
|
ret = tdbTbDelete(pMeta->pNameIdx, pReq->name, strlen(pReq->name) + 1, pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to drop stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name, pReq->suid,
|
||||||
|
tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = tdbTbDelete(pMeta->pUidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to drop stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name, pReq->suid,
|
||||||
|
tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = tdbTbDelete(pMeta->pSuidIdx, &pReq->suid, sizeof(tb_uid_t), pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to drop stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name, pReq->suid,
|
||||||
|
tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = metaStatsCacheDrop(pMeta, pReq->suid);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to drop stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name, pReq->suid,
|
||||||
|
tstrerror(terrno));
|
||||||
|
}
|
||||||
|
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
|
@ -519,7 +559,14 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
}
|
}
|
||||||
memcpy(oStbEntry.pBuf, pData, nData);
|
memcpy(oStbEntry.pBuf, pData, nData);
|
||||||
tDecoderInit(&dc, oStbEntry.pBuf, nData);
|
tDecoderInit(&dc, oStbEntry.pBuf, nData);
|
||||||
(void)metaDecodeEntry(&dc, &oStbEntry);
|
ret = metaDecodeEntry(&dc, &oStbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to decode stb:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(ret));
|
||||||
|
tdbTbcClose(pTbDbc);
|
||||||
|
tdbTbcClose(pUidIdxc);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
|
|
||||||
nStbEntry.version = version;
|
nStbEntry.version = version;
|
||||||
nStbEntry.type = TSDB_SUPER_TABLE;
|
nStbEntry.type = TSDB_SUPER_TABLE;
|
||||||
|
@ -550,7 +597,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
int8_t col_type = pReq->schemaRow.pSchema[nCols - 1].type;
|
int8_t col_type = pReq->schemaRow.pSchema[nCols - 1].type;
|
||||||
|
|
||||||
TAOS_CHECK_RETURN(metaGetSubtables(pMeta, pReq->suid, uids));
|
TAOS_CHECK_RETURN(metaGetSubtables(pMeta, pReq->suid, uids));
|
||||||
(void)tsdbCacheNewSTableColumn(pTsdb, uids, cid, col_type);
|
TAOS_CHECK_RETURN(tsdbCacheNewSTableColumn(pTsdb, uids, cid, col_type));
|
||||||
} else if (deltaCol == -1) {
|
} else if (deltaCol == -1) {
|
||||||
int16_t cid = -1;
|
int16_t cid = -1;
|
||||||
bool hasPrimaryKey = false;
|
bool hasPrimaryKey = false;
|
||||||
|
@ -566,7 +613,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
|
|
||||||
if (cid != -1) {
|
if (cid != -1) {
|
||||||
TAOS_CHECK_RETURN(metaGetSubtables(pMeta, pReq->suid, uids));
|
TAOS_CHECK_RETURN(metaGetSubtables(pMeta, pReq->suid, uids));
|
||||||
(void)tsdbCacheDropSTableColumn(pTsdb, uids, cid, hasPrimaryKey);
|
TAOS_CHECK_RETURN(tsdbCacheDropSTableColumn(pTsdb, uids, cid, hasPrimaryKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uids) taosArrayDestroy(uids);
|
if (uids) taosArrayDestroy(uids);
|
||||||
|
@ -575,25 +622,41 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
// compare two entry
|
// compare two entry
|
||||||
if (oStbEntry.stbEntry.schemaRow.version != pReq->schemaRow.version) {
|
if (oStbEntry.stbEntry.schemaRow.version != pReq->schemaRow.version) {
|
||||||
(void)metaSaveToSkmDb(pMeta, &nStbEntry);
|
ret = metaSaveToSkmDb(pMeta, &nStbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to save skm db:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(ret));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update table.db
|
// update table.db
|
||||||
(void)metaSaveToTbDb(pMeta, &nStbEntry);
|
ret = metaSaveToTbDb(pMeta, &nStbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to save tb db:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(ret));
|
||||||
|
}
|
||||||
|
|
||||||
// update uid index
|
// update uid index
|
||||||
(void)metaUpdateUidIdx(pMeta, &nStbEntry);
|
ret = metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to update uid idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(ret));
|
||||||
|
}
|
||||||
|
|
||||||
// metaStatsCacheDrop(pMeta, nStbEntry.uid);
|
// metaStatsCacheDrop(pMeta, nStbEntry.uid);
|
||||||
|
|
||||||
if (updStat) {
|
if (updStat) {
|
||||||
(void)metaUpdateStbStats(pMeta, pReq->suid, 0, deltaCol);
|
metaUpdateStbStats(pMeta, pReq->suid, 0, deltaCol);
|
||||||
}
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
if (updStat) {
|
if (updStat) {
|
||||||
int64_t ctbNum;
|
int64_t ctbNum;
|
||||||
(void)metaGetStbStats(pMeta->pVnode, pReq->suid, &ctbNum, NULL);
|
ret = metaGetStbStats(pMeta->pVnode, pReq->suid, &ctbNum, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to get stb stats:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(ret));
|
||||||
|
}
|
||||||
pMeta->pVnode->config.vndStats.numOfTimeSeries += (ctbNum * deltaCol);
|
pMeta->pVnode->config.vndStats.numOfTimeSeries += (ctbNum * deltaCol);
|
||||||
metaTimeSeriesNotifyCheck(pMeta);
|
metaTimeSeriesNotifyCheck(pMeta);
|
||||||
}
|
}
|
||||||
|
@ -745,7 +808,11 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
(void)tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
ret = tdbTbUpsert(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, NULL, 0, pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to upsert tag idx key:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(ret));
|
||||||
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
metaDestroyTagIdxKey(pTagIdxKey);
|
metaDestroyTagIdxKey(pTagIdxKey);
|
||||||
|
@ -762,9 +829,17 @@ int metaAddIndexToSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
|
||||||
|
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
// update table.db
|
// update table.db
|
||||||
(void)metaSaveToTbDb(pMeta, &nStbEntry);
|
ret = metaSaveToTbDb(pMeta, &nStbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to save tb db:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(ret));
|
||||||
|
}
|
||||||
// update uid index
|
// update uid index
|
||||||
(void)metaUpdateUidIdx(pMeta, &nStbEntry);
|
ret = metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to update uid idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->suid, tstrerror(ret));
|
||||||
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
|
if (oStbEntry.pBuf) taosMemoryFree(oStbEntry.pBuf);
|
||||||
|
@ -896,7 +971,11 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
||||||
}
|
}
|
||||||
|
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
(void)tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
ret = tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to delete tag idx key:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->stb,
|
||||||
|
pReq->stbUid, tstrerror(ret));
|
||||||
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
metaDestroyTagIdxKey(pTagIdxKey);
|
metaDestroyTagIdxKey(pTagIdxKey);
|
||||||
pTagIdxKey = NULL;
|
pTagIdxKey = NULL;
|
||||||
|
@ -932,9 +1011,17 @@ int metaDropIndexFromSTable(SMeta *pMeta, int64_t version, SDropIndexReq *pReq)
|
||||||
|
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
// update table.db
|
// update table.db
|
||||||
(void)metaSaveToTbDb(pMeta, &nStbEntry);
|
ret = metaSaveToTbDb(pMeta, &nStbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to save tb db:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->stb,
|
||||||
|
pReq->stbUid, tstrerror(ret));
|
||||||
|
}
|
||||||
// update uid index
|
// update uid index
|
||||||
(void)metaUpdateUidIdx(pMeta, &nStbEntry);
|
ret = metaUpdateUidIdx(pMeta, &nStbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to update uid idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->stb,
|
||||||
|
pReq->stbUid, tstrerror(ret));
|
||||||
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
tDeleteSchemaWrapper(tag);
|
tDeleteSchemaWrapper(tag);
|
||||||
|
@ -958,6 +1045,7 @@ _err:
|
||||||
int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRsp **pMetaRsp) {
|
int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRsp **pMetaRsp) {
|
||||||
SMetaEntry me = {0};
|
SMetaEntry me = {0};
|
||||||
SMetaReader mr = {0};
|
SMetaReader mr = {0};
|
||||||
|
int32_t ret;
|
||||||
|
|
||||||
// validate message
|
// validate message
|
||||||
if (pReq->type != TSDB_CHILD_TABLE && pReq->type != TSDB_NORMAL_TABLE) {
|
if (pReq->type != TSDB_CHILD_TABLE && pReq->type != TSDB_NORMAL_TABLE) {
|
||||||
|
@ -1033,18 +1121,34 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
|
||||||
|
|
||||||
if (!sysTbl) {
|
if (!sysTbl) {
|
||||||
int32_t nCols = 0;
|
int32_t nCols = 0;
|
||||||
(void)metaGetStbStats(pMeta->pVnode, me.ctbEntry.suid, 0, &nCols);
|
ret = metaGetStbStats(pMeta->pVnode, me.ctbEntry.suid, 0, &nCols);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to get stb stats:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->ctb.suid, tstrerror(ret));
|
||||||
|
}
|
||||||
pStats->numOfTimeSeries += nCols - 1;
|
pStats->numOfTimeSeries += nCols - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
(void)metaUpdateStbStats(pMeta, me.ctbEntry.suid, 1, 0);
|
metaUpdateStbStats(pMeta, me.ctbEntry.suid, 1, 0);
|
||||||
(void)metaUidCacheClear(pMeta, me.ctbEntry.suid);
|
ret = metaUidCacheClear(pMeta, me.ctbEntry.suid);
|
||||||
(void)metaTbGroupCacheClear(pMeta, me.ctbEntry.suid);
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to clear uid cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->ctb.suid, tstrerror(ret));
|
||||||
|
}
|
||||||
|
ret = metaTbGroupCacheClear(pMeta, me.ctbEntry.suid);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to clear group cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
pReq->ctb.suid, tstrerror(ret));
|
||||||
|
}
|
||||||
metaULock(pMeta);
|
metaULock(pMeta);
|
||||||
|
|
||||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||||
(void)tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, me.ctbEntry.suid, NULL);
|
ret = tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, me.ctbEntry.suid, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to create table:%s since %s", TD_VID(pMeta->pVnode), pReq->name, tstrerror(ret));
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
me.ntbEntry.btime = pReq->btime;
|
me.ntbEntry.btime = pReq->btime;
|
||||||
|
@ -1060,7 +1164,11 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
|
||||||
pStats->numOfNTimeSeries += me.ntbEntry.schemaRow.nCols - 1;
|
pStats->numOfNTimeSeries += me.ntbEntry.schemaRow.nCols - 1;
|
||||||
|
|
||||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||||
(void)tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, -1, &me.ntbEntry.schemaRow);
|
ret = tsdbCacheNewTable(pMeta->pVnode->pTsdb, me.uid, -1, &me.ntbEntry.schemaRow);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to create table:%s since %s", TD_VID(pMeta->pVnode), pReq->name, tstrerror(ret));
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1078,7 +1186,11 @@ int metaCreateTable(SMeta *pMeta, int64_t ver, SVCreateTbReq *pReq, STableMetaRs
|
||||||
(*pMetaRsp)->suid = pReq->ctb.suid;
|
(*pMetaRsp)->suid = pReq->ctb.suid;
|
||||||
strcpy((*pMetaRsp)->tbName, pReq->name);
|
strcpy((*pMetaRsp)->tbName, pReq->name);
|
||||||
} else {
|
} else {
|
||||||
(void)metaUpdateMetaRsp(pReq->uid, pReq->name, &pReq->ntb.schemaRow, *pMetaRsp);
|
ret = metaUpdateMetaRsp(pReq->uid, pReq->name, &pReq->ntb.schemaRow, *pMetaRsp);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to update meta rsp:%s since %s", TD_VID(pMeta->pVnode), pReq->name,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
for (int32_t i = 0; i < pReq->colCmpr.nCols; i++) {
|
for (int32_t i = 0; i < pReq->colCmpr.nCols; i++) {
|
||||||
SColCmpr *p = &pReq->colCmpr.pColCmpr[i];
|
SColCmpr *p = &pReq->colCmpr.pColCmpr[i];
|
||||||
(*pMetaRsp)->pSchemaExt[i].colId = p->id;
|
(*pMetaRsp)->pSchemaExt[i].colId = p->id;
|
||||||
|
@ -1135,7 +1247,11 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||||
(void)tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
|
int32_t ret = tsdbCacheDropTable(pMeta->pVnode->pTsdb, uid, suid, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to drop table:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), pReq->name, uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1233,7 +1349,11 @@ static int32_t metaFilterTableByHash(SMeta *pMeta, SArray *uidList) {
|
||||||
SMetaEntry me = {0};
|
SMetaEntry me = {0};
|
||||||
SDecoder dc = {0};
|
SDecoder dc = {0};
|
||||||
tDecoderInit(&dc, pData, nData);
|
tDecoderInit(&dc, pData, nData);
|
||||||
(void)metaDecodeEntry(&dc, &me);
|
code = metaDecodeEntry(&dc, &me);
|
||||||
|
if (code < 0) {
|
||||||
|
tDecoderClear(&dc);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
if (me.type != TSDB_SUPER_TABLE) {
|
if (me.type != TSDB_SUPER_TABLE) {
|
||||||
char tbFName[TSDB_TABLE_FNAME_LEN + 1];
|
char tbFName[TSDB_TABLE_FNAME_LEN + 1];
|
||||||
|
@ -1340,6 +1460,7 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
SMetaEntry e = {0};
|
SMetaEntry e = {0};
|
||||||
SDecoder dc = {0};
|
SDecoder dc = {0};
|
||||||
|
int32_t ret = 0;
|
||||||
|
|
||||||
rc = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData);
|
rc = tdbTbGet(pMeta->pUidIdx, &uid, sizeof(uid), &pData, &nData);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
@ -1347,7 +1468,11 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
||||||
}
|
}
|
||||||
int64_t version = ((SUidIdxVal *)pData)[0].version;
|
int64_t version = ((SUidIdxVal *)pData)[0].version;
|
||||||
|
|
||||||
(void)tdbTbGet(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pData, &nData);
|
rc = tdbTbGet(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), &pData, &nData);
|
||||||
|
if (rc < 0) {
|
||||||
|
tdbFree(pData);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
tDecoderInit(&dc, pData, nData);
|
tDecoderInit(&dc, pData, nData);
|
||||||
rc = metaDecodeEntry(&dc, &e);
|
rc = metaDecodeEntry(&dc, &e);
|
||||||
|
@ -1370,7 +1495,12 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
||||||
SMetaEntry stbEntry = {0};
|
SMetaEntry stbEntry = {0};
|
||||||
|
|
||||||
tDecoderInit(&tdc, tData, tLen);
|
tDecoderInit(&tdc, tData, tLen);
|
||||||
(void)metaDecodeEntry(&tdc, &stbEntry);
|
int32_t ret = metaDecodeEntry(&tdc, &stbEntry);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to decode child table:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name,
|
||||||
|
e.ctbEntry.suid, tstrerror(ret));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (pSysTbl) *pSysTbl = metaTbInFilterCache(pMeta, stbEntry.name, 1) ? 1 : 0;
|
if (pSysTbl) *pSysTbl = metaTbInFilterCache(pMeta, stbEntry.name, 1) ? 1 : 0;
|
||||||
|
|
||||||
|
@ -1378,7 +1508,11 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
||||||
SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag;
|
SSchemaWrapper *pTagSchema = &stbEntry.stbEntry.schemaTag;
|
||||||
if (pTagSchema->nCols == 1 && pTagSchema->pSchema[0].type == TSDB_DATA_TYPE_JSON) {
|
if (pTagSchema->nCols == 1 && pTagSchema->pSchema[0].type == TSDB_DATA_TYPE_JSON) {
|
||||||
pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0];
|
pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[0];
|
||||||
(void)metaDelJsonVarFromIdx(pMeta, &e, pTagColumn);
|
ret = metaDelJsonVarFromIdx(pMeta, &e, pTagColumn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to delete json var from idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode),
|
||||||
|
e.name, e.uid, tstrerror(ret));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < pTagSchema->nCols; i++) {
|
for (int i = 0; i < pTagSchema->nCols; i++) {
|
||||||
pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[i];
|
pTagColumn = &stbEntry.stbEntry.schemaTag.pSchema[i];
|
||||||
|
@ -1406,7 +1540,11 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
||||||
|
|
||||||
if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid,
|
if (metaCreateTagIdxKey(e.ctbEntry.suid, pTagColumn->colId, pTagData, nTagData, pTagColumn->type, uid,
|
||||||
&pTagIdxKey, &nTagIdxKey) == 0) {
|
&pTagIdxKey, &nTagIdxKey) == 0) {
|
||||||
(void)tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
ret = tdbTbDelete(pMeta->pTagIdx, pTagIdxKey, nTagIdxKey, pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to delete tag idx key:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode),
|
||||||
|
e.name, e.uid, tstrerror(ret));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
metaDestroyTagIdxKey(pTagIdxKey);
|
metaDestroyTagIdxKey(pTagIdxKey);
|
||||||
pTagIdxKey = NULL;
|
pTagIdxKey = NULL;
|
||||||
|
@ -1418,9 +1556,21 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), pMeta->txn);
|
ret = tdbTbDelete(pMeta->pTbDb, &(STbDbKey){.version = version, .uid = uid}, sizeof(STbDbKey), pMeta->txn);
|
||||||
(void)tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, pMeta->txn);
|
if (ret < 0) {
|
||||||
(void)tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), pMeta->txn);
|
metaError("vgId:%d, failed to delete table:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
|
ret = tdbTbDelete(pMeta->pNameIdx, e.name, strlen(e.name) + 1, pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to delete name idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
|
ret = tdbTbDelete(pMeta->pUidIdx, &uid, sizeof(uid), pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to delete uid idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
|
|
||||||
if (e.type == TSDB_CHILD_TABLE || e.type == TSDB_NORMAL_TABLE) metaDeleteBtimeIdx(pMeta, &e);
|
if (e.type == TSDB_CHILD_TABLE || e.type == TSDB_NORMAL_TABLE) metaDeleteBtimeIdx(pMeta, &e);
|
||||||
if (e.type == TSDB_NORMAL_TABLE) metaDeleteNcolIdx(pMeta, &e);
|
if (e.type == TSDB_NORMAL_TABLE) metaDeleteNcolIdx(pMeta, &e);
|
||||||
|
@ -1428,13 +1578,25 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
||||||
if (e.type != TSDB_SUPER_TABLE) metaDeleteTtl(pMeta, &e);
|
if (e.type != TSDB_SUPER_TABLE) metaDeleteTtl(pMeta, &e);
|
||||||
|
|
||||||
if (e.type == TSDB_CHILD_TABLE) {
|
if (e.type == TSDB_CHILD_TABLE) {
|
||||||
(void)tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey),
|
ret =
|
||||||
pMeta->txn);
|
tdbTbDelete(pMeta->pCtbIdx, &(SCtbIdxKey){.suid = e.ctbEntry.suid, .uid = uid}, sizeof(SCtbIdxKey), pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to delete ctb idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
|
|
||||||
--pMeta->pVnode->config.vndStats.numOfCTables;
|
--pMeta->pVnode->config.vndStats.numOfCTables;
|
||||||
(void)metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0);
|
metaUpdateStbStats(pMeta, e.ctbEntry.suid, -1, 0);
|
||||||
(void)metaUidCacheClear(pMeta, e.ctbEntry.suid);
|
ret = metaUidCacheClear(pMeta, e.ctbEntry.suid);
|
||||||
(void)metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to clear uid cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name,
|
||||||
|
e.ctbEntry.suid, tstrerror(ret));
|
||||||
|
}
|
||||||
|
ret = metaTbGroupCacheClear(pMeta, e.ctbEntry.suid);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to clear group cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name,
|
||||||
|
e.ctbEntry.suid, tstrerror(ret));
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
if (!TSDB_CACHE_NO(pMeta->pVnode->config)) {
|
||||||
tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, e.ctbEntry.suid, NULL);
|
tsdbCacheDropTable(pMeta->pVnode->pTsdb, e.uid, e.ctbEntry.suid, NULL);
|
||||||
|
@ -1452,16 +1614,36 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type, tb_uid_t *p
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
} else if (e.type == TSDB_SUPER_TABLE) {
|
} else if (e.type == TSDB_SUPER_TABLE) {
|
||||||
(void)tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn);
|
ret = tdbTbDelete(pMeta->pSuidIdx, &e.uid, sizeof(tb_uid_t), pMeta->txn);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to delete suid idx:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
// drop schema.db (todo)
|
// drop schema.db (todo)
|
||||||
|
|
||||||
(void)metaStatsCacheDrop(pMeta, uid);
|
ret = metaStatsCacheDrop(pMeta, uid);
|
||||||
(void)metaUidCacheClear(pMeta, uid);
|
if (ret < 0) {
|
||||||
(void)metaTbGroupCacheClear(pMeta, uid);
|
metaError("vgId:%d, failed to drop stats cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
|
ret = metaUidCacheClear(pMeta, uid);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to clear uid cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
|
ret = metaTbGroupCacheClear(pMeta, uid);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to clear group cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name,
|
||||||
|
e.uid, tstrerror(ret));
|
||||||
|
}
|
||||||
--pMeta->pVnode->config.vndStats.numOfSTables;
|
--pMeta->pVnode->config.vndStats.numOfSTables;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)metaCacheDrop(pMeta, uid);
|
ret = metaCacheDrop(pMeta, uid);
|
||||||
|
if (ret < 0) {
|
||||||
|
metaError("vgId:%d, failed to drop cache:%s uid:%" PRId64 " since %s", TD_VID(pMeta->pVnode), e.name, e.uid,
|
||||||
|
tstrerror(ret));
|
||||||
|
}
|
||||||
|
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
tdbFree(pData);
|
tdbFree(pData);
|
||||||
|
@ -1535,21 +1717,21 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
TBC *pUidIdxc = NULL;
|
TBC *pUidIdxc = NULL;
|
||||||
|
|
||||||
TAOS_CHECK_RETURN(tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL));
|
TAOS_CHECK_RETURN(tdbTbcOpen(pMeta->pUidIdx, &pUidIdxc, NULL));
|
||||||
(void)tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
ret = tdbTbcMoveTo(pUidIdxc, &uid, sizeof(uid), &c);
|
||||||
if (c != 0) {
|
if (c != 0) {
|
||||||
tdbTbcClose(pUidIdxc);
|
tdbTbcClose(pUidIdxc);
|
||||||
metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c);
|
metaError("meta/table: invalide c: %" PRId32 " alt tb column failed.", c);
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
ret = tdbTbcGet(pUidIdxc, NULL, NULL, &pData, &nData);
|
||||||
oversion = ((SUidIdxVal *)pData)[0].version;
|
oversion = ((SUidIdxVal *)pData)[0].version;
|
||||||
|
|
||||||
// search table.db
|
// search table.db
|
||||||
TBC *pTbDbc = NULL;
|
TBC *pTbDbc = NULL;
|
||||||
|
|
||||||
TAOS_CHECK_RETURN(tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL));
|
TAOS_CHECK_RETURN(tdbTbcOpen(pMeta->pTbDb, &pTbDbc, NULL));
|
||||||
(void)tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
ret = tdbTbcMoveTo(pTbDbc, &((STbDbKey){.uid = uid, .version = oversion}), sizeof(STbDbKey), &c);
|
||||||
if (c != 0) {
|
if (c != 0) {
|
||||||
tdbTbcClose(pUidIdxc);
|
tdbTbcClose(pUidIdxc);
|
||||||
tdbTbcClose(pTbDbc);
|
tdbTbcClose(pTbDbc);
|
||||||
|
@ -1557,13 +1739,13 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
return TSDB_CODE_FAILED;
|
return TSDB_CODE_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
ret = tdbTbcGet(pTbDbc, NULL, NULL, &pData, &nData);
|
||||||
|
|
||||||
// get table entry
|
// get table entry
|
||||||
SDecoder dc = {0};
|
SDecoder dc = {0};
|
||||||
if ((entry.pBuf = taosMemoryMalloc(nData)) == NULL) {
|
if ((entry.pBuf = taosMemoryMalloc(nData)) == NULL) {
|
||||||
(void)tdbTbcClose(pUidIdxc);
|
tdbTbcClose(pUidIdxc);
|
||||||
(void)tdbTbcClose(pTbDbc);
|
tdbTbcClose(pTbDbc);
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
memcpy(entry.pBuf, pData, nData);
|
memcpy(entry.pBuf, pData, nData);
|
||||||
|
@ -2578,7 +2760,7 @@ int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void *pTagData, int32_
|
||||||
|
|
||||||
*ppTagIdxKey = (STagIdxKey *)taosMemoryMalloc(*nTagIdxKey);
|
*ppTagIdxKey = (STagIdxKey *)taosMemoryMalloc(*nTagIdxKey);
|
||||||
if (*ppTagIdxKey == NULL) {
|
if (*ppTagIdxKey == NULL) {
|
||||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*ppTagIdxKey)->suid = suid;
|
(*ppTagIdxKey)->suid = suid;
|
||||||
|
|
|
@ -53,12 +53,12 @@ int32_t ttlMgrOpen(STtlManger **ppTtlMgr, TDB *pEnv, int8_t rollback, const char
|
||||||
*ppTtlMgr = NULL;
|
*ppTtlMgr = NULL;
|
||||||
|
|
||||||
STtlManger *pTtlMgr = (STtlManger *)tdbOsCalloc(1, sizeof(*pTtlMgr));
|
STtlManger *pTtlMgr = (STtlManger *)tdbOsCalloc(1, sizeof(*pTtlMgr));
|
||||||
if (pTtlMgr == NULL) TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
if (pTtlMgr == NULL) TAOS_RETURN(terrno);
|
||||||
|
|
||||||
char *logBuffer = (char *)tdbOsCalloc(1, strlen(logPrefix) + 1);
|
char *logBuffer = (char *)tdbOsCalloc(1, strlen(logPrefix) + 1);
|
||||||
if (logBuffer == NULL) {
|
if (logBuffer == NULL) {
|
||||||
tdbOsFree(pTtlMgr);
|
tdbOsFree(pTtlMgr);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
(void)strcpy(logBuffer, logPrefix);
|
(void)strcpy(logBuffer, logPrefix);
|
||||||
pTtlMgr->logPrefix = logBuffer;
|
pTtlMgr->logPrefix = logBuffer;
|
||||||
|
|
|
@ -213,11 +213,11 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
|
||||||
atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INIT);
|
atomic_store_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INIT);
|
||||||
(void)tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
(void)tsem_init(&pRSmaStat->notEmpty, 0, 0);
|
||||||
if (!(pRSmaStat->blocks = taosArrayInit(1, sizeof(SSDataBlock)))) {
|
if (!(pRSmaStat->blocks = taosArrayInit(1, sizeof(SSDataBlock)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TAOS_CHECK_GOTO(code, &lino, _exit);
|
TAOS_CHECK_GOTO(code, &lino, _exit);
|
||||||
}
|
}
|
||||||
SSDataBlock datablock = {.info.type = STREAM_CHECKPOINT};
|
SSDataBlock datablock = {.info.type = STREAM_CHECKPOINT};
|
||||||
TSDB_CHECK_NULL(taosArrayPush(pRSmaStat->blocks, &datablock), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
|
TSDB_CHECK_NULL(taosArrayPush(pRSmaStat->blocks, &datablock), code, lino, _exit, terrno);
|
||||||
|
|
||||||
// init smaMgmt
|
// init smaMgmt
|
||||||
TAOS_CHECK_GOTO(smaInit(), &lino, _exit);
|
TAOS_CHECK_GOTO(smaInit(), &lino, _exit);
|
||||||
|
|
|
@ -273,7 +273,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
||||||
if (!taosCheckExistFile(taskInfDir)) {
|
if (!taosCheckExistFile(taskInfDir)) {
|
||||||
char *s = taosStrdup(taskInfDir);
|
char *s = taosStrdup(taskInfDir);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
if (taosMulMkDir(s) != 0) {
|
if (taosMulMkDir(s) != 0) {
|
||||||
code = TAOS_SYSTEM_ERROR(errno);
|
code = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
@ -294,7 +294,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
||||||
pStreamTask->pMeta = pVnode->pTq->pStreamMeta;
|
pStreamTask->pMeta = pVnode->pTq->pStreamMeta;
|
||||||
pStreamTask->exec.qmsg = taosMemoryMalloc(strlen(RSMA_EXEC_TASK_FLAG) + 1);
|
pStreamTask->exec.qmsg = taosMemoryMalloc(strlen(RSMA_EXEC_TASK_FLAG) + 1);
|
||||||
if (!pStreamTask->exec.qmsg) {
|
if (!pStreamTask->exec.qmsg) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
(void)sprintf(pStreamTask->exec.qmsg, "%s", RSMA_EXEC_TASK_FLAG);
|
(void)sprintf(pStreamTask->exec.qmsg, "%s", RSMA_EXEC_TASK_FLAG);
|
||||||
pStreamTask->chkInfo.checkpointId = streamMetaGetLatestCheckpointId(pStreamTask->pMeta);
|
pStreamTask->chkInfo.checkpointId = streamMetaGetLatestCheckpointId(pStreamTask->pMeta);
|
||||||
|
@ -321,7 +321,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaStat
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pItem->pResList = taosArrayInit(1, POINTER_BYTES))) {
|
if (!(pItem->pResList = taosArrayInit(1, POINTER_BYTES))) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pItem->fetchResultVer < pItem->submitReqVer) {
|
if (pItem->fetchResultVer < pItem->submitReqVer) {
|
||||||
|
@ -504,11 +504,11 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
||||||
if (uid) {
|
if (uid) {
|
||||||
if (!pStore->tbUids) {
|
if (!pStore->tbUids) {
|
||||||
if (!(pStore->tbUids = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
if (!(pStore->tbUids = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(pStore->tbUids, uid)) {
|
if (!taosArrayPush(pStore->tbUids, uid)) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -516,7 +516,7 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
||||||
if (!pStore->uidHash) {
|
if (!pStore->uidHash) {
|
||||||
pStore->uidHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
pStore->uidHash = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||||
if (!pStore->uidHash) {
|
if (!pStore->uidHash) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (uid) {
|
if (uid) {
|
||||||
|
@ -524,16 +524,16 @@ static int32_t tdUidStorePut(STbUidStore *pStore, tb_uid_t suid, tb_uid_t *uid)
|
||||||
if (uidArray && ((uidArray = *(SArray **)uidArray))) {
|
if (uidArray && ((uidArray = *(SArray **)uidArray))) {
|
||||||
if (!taosArrayPush(uidArray, uid)) {
|
if (!taosArrayPush(uidArray, uid)) {
|
||||||
taosArrayDestroy(uidArray);
|
taosArrayDestroy(uidArray);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SArray *pUidArray = taosArrayInit(1, sizeof(tb_uid_t));
|
SArray *pUidArray = taosArrayInit(1, sizeof(tb_uid_t));
|
||||||
if (!pUidArray) {
|
if (!pUidArray) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(pUidArray, uid)) {
|
if (!taosArrayPush(pUidArray, uid)) {
|
||||||
taosArrayDestroy(pUidArray);
|
taosArrayDestroy(pUidArray);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
TAOS_CHECK_RETURN(taosHashPut(pStore->uidHash, &suid, sizeof(suid), &pUidArray, sizeof(pUidArray)));
|
TAOS_CHECK_RETURN(taosHashPut(pStore->uidHash, &suid, sizeof(suid), &pUidArray, sizeof(pUidArray)));
|
||||||
}
|
}
|
||||||
|
@ -634,7 +634,7 @@ static int32_t tdRSmaProcessDelReq(SSma *pSma, int64_t suid, int8_t level, SBatc
|
||||||
|
|
||||||
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
||||||
if (!pBuf) {
|
if (!pBuf) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
|
||||||
SBatchDeleteReq deleteReq = {.suid = suid, .level = pItem->level};
|
SBatchDeleteReq deleteReq = {.suid = suid, .level = pItem->level};
|
||||||
deleteReq.deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
|
deleteReq.deleteReqs = taosArrayInit(0, sizeof(SSingleDeleteReq));
|
||||||
if (!deleteReq.deleteReqs) {
|
if (!deleteReq.deleteReqs) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
code = tqBuildDeleteReq(pSma->pVnode->pTq, NULL, output, &deleteReq, "", true);
|
code = tqBuildDeleteReq(pSma->pVnode->pTq, NULL, output, &deleteReq, "", true);
|
||||||
|
@ -1065,7 +1065,7 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) {
|
||||||
tb_uid_t suid = 0;
|
tb_uid_t suid = 0;
|
||||||
|
|
||||||
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1085,7 +1085,7 @@ static int32_t tdRSmaRestoreQTaskInfoInit(SSma *pSma, int64_t *nTables) {
|
||||||
int64_t nRsmaTables = 0;
|
int64_t nRsmaTables = 0;
|
||||||
metaReaderDoInit(&mr, SMA_META(pSma), META_READER_LOCK);
|
metaReaderDoInit(&mr, SMA_META(pSma), META_READER_LOCK);
|
||||||
if (!(uidStore.tbUids = taosArrayInit(1024, sizeof(tb_uid_t)))) {
|
if (!(uidStore.tbUids = taosArrayInit(1024, sizeof(tb_uid_t)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1518,7 +1518,7 @@ static int32_t tdRSmaBatchExec(SSma *pSma, SRSmaInfo *pInfo, STaosQall *qall, SA
|
||||||
version = packData.ver;
|
version = packData.ver;
|
||||||
if (!taosArrayPush(pSubmitArr, &packData)) {
|
if (!taosArrayPush(pSubmitArr, &packData)) {
|
||||||
taosFreeQitem(msg);
|
taosFreeQitem(msg);
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
++nSubmit;
|
++nSubmit;
|
||||||
} else if (inputType == STREAM_INPUT__REF_DATA_BLOCK) {
|
} else if (inputType == STREAM_INPUT__REF_DATA_BLOCK) {
|
||||||
|
@ -1608,7 +1608,7 @@ int32_t tdRSmaProcessExecImpl(SSma *pSma, ERsmaExecType type) {
|
||||||
|
|
||||||
if (!(pSubmitArr =
|
if (!(pSubmitArr =
|
||||||
taosArrayInit(TMIN(RSMA_EXEC_BATCH_SIZE, atomic_load_64(&pRSmaStat->nBufItems)), sizeof(SPackedData)))) {
|
taosArrayInit(TMIN(RSMA_EXEC_BATCH_SIZE, atomic_load_64(&pRSmaStat->nBufItems)), sizeof(SPackedData)))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,12 +170,12 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
||||||
|
|
||||||
pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData));
|
pReq->aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData));
|
||||||
if (pReq->aSubmitTbData == NULL) {
|
if (pReq->aSubmitTbData == NULL) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
pTableIndexMap = taosHashInit(numOfBlocks, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
pTableIndexMap = taosHashInit(numOfBlocks, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
|
||||||
if (pTableIndexMap == NULL) {
|
if (pTableIndexMap == NULL) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SSubmitTbData req
|
// SSubmitTbData req
|
||||||
|
@ -205,7 +205,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
||||||
}
|
}
|
||||||
|
|
||||||
if( taosArrayPush(pReq->aSubmitTbData, &tbData) == NULL) {
|
if( taosArrayPush(pReq->aSubmitTbData, &tbData) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
|
||||||
SEncoder encoder;
|
SEncoder encoder;
|
||||||
len += sizeof(SSubmitReq2Msg);
|
len += sizeof(SSubmitReq2Msg);
|
||||||
if (!(pBuf = rpcMallocCont(len))) {
|
if (!(pBuf = rpcMallocCont(len))) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ static int32_t tsmaProcessDelReq(SSma *pSma, int64_t indexUid, SBatchDeleteReq *
|
||||||
|
|
||||||
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
void *pBuf = rpcMallocCont(len + sizeof(SMsgHead));
|
||||||
if (!pBuf) {
|
if (!pBuf) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ int32_t tqOpen(const char* path, SVnode* pVnode) {
|
||||||
|
|
||||||
pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
|
pTq->pHandle = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
|
||||||
if (pTq->pHandle == NULL) {
|
if (pTq->pHandle == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
taosHashSetFreeFp(pTq->pHandle, tqDestroyTqHandle);
|
taosHashSetFreeFp(pTq->pHandle, tqDestroyTqHandle);
|
||||||
|
|
||||||
|
@ -82,18 +82,18 @@ int32_t tqOpen(const char* path, SVnode* pVnode) {
|
||||||
|
|
||||||
pTq->pPushMgr = taosHashInit(64, MurmurHash3_32, false, HASH_NO_LOCK);
|
pTq->pPushMgr = taosHashInit(64, MurmurHash3_32, false, HASH_NO_LOCK);
|
||||||
if (pTq->pPushMgr == NULL) {
|
if (pTq->pPushMgr == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pTq->pCheckInfo = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
pTq->pCheckInfo = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK);
|
||||||
if (pTq->pCheckInfo == NULL) {
|
if (pTq->pCheckInfo == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo);
|
taosHashSetFreeFp(pTq->pCheckInfo, (FDelete)tDeleteSTqCheckInfo);
|
||||||
|
|
||||||
pTq->pOffset = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_ENTRY_LOCK);
|
pTq->pOffset = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_VARCHAR), true, HASH_ENTRY_LOCK);
|
||||||
if (pTq->pOffset == NULL) {
|
if (pTq->pOffset == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
taosHashSetFreeFp(pTq->pOffset, (FDelete)tDeleteSTqOffset);
|
taosHashSetFreeFp(pTq->pOffset, (FDelete)tDeleteSTqOffset);
|
||||||
|
|
||||||
|
@ -464,7 +464,6 @@ int32_t tqProcessVgCommittedInfoReq(STQ* pTq, SRpcMsg* pMsg) {
|
||||||
|
|
||||||
void* buf = rpcMallocCont(len);
|
void* buf = rpcMallocCont(len);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
SEncoder encoder = {0};
|
SEncoder encoder = {0};
|
||||||
|
|
|
@ -198,7 +198,7 @@ int32_t tqMetaGetOffset(STQ* pTq, const char* subkey, STqOffset** pOffset){
|
||||||
if (taosHashPut(pTq->pOffset, subkey, strlen(subkey), &offset, sizeof(STqOffset)) != 0) {
|
if (taosHashPut(pTq->pOffset, subkey, strlen(subkey), &offset, sizeof(STqOffset)) != 0) {
|
||||||
tDeleteSTqOffset(&offset);
|
tDeleteSTqOffset(&offset);
|
||||||
tdbFree(data);
|
tdbFree(data);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
tdbFree(data);
|
tdbFree(data);
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ int32_t tqMetaCreateHandle(STQ* pTq, SMqRebVgReq* req, STqHandle* handle) {
|
||||||
handle->execHandle.execDb.pFilterOutTbUid =
|
handle->execHandle.execDb.pFilterOutTbUid =
|
||||||
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_ENTRY_LOCK);
|
||||||
if(handle->execHandle.execDb.pFilterOutTbUid == NULL){
|
if(handle->execHandle.execDb.pFilterOutTbUid == NULL){
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}else if(req->subType == TOPIC_SUB_TYPE__TABLE){
|
}else if(req->subType == TOPIC_SUB_TYPE__TABLE){
|
||||||
handle->execHandle.execTb.suid = req->suid;
|
handle->execHandle.execTb.suid = req->suid;
|
||||||
|
|
|
@ -577,7 +577,7 @@ static int32_t buildResSDataBlock(SSDataBlock* pBlock, SSchemaWrapper* pSchema,
|
||||||
int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
|
int32_t code = blockDataAppendColInfo(pBlock, &colInfo);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
blockDataFreeRes(pBlock);
|
blockDataFreeRes(pBlock);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -36,11 +36,11 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, void* pRsp, int32_t numOf
|
||||||
actualLen += sizeof(SRetrieveTableRspForTmq);
|
actualLen += sizeof(SRetrieveTableRspForTmq);
|
||||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockDataLen, &actualLen) == NULL){
|
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockDataLen, &actualLen) == NULL){
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockData, &buf) == NULL) {
|
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockData, &buf) == NULL) {
|
||||||
taosMemoryFree(buf);
|
taosMemoryFree(buf);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -52,7 +52,7 @@ static int32_t tqAddBlockSchemaToRsp(const STqExecHandle* pExec, void* pRsp) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockSchema, &pSW) == NULL) {
|
if (taosArrayPush(((SMqDataRspCommon*)pRsp)->blockSchema, &pSW) == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -327,12 +327,12 @@ static void tqProcessSubData(STQ* pTq, STqHandle* pHandle, STaosxRsp* pRsp, int3
|
||||||
if (pRsp->createTableNum == 0) {
|
if (pRsp->createTableNum == 0) {
|
||||||
pRsp->createTableLen = taosArrayInit(0, sizeof(int32_t));
|
pRsp->createTableLen = taosArrayInit(0, sizeof(int32_t));
|
||||||
if (pRsp->createTableLen == NULL) {
|
if (pRsp->createTableLen == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
pRsp->createTableReq = taosArrayInit(0, sizeof(void*));
|
pRsp->createTableReq = taosArrayInit(0, sizeof(void*));
|
||||||
if (pRsp->createTableReq == NULL) {
|
if (pRsp->createTableReq == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ int32_t initCreateTableMsg(SVCreateTbReq* pCreateTableReq, uint64_t suid, const
|
||||||
pCreateTableReq->ctb.stbName = taosStrdup((char*)tNameGetTableName(&name));
|
pCreateTableReq->ctb.stbName = taosStrdup((char*)tNameGetTableName(&name));
|
||||||
if (pCreateTableReq->ctb.stbName == NULL) { // ignore this error code
|
if (pCreateTableReq->ctb.stbName == NULL) { // ignore this error code
|
||||||
tqError("failed to duplicate the stb name:%s, failed to init create-table msg and create req table", stbFullName);
|
tqError("failed to duplicate the stb name:%s, failed to init create-table msg and create req table", stbFullName);
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
||||||
|
|
||||||
void* p = taosArrayPush(tagArray, &tagVal);
|
void* p = taosArrayPush(tagArray, &tagVal);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = createDefaultTagColName(&pCreateTbReq->ctb.tagName);
|
code = createDefaultTagColName(&pCreateTbReq->ctb.tagName);
|
||||||
|
@ -317,7 +317,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
||||||
}
|
}
|
||||||
void* p = taosArrayPush(tagArray, &tagVal);
|
void* p = taosArrayPush(tagArray, &tagVal);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,7 +356,7 @@ static int32_t doBuildAndSendCreateTableMsg(SVnode* pVnode, char* stbFullName, S
|
||||||
|
|
||||||
void* p = taosArrayPush(reqs.pArray, pCreateTbReq);
|
void* p = taosArrayPush(reqs.pArray, pCreateTbReq);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,13 +446,13 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
if (pNewRow->ts < pOldRow->ts) {
|
if (pNewRow->ts < pOldRow->ts) {
|
||||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
j += 1;
|
j += 1;
|
||||||
} else if (pNewRow->ts > pOldRow->ts) {
|
} else if (pNewRow->ts > pOldRow->ts) {
|
||||||
void* p = taosArrayPush(pFinal, &pOldRow);
|
void* p = taosArrayPush(pFinal, &pOldRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
k += 1;
|
k += 1;
|
||||||
|
@ -461,7 +461,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
if (pNewRow->numOfPKs == 0) {
|
if (pNewRow->numOfPKs == 0) {
|
||||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
k += 1;
|
k += 1;
|
||||||
|
@ -478,7 +478,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
void* p = taosArrayPush(pFinal, &pNewRow);
|
void* p = taosArrayPush(pFinal, &pNewRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
j += 1;
|
j += 1;
|
||||||
|
@ -490,7 +490,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
} else {
|
} else {
|
||||||
void* p = taosArrayPush(pFinal, &pOldRow);
|
void* p = taosArrayPush(pFinal, &pOldRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
k += 1;
|
k += 1;
|
||||||
|
@ -503,7 +503,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pNew->aRowP, j++);
|
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pNew->aRowP, j++);
|
||||||
void* p = taosArrayPush(pFinal, &pRow);
|
void* p = taosArrayPush(pFinal, &pRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ int32_t doMergeExistedRows(SSubmitTbData* pExisted, const SSubmitTbData* pNew, c
|
||||||
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pExisted->aRowP, k++);
|
SRow* pRow = *(SRow**)TARRAY_GET_ELEM(pExisted->aRowP, k++);
|
||||||
void* p = taosArrayPush(pFinal, &pRow);
|
void* p = taosArrayPush(pFinal, &pRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ int32_t buildAutoCreateTableReq(const char* stbFullName, int64_t suid, int32_t n
|
||||||
STagVal tagVal = {.cid = numOfCols, .type = TSDB_DATA_TYPE_UBIGINT, .i64 = pDataBlock->info.id.groupId};
|
STagVal tagVal = {.cid = numOfCols, .type = TSDB_DATA_TYPE_UBIGINT, .i64 = pDataBlock->info.id.groupId};
|
||||||
void* p = taosArrayPush(pTagArray, &tagVal);
|
void* p = taosArrayPush(pTagArray, &tagVal);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
code = tTagNew(pTagArray, 1, false, (STag**)&pCreateTbReq->ctb.pTag);
|
code = tTagNew(pTagArray, 1, false, (STag**)&pCreateTbReq->ctb.pTag);
|
||||||
|
@ -604,7 +604,7 @@ int32_t buildSubmitMsgImpl(SSubmitReq2* pSubmitReq, int32_t vgId, void** pMsg, i
|
||||||
pBuf = rpcMallocCont(len);
|
pBuf = rpcMallocCont(len);
|
||||||
if (NULL == pBuf) {
|
if (NULL == pBuf) {
|
||||||
tDestroySubmitReq(pSubmitReq, TSDB_MSG_FLG_ENCODE);
|
tDestroySubmitReq(pSubmitReq, TSDB_MSG_FLG_ENCODE);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
((SSubmitReq2Msg*)pBuf)->header.vgId = vgId;
|
((SSubmitReq2Msg*)pBuf)->header.vgId = vgId;
|
||||||
|
@ -652,7 +652,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
taosArrayDestroy(pTableData->aRowP);
|
taosArrayDestroy(pTableData->aRowP);
|
||||||
pTableData->aRowP = NULL;
|
pTableData->aRowP = NULL;
|
||||||
taosArrayDestroy(pVals);
|
taosArrayDestroy(pVals);
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
tqError("s-task:%s failed to prepare write stream res blocks, code:%s", id, tstrerror(code));
|
tqError("s-task:%s failed to prepare write stream res blocks, code:%s", id, tstrerror(code));
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -695,7 +695,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||||
void* p = taosArrayPush(pVals, &cv);
|
void* p = taosArrayPush(pVals, &cv);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SColumnInfoData* pColData = taosArrayGet(pDataBlock->pDataBlock, dataIndex);
|
SColumnInfoData* pColData = taosArrayGet(pDataBlock->pDataBlock, dataIndex);
|
||||||
|
@ -713,7 +713,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
SColVal cv = COL_VAL_NULL(pCol->colId, pCol->type);
|
||||||
void* p = taosArrayPush(pVals, &cv);
|
void* p = taosArrayPush(pVals, &cv);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
dataIndex++;
|
dataIndex++;
|
||||||
|
@ -725,7 +725,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
||||||
void* p = taosArrayPush(pVals, &cv);
|
void* p = taosArrayPush(pVals, &cv);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SValue sv = {.type = pCol->type};
|
SValue sv = {.type = pCol->type};
|
||||||
|
@ -733,7 +733,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
SColVal cv = COL_VAL_VALUE(pCol->colId, sv);
|
||||||
void* p = taosArrayPush(pVals, &cv);
|
void* p = taosArrayPush(pVals, &cv);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dataIndex++;
|
dataIndex++;
|
||||||
|
@ -752,7 +752,7 @@ int32_t doConvertRows(SSubmitTbData* pTableData, const STSchema* pTSchema, SSDat
|
||||||
|
|
||||||
void* p = taosArrayPush(pTableData->aRowP, &pRow);
|
void* p = taosArrayPush(pTableData->aRowP, &pRow);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1026,7 +1026,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
|
||||||
|
|
||||||
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
||||||
if (submitReq.aSubmitTbData == NULL) {
|
if (submitReq.aSubmitTbData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1066,7 @@ void tqSinkDataIntoDstTable(SStreamTask* pTask, void* vnode, void* data) {
|
||||||
|
|
||||||
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
SSubmitReq2 submitReq = {.aSubmitTbData = taosArrayInit(1, sizeof(SSubmitTbData))};
|
||||||
if (submitReq.aSubmitTbData == NULL) {
|
if (submitReq.aSubmitTbData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
tqError("s-task:%s vgId:%d failed to prepare submit msg in sink task, code:%s", id, vgId, tstrerror(code));
|
||||||
taosHashCleanup(pTableIndexMap);
|
taosHashCleanup(pTableIndexMap);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -33,7 +33,7 @@ int32_t tqSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, int8_t type, STqS
|
||||||
// alloc
|
// alloc
|
||||||
pReader = (STqSnapReader*)taosMemoryCalloc(1, sizeof(STqSnapReader));
|
pReader = (STqSnapReader*)taosMemoryCalloc(1, sizeof(STqSnapReader));
|
||||||
if (pReader == NULL) {
|
if (pReader == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
pReader->pTq = pTq;
|
pReader->pTq = pTq;
|
||||||
|
|
|
@ -95,7 +95,7 @@ int32_t streamStateSnapRead(SStreamStateReader* pReader, uint8_t** ppData) {
|
||||||
}
|
}
|
||||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + len);
|
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + len);
|
||||||
if (*ppData == NULL) {
|
if (*ppData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
// refactor later, avoid mem/free freq
|
// refactor later, avoid mem/free freq
|
||||||
|
|
|
@ -96,7 +96,7 @@ int32_t tqScanWalInFuture(STQ* pTq, int32_t numOfTasks, int32_t idleDuration) {
|
||||||
|
|
||||||
SBuildScanWalMsgParam* pParam = taosMemoryMalloc(sizeof(SBuildScanWalMsgParam));
|
SBuildScanWalMsgParam* pParam = taosMemoryMalloc(sizeof(SBuildScanWalMsgParam));
|
||||||
if (pParam == NULL) {
|
if (pParam == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pParam->pTq = pTq;
|
pParam->pTq = pTq;
|
||||||
|
|
|
@ -46,7 +46,7 @@ int32_t streamTaskSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamTa
|
||||||
pReader->ever = ever;
|
pReader->ever = ever;
|
||||||
pReader->tdbTbList = taosArrayInit(4, sizeof(STablePair));
|
pReader->tdbTbList = taosArrayInit(4, sizeof(STablePair));
|
||||||
if (pReader->tdbTbList == NULL) {
|
if (pReader->tdbTbList == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _err);
|
TAOS_CHECK_GOTO(terrno, NULL, _err);
|
||||||
}
|
}
|
||||||
|
|
||||||
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
STablePair pair1 = {.tbl = pTq->pStreamMeta->pTaskDb, .type = SNAP_DATA_STREAM_TASK};
|
||||||
|
@ -159,7 +159,7 @@ NextTbl:
|
||||||
}
|
}
|
||||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
|
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + vLen);
|
||||||
if (*ppData == NULL) {
|
if (*ppData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ int32_t tqInitDataRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) {
|
||||||
pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
|
pRsp->blockDataLen = taosArrayInit(0, sizeof(int32_t));
|
||||||
|
|
||||||
if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL) {
|
if (pRsp->blockData == NULL || pRsp->blockDataLen == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
tOffsetCopy(&pRsp->reqOffset, &pOffset);
|
tOffsetCopy(&pRsp->reqOffset, &pOffset);
|
||||||
|
@ -71,7 +71,7 @@ static int32_t tqInitTaosxRsp(SMqDataRspCommon* pRsp, STqOffsetVal pOffset) {
|
||||||
taosArrayDestroy(pRsp->blockSchema);
|
taosArrayDestroy(pRsp->blockSchema);
|
||||||
pRsp->blockSchema = NULL;
|
pRsp->blockSchema = NULL;
|
||||||
}
|
}
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -540,7 +540,7 @@ int32_t tqDoSendDataRsp(const SRpcHandleInfo* pRpcHandleInfo, const void* pRsp,
|
||||||
int32_t tlen = sizeof(SMqRspHead) + len;
|
int32_t tlen = sizeof(SMqRspHead) + len;
|
||||||
void* buf = rpcMallocCont(tlen);
|
void* buf = rpcMallocCont(tlen);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SMqRspHead* pHead = (SMqRspHead*)buf;
|
SMqRspHead* pHead = (SMqRspHead*)buf;
|
||||||
|
|
|
@ -578,7 +578,7 @@ int32_t tqStreamTaskProcessCheckpointReadyMsg(SStreamMeta* pMeta, SRpcMsg* pMsg)
|
||||||
{ // send checkpoint ready rsp
|
{ // send checkpoint ready rsp
|
||||||
SMStreamCheckpointReadyRspMsg* pReadyRsp = rpcMallocCont(sizeof(SMStreamCheckpointReadyRspMsg));
|
SMStreamCheckpointReadyRspMsg* pReadyRsp = rpcMallocCont(sizeof(SMStreamCheckpointReadyRspMsg));
|
||||||
if (pReadyRsp == NULL) {
|
if (pReadyRsp == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
pReadyRsp->upstreamTaskId = req.upstreamTaskId;
|
pReadyRsp->upstreamTaskId = req.upstreamTaskId;
|
||||||
|
|
|
@ -425,7 +425,7 @@ static int32_t tsdbCacheSerialize(SLastCol *pLastCol, char **value, size_t *size
|
||||||
|
|
||||||
*value = taosMemoryMalloc(*size);
|
*value = taosMemoryMalloc(*size);
|
||||||
if (NULL == *value) {
|
if (NULL == *value) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t offset = tsdbCacheSerializeV0(*value, pLastCol);
|
int32_t offset = tsdbCacheSerializeV0(*value, pLastCol);
|
||||||
|
@ -509,7 +509,7 @@ static int32_t reallocVarDataVal(SValue *pValue) {
|
||||||
if (nData > 0) {
|
if (nData > 0) {
|
||||||
uint8_t *p = taosMemoryMalloc(nData);
|
uint8_t *p = taosMemoryMalloc(nData);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
pValue->pData = p;
|
pValue->pData = p;
|
||||||
(void)memcpy(pValue->pData, pVal, nData);
|
(void)memcpy(pValue->pData, pVal, nData);
|
||||||
|
@ -1228,11 +1228,11 @@ static int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SArray
|
||||||
if (!remainCols) {
|
if (!remainCols) {
|
||||||
remainCols = taosArrayInit(num_keys * 2, sizeof(SIdxKey));
|
remainCols = taosArrayInit(num_keys * 2, sizeof(SIdxKey));
|
||||||
if (!remainCols) {
|
if (!remainCols) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(remainCols, &(SIdxKey){i, *key})) {
|
if (!taosArrayPush(remainCols, &(SIdxKey){i, *key})) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1396,7 +1396,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
||||||
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) {
|
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal && iCol < nCol; pColVal = tsdbRowIterNext(&iter), iCol++) {
|
||||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!COL_VAL_IS_VALUE(pColVal)) {
|
if (!COL_VAL_IS_VALUE(pColVal)) {
|
||||||
|
@ -1407,7 +1407,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
||||||
}
|
}
|
||||||
updateCtx.lflag = LFLAG_LAST;
|
updateCtx.lflag = LFLAG_LAST;
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tsdbRowClose(&iter);
|
tsdbRowClose(&iter);
|
||||||
|
@ -1433,7 +1433,7 @@ int32_t tsdbCacheRowFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, int6
|
||||||
if (COL_VAL_IS_VALUE(&colVal)) {
|
if (COL_VAL_IS_VALUE(&colVal)) {
|
||||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
code = tSimpleHashIterateRemove(iColHash, &iCol, sizeof(iCol), &pIte, &iter);
|
code = tSimpleHashIterateRemove(iColHash, &iCol, sizeof(iCol), &pIte, &iter);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -1485,7 +1485,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
||||||
.colVal = COL_VAL_VALUE(PRIMARYKEY_TIMESTAMP_COL_ID, ((SValue){.type = TSDB_DATA_TYPE_TIMESTAMP,
|
.colVal = COL_VAL_VALUE(PRIMARYKEY_TIMESTAMP_COL_ID, ((SValue){.type = TSDB_DATA_TYPE_TIMESTAMP,
|
||||||
.val = lRow.pBlockData->aTSKEY[lRow.iRow]}))};
|
.val = lRow.pBlockData->aTSKEY[lRow.iRow]}))};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1508,7 +1508,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
||||||
|
|
||||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST, .tsdbRowKey = tsdbRowKey, .colVal = colVal};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1526,7 +1526,7 @@ int32_t tsdbCacheColFormatUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, SBlo
|
||||||
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal; pColVal = tsdbRowIterNext(&iter)) {
|
for (SColVal *pColVal = tsdbRowIterNext(&iter); pColVal; pColVal = tsdbRowIterNext(&iter)) {
|
||||||
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
SLastUpdateCtx updateCtx = {.lflag = LFLAG_LAST_ROW, .tsdbRowKey = tsdbRowKey, .colVal = *pColVal};
|
||||||
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
if (!taosArrayPush(ctxArray, &updateCtx)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tsdbRowClose(&iter);
|
tsdbRowClose(&iter);
|
||||||
|
@ -1566,7 +1566,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
|
|
||||||
SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID};
|
SLastKey *key = &(SLastKey){.lflag = ltype, .uid = uid, .cid = PRIMARYKEY_TIMESTAMP_COL_ID};
|
||||||
if (!taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key})) {
|
if (!taosArrayInsert(remainCols, 0, &(SIdxKey){0, *key})) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1590,7 +1590,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
int lastrowIndex = 0;
|
int lastrowIndex = 0;
|
||||||
|
|
||||||
if (!slotIds || !lastColIds || !lastSlotIds || !lastrowColIds || !lastrowSlotIds) {
|
if (!slotIds || !lastColIds || !lastSlotIds || !lastrowColIds || !lastrowSlotIds) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < num_keys; ++i) {
|
for (int i = 0; i < num_keys; ++i) {
|
||||||
|
@ -1600,11 +1600,11 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
if (NULL == lastTmpIndexArray) {
|
if (NULL == lastTmpIndexArray) {
|
||||||
lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
||||||
if (!lastTmpIndexArray) {
|
if (!lastTmpIndexArray) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(lastTmpIndexArray, &(i))) {
|
if (!taosArrayPush(lastTmpIndexArray, &(i))) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
lastColIds[lastIndex] = idxKey->key.cid;
|
lastColIds[lastIndex] = idxKey->key.cid;
|
||||||
lastSlotIds[lastIndex] = pr->pSlotIds[idxKey->idx];
|
lastSlotIds[lastIndex] = pr->pSlotIds[idxKey->idx];
|
||||||
|
@ -1613,11 +1613,11 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
if (NULL == lastrowTmpIndexArray) {
|
if (NULL == lastrowTmpIndexArray) {
|
||||||
lastrowTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
lastrowTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
|
||||||
if (!lastrowTmpIndexArray) {
|
if (!lastrowTmpIndexArray) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(lastrowTmpIndexArray, &(i))) {
|
if (!taosArrayPush(lastrowTmpIndexArray, &(i))) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
lastrowColIds[lastrowIndex] = idxKey->key.cid;
|
lastrowColIds[lastrowIndex] = idxKey->key.cid;
|
||||||
lastrowSlotIds[lastrowIndex] = pr->pSlotIds[idxKey->idx];
|
lastrowSlotIds[lastrowIndex] = pr->pSlotIds[idxKey->idx];
|
||||||
|
@ -1627,7 +1627,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
|
|
||||||
pTmpColArray = taosArrayInit(lastIndex + lastrowIndex, sizeof(SLastCol));
|
pTmpColArray = taosArrayInit(lastIndex + lastrowIndex, sizeof(SLastCol));
|
||||||
if (!pTmpColArray) {
|
if (!pTmpColArray) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastTmpIndexArray != NULL) {
|
if (lastTmpIndexArray != NULL) {
|
||||||
|
@ -1635,7 +1635,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
for (int i = 0; i < taosArrayGetSize(lastTmpColArray); i++) {
|
for (int i = 0; i < taosArrayGetSize(lastTmpColArray); i++) {
|
||||||
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastTmpIndexArray, i),
|
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastTmpIndexArray, i),
|
||||||
taosArrayGet(lastTmpColArray, i))) {
|
taosArrayGet(lastTmpColArray, i))) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1645,7 +1645,7 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
|
||||||
for (int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
|
for (int i = 0; i < taosArrayGetSize(lastrowTmpColArray); i++) {
|
||||||
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastrowTmpIndexArray, i),
|
if (!taosArrayInsert(pTmpColArray, *(int32_t *)taosArrayGet(lastrowTmpIndexArray, i),
|
||||||
taosArrayGet(lastrowTmpColArray, i))) {
|
taosArrayGet(lastrowTmpColArray, i))) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1737,7 +1737,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
||||||
if (!keys_list || !keys_list_sizes || !key_list) {
|
if (!keys_list || !keys_list_sizes || !key_list) {
|
||||||
taosMemoryFree(keys_list);
|
taosMemoryFree(keys_list);
|
||||||
taosMemoryFree(keys_list_sizes);
|
taosMemoryFree(keys_list_sizes);
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
char **values_list = NULL;
|
char **values_list = NULL;
|
||||||
size_t *values_list_sizes = NULL;
|
size_t *values_list_sizes = NULL;
|
||||||
|
@ -1778,7 +1778,7 @@ static int32_t tsdbCacheLoadFromRocks(STsdb *pTsdb, tb_uid_t uid, SArray *pLastA
|
||||||
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
SLastCol *pTmpLastCol = taosMemoryCalloc(1, sizeof(SLastCol));
|
||||||
if (!pTmpLastCol) {
|
if (!pTmpLastCol) {
|
||||||
taosMemoryFreeClear(pToFree);
|
taosMemoryFreeClear(pToFree);
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t charge = 0;
|
size_t charge = 0;
|
||||||
|
@ -1867,7 +1867,7 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
||||||
TAOS_CHECK_GOTO(tsdbCacheReallocSLastCol(&lastCol, NULL), NULL, _exit);
|
TAOS_CHECK_GOTO(tsdbCacheReallocSLastCol(&lastCol, NULL), NULL, _exit);
|
||||||
|
|
||||||
if (taosArrayPush(pLastArray, &lastCol) == NULL) {
|
if (taosArrayPush(pLastArray, &lastCol) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1876,29 +1876,29 @@ int32_t tsdbCacheGetBatch(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCache
|
||||||
.colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)};
|
.colVal = COL_VAL_NONE(cid, pr->pSchema->columns[pr->pSlotIds[i]].type)};
|
||||||
|
|
||||||
if (taosArrayPush(pLastArray, &noneCol) == NULL) {
|
if (taosArrayPush(pLastArray, &noneCol) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!remainCols) {
|
if (!remainCols) {
|
||||||
if ((remainCols = taosArrayInit(numKeys, sizeof(SIdxKey))) == NULL) {
|
if ((remainCols = taosArrayInit(numKeys, sizeof(SIdxKey))) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!ignoreFromRocks) {
|
if (!ignoreFromRocks) {
|
||||||
if ((ignoreFromRocks = taosArrayInit(numKeys, sizeof(bool))) == NULL) {
|
if ((ignoreFromRocks = taosArrayInit(numKeys, sizeof(bool))) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (taosArrayPush(remainCols, &(SIdxKey){i, key}) == NULL) {
|
if (taosArrayPush(remainCols, &(SIdxKey){i, key}) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
bool ignoreRocks = pLastCol ? (pLastCol->cacheStatus == TSDB_LAST_CACHE_NO_CACHE) : false;
|
bool ignoreRocks = pLastCol ? (pLastCol->cacheStatus == TSDB_LAST_CACHE_NO_CACHE) : false;
|
||||||
if (taosArrayPush(ignoreFromRocks, &ignoreRocks) == NULL) {
|
if (taosArrayPush(ignoreFromRocks, &ignoreRocks) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2009,7 +2009,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
|
||||||
remainCols = taosArrayInit(numCols * 2, sizeof(SIdxKey));
|
remainCols = taosArrayInit(numCols * 2, sizeof(SIdxKey));
|
||||||
}
|
}
|
||||||
if (!taosArrayPush(remainCols, &(SIdxKey){i, lastKey})) {
|
if (!taosArrayPush(remainCols, &(SIdxKey){i, lastKey})) {
|
||||||
TAOS_CHECK_EXIT(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_CHECK_EXIT(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2201,7 +2201,7 @@ static int32_t getTableDelDataFromTbData(STbData *pTbData, SArray *aDelData) {
|
||||||
|
|
||||||
for (; pDelData; pDelData = pDelData->pNext) {
|
for (; pDelData; pDelData = pDelData->pNext) {
|
||||||
if (!taosArrayPush(aDelData, pDelData)) {
|
if (!taosArrayPush(aDelData, pDelData)) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2267,7 +2267,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
||||||
uint64_t *uidList = getUidList(pReader);
|
uint64_t *uidList = getUidList(pReader);
|
||||||
|
|
||||||
if (!uidList) {
|
if (!uidList) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0, j = 0; i < pTombBlkArray->size && j < numOfTables; ++i) {
|
for (int i = 0, j = 0; i < pTombBlkArray->size && j < numOfTables; ++i) {
|
||||||
|
@ -2345,7 +2345,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
||||||
if (pInfo->pTombData == NULL) {
|
if (pInfo->pTombData == NULL) {
|
||||||
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
||||||
if (!pInfo->pTombData) {
|
if (!pInfo->pTombData) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
finished = true;
|
finished = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2358,7 +2358,7 @@ static int32_t loadTombFromBlk(const TTombBlkArray *pTombBlkArray, SCacheRowsRea
|
||||||
|
|
||||||
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
||||||
if (!taosArrayPush(pInfo->pTombData, &delData)) {
|
if (!taosArrayPush(pInfo->pTombData, &delData)) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2571,7 +2571,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
||||||
if (!state->pIndexList) {
|
if (!state->pIndexList) {
|
||||||
state->pIndexList = taosArrayInit(1, sizeof(SBrinBlk));
|
state->pIndexList = taosArrayInit(1, sizeof(SBrinBlk));
|
||||||
if (!state->pIndexList) {
|
if (!state->pIndexList) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err);
|
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
taosArrayClear(state->pIndexList);
|
taosArrayClear(state->pIndexList);
|
||||||
|
@ -2584,7 +2584,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
|
||||||
if (state->suid >= pBrinBlk->minTbid.suid && state->suid <= pBrinBlk->maxTbid.suid) {
|
if (state->suid >= pBrinBlk->minTbid.suid && state->suid <= pBrinBlk->maxTbid.suid) {
|
||||||
if (state->uid >= pBrinBlk->minTbid.uid && state->uid <= pBrinBlk->maxTbid.uid) {
|
if (state->uid >= pBrinBlk->minTbid.uid && state->uid <= pBrinBlk->maxTbid.uid) {
|
||||||
if (!taosArrayPush(state->pIndexList, pBrinBlk)) {
|
if (!taosArrayPush(state->pIndexList, pBrinBlk)) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _err);
|
TAOS_CHECK_GOTO(terrno, &lino, _err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (state->suid > pBrinBlk->maxTbid.suid ||
|
} else if (state->suid > pBrinBlk->maxTbid.suid ||
|
||||||
|
@ -3168,7 +3168,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
|
||||||
|
|
||||||
if (!pIter->pSkyline) {
|
if (!pIter->pSkyline) {
|
||||||
pIter->pSkyline = taosArrayInit(32, sizeof(TSDBKEY));
|
pIter->pSkyline = taosArrayInit(32, sizeof(TSDBKEY));
|
||||||
TSDB_CHECK_NULL(pIter->pSkyline, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY);
|
TSDB_CHECK_NULL(pIter->pSkyline, code, lino, _err, terrno);
|
||||||
|
|
||||||
uint64_t uid = pIter->idx.uid;
|
uint64_t uid = pIter->idx.uid;
|
||||||
STableLoadInfo *pInfo = getTableLoadInfo(pIter->pr, uid);
|
STableLoadInfo *pInfo = getTableLoadInfo(pIter->pr, uid);
|
||||||
|
@ -3176,7 +3176,7 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pI
|
||||||
|
|
||||||
if (pInfo->pTombData == NULL) {
|
if (pInfo->pTombData == NULL) {
|
||||||
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
pInfo->pTombData = taosArrayInit(4, sizeof(SDelData));
|
||||||
TSDB_CHECK_NULL(pInfo->pTombData, code, lino, _err, TSDB_CODE_OUT_OF_MEMORY);
|
TSDB_CHECK_NULL(pInfo->pTombData, code, lino, _err, terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData)) {
|
if (!taosArrayAddAll(pInfo->pTombData, pIter->pMemDelData)) {
|
||||||
|
@ -3221,7 +3221,7 @@ _err:
|
||||||
static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, int16_t *slotIds, int nCols) {
|
static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray, int16_t *slotIds, int nCols) {
|
||||||
SArray *pColArray = taosArrayInit(nCols, sizeof(SLastCol));
|
SArray *pColArray = taosArrayInit(nCols, sizeof(SLastCol));
|
||||||
if (NULL == pColArray) {
|
if (NULL == pColArray) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < nCols; ++i) {
|
for (int32_t i = 0; i < nCols; ++i) {
|
||||||
|
@ -3229,7 +3229,7 @@ static int32_t initLastColArrayPartial(STSchema *pTSchema, SArray **ppColArray,
|
||||||
SLastCol col = {.rowKey.ts = 0,
|
SLastCol col = {.rowKey.ts = 0,
|
||||||
.colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)};
|
.colVal = COL_VAL_NULL(pTSchema->columns[slotId].colId, pTSchema->columns[slotId].type)};
|
||||||
if (!taosArrayPush(pColArray, &col)) {
|
if (!taosArrayPush(pColArray, &col)) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*ppColArray = pColArray;
|
*ppColArray = pColArray;
|
||||||
|
@ -3241,7 +3241,7 @@ static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) {
|
||||||
int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols;
|
int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols;
|
||||||
*ppDst = taosMemoryMalloc(len);
|
*ppDst = taosMemoryMalloc(len);
|
||||||
if (NULL == *ppDst) {
|
if (NULL == *ppDst) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
memcpy(*ppDst, pSrc, len);
|
memcpy(*ppDst, pSrc, len);
|
||||||
|
|
||||||
|
@ -3280,14 +3280,14 @@ static int32_t mergeLastCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SC
|
||||||
if (NULL == aColArray) {
|
if (NULL == aColArray) {
|
||||||
taosArrayDestroy(pColArray);
|
taosArrayDestroy(pColArray);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nCols; ++i) {
|
for (int i = 0; i < nCols; ++i) {
|
||||||
if (!taosArrayPush(aColArray, &aCols[i])) {
|
if (!taosArrayPush(aColArray, &aCols[i])) {
|
||||||
taosArrayDestroy(pColArray);
|
taosArrayDestroy(pColArray);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3457,14 +3457,14 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
|
||||||
if (NULL == aColArray) {
|
if (NULL == aColArray) {
|
||||||
taosArrayDestroy(pColArray);
|
taosArrayDestroy(pColArray);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nCols; ++i) {
|
for (int i = 0; i < nCols; ++i) {
|
||||||
if (!taosArrayPush(aColArray, &aCols[i])) {
|
if (!taosArrayPush(aColArray, &aCols[i])) {
|
||||||
taosArrayDestroy(pColArray);
|
taosArrayDestroy(pColArray);
|
||||||
|
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3697,7 +3697,7 @@ int32_t tsdbCacheSetPageS3(SLRUCache *pCache, STsdbFD *pFD, int64_t pgno, uint8_
|
||||||
_taos_lru_deleter_t deleter = deleteBCache;
|
_taos_lru_deleter_t deleter = deleteBCache;
|
||||||
uint8_t *pPg = taosMemoryMalloc(charge);
|
uint8_t *pPg = taosMemoryMalloc(charge);
|
||||||
if (!pPg) {
|
if (!pPg) {
|
||||||
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
|
TAOS_RETURN(terrno);
|
||||||
}
|
}
|
||||||
memcpy(pPg, pPage, charge);
|
memcpy(pPg, pPage, charge);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
||||||
|
|
||||||
SArray* funcTypeBlockArray = taosArrayInit(pReader->numOfCols, sizeof(int32_t));
|
SArray* funcTypeBlockArray = taosArrayInit(pReader->numOfCols, sizeof(int32_t));
|
||||||
if (funcTypeBlockArray == NULL) {
|
if (funcTypeBlockArray == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pReader->numOfCols; ++i) {
|
for (int32_t i = 0; i < pReader->numOfCols; ++i) {
|
||||||
|
@ -98,7 +98,7 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
||||||
|
|
||||||
void* px = taosArrayInsert(funcTypeBlockArray, dstSlotIds[i], pVal);
|
void* px = taosArrayInsert(funcTypeBlockArray, dstSlotIds[i], pVal);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ int32_t tsdbReuseCacherowsReader(void* reader, void* pTableIdList, int32_t numOf
|
||||||
destroySttBlockReader(pReader->pLDataIterArray, NULL);
|
destroySttBlockReader(pReader->pLDataIterArray, NULL);
|
||||||
pReader->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
pReader->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
||||||
|
|
||||||
return (pReader->pLDataIterArray != NULL) ? TSDB_CODE_SUCCESS : TSDB_CODE_OUT_OF_MEMORY;
|
return (pReader->pLDataIterArray != NULL) ? TSDB_CODE_SUCCESS : terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, int32_t numOfTables, int32_t numOfCols,
|
int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList, int32_t numOfTables, int32_t numOfCols,
|
||||||
|
@ -309,6 +309,10 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
||||||
p->rowKey.pks[0].type = pPkCol->type;
|
p->rowKey.pks[0].type = pPkCol->type;
|
||||||
if (IS_VAR_DATA_TYPE(pPkCol->type)) {
|
if (IS_VAR_DATA_TYPE(pPkCol->type)) {
|
||||||
p->rowKey.pks[0].pData = taosMemoryCalloc(1, pPkCol->bytes);
|
p->rowKey.pks[0].pData = taosMemoryCalloc(1, pPkCol->bytes);
|
||||||
|
if (p->rowKey.pks[0].pData == NULL) {
|
||||||
|
taosMemoryFree(p);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p->pkColumn = *pPkCol;
|
p->pkColumn = *pPkCol;
|
||||||
|
@ -339,12 +343,16 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
||||||
p->transferBuf[i] = taosMemoryMalloc(p->pSchema->columns[i].bytes);
|
p->transferBuf[i] = taosMemoryMalloc(p->pSchema->columns[i].bytes);
|
||||||
if (p->transferBuf[i] == NULL) {
|
if (p->transferBuf[i] == NULL) {
|
||||||
tsdbCacherowsReaderClose(p);
|
tsdbCacherowsReaderClose(p);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p->idstr = taosStrdup(idstr);
|
p->idstr = taosStrdup(idstr);
|
||||||
|
if (idstr != NULL && p->idstr == NULL) {
|
||||||
|
tsdbCacherowsReaderClose(p);
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
code = taosThreadMutexInit(&p->readerMutex, NULL);
|
code = taosThreadMutexInit(&p->readerMutex, NULL);
|
||||||
if (code) {
|
if (code) {
|
||||||
tsdbCacherowsReaderClose(p);
|
tsdbCacherowsReaderClose(p);
|
||||||
|
@ -448,7 +456,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
pr->pReadSnap = NULL;
|
pr->pReadSnap = NULL;
|
||||||
pRow = taosArrayInit(TARRAY_SIZE(pr->pCidList), sizeof(SLastCol));
|
pRow = taosArrayInit(TARRAY_SIZE(pr->pCidList), sizeof(SLastCol));
|
||||||
if (pRow == NULL) {
|
if (pRow == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +494,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_TYPE_SINGLE)) {
|
if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_TYPE_SINGLE)) {
|
||||||
SArray* pLastCols = taosArrayInit(pr->numOfCols, sizeof(SLastCol));
|
SArray* pLastCols = taosArrayInit(pr->numOfCols, sizeof(SLastCol));
|
||||||
if (pLastCols == NULL) {
|
if (pLastCols == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +504,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL};
|
SLastCol p = {.rowKey.ts = INT64_MIN, .colVal.value.type = TSDB_DATA_TYPE_BOOL, .colVal.flag = CV_FLAG_NULL};
|
||||||
void* px = taosArrayPush(pLastCols, &p);
|
void* px = taosArrayPush(pLastCols, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -529,7 +537,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
void* px = taosArrayPush(pLastCols, &p);
|
void* px = taosArrayPush(pLastCols, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -592,7 +600,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
if (TARRAY_SIZE(pTableUidList) == 0) {
|
if (TARRAY_SIZE(pTableUidList) == 0) {
|
||||||
void* px = taosArrayPush(pTableUidList, &uid);
|
void* px = taosArrayPush(pTableUidList, &uid);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -668,7 +676,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
void* px = taosArrayPush(pTableUidList, &uid);
|
void* px = taosArrayPush(pTableUidList, &uid);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _end;
|
goto _end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -439,7 +439,7 @@ static int32_t tsdbCommitInfoInit(STsdb *pTsdb) {
|
||||||
|
|
||||||
pTsdb->commitInfo->arr = taosArrayInit(0, sizeof(SFileSetCommitInfo *));
|
pTsdb->commitInfo->arr = taosArrayInit(0, sizeof(SFileSetCommitInfo *));
|
||||||
if (pTsdb->commitInfo->arr == NULL) {
|
if (pTsdb->commitInfo->arr == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
@ -457,7 +457,7 @@ static int32_t tsdbCommitInfoAdd(STsdb *tsdb, int32_t fid) {
|
||||||
SFileSetCommitInfo *tinfo;
|
SFileSetCommitInfo *tinfo;
|
||||||
|
|
||||||
if ((tinfo = taosMemoryMalloc(sizeof(*tinfo))) == NULL) {
|
if ((tinfo = taosMemoryMalloc(sizeof(*tinfo))) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
tinfo->fid = fid;
|
tinfo->fid = fid;
|
||||||
tinfo->fset = NULL;
|
tinfo->fset = NULL;
|
||||||
|
@ -465,7 +465,7 @@ static int32_t tsdbCommitInfoAdd(STsdb *tsdb, int32_t fid) {
|
||||||
TAOS_CHECK_GOTO(vHashPut(tsdb->commitInfo->ht, tinfo), &lino, _exit);
|
TAOS_CHECK_GOTO(vHashPut(tsdb->commitInfo->ht, tinfo), &lino, _exit);
|
||||||
|
|
||||||
if ((taosArrayPush(tsdb->commitInfo->arr, &tinfo)) == NULL) {
|
if ((taosArrayPush(tsdb->commitInfo->arr, &tinfo)) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
taosArraySort(tsdb->commitInfo->arr, tFileSetCommitInfoPCompare);
|
taosArraySort(tsdb->commitInfo->arr, tFileSetCommitInfoPCompare);
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ int32_t tsdbDataFileReadBrinBlk(SDataFileReader *reader, const TBrinBlkArray **b
|
||||||
if (reader->headFooter->brinBlkPtr->size > 0) {
|
if (reader->headFooter->brinBlkPtr->size > 0) {
|
||||||
data = taosMemoryMalloc(reader->headFooter->brinBlkPtr->size);
|
data = taosMemoryMalloc(reader->headFooter->brinBlkPtr->size);
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||||
|
@ -557,7 +557,7 @@ int32_t tsdbDataFileReadTombBlk(SDataFileReader *reader, const TTombBlkArray **t
|
||||||
|
|
||||||
if (reader->tombFooter->tombBlkPtr->size > 0) {
|
if (reader->tombFooter->tombBlkPtr->size > 0) {
|
||||||
if ((data = taosMemoryMalloc(reader->tombFooter->tombBlkPtr->size)) == NULL) {
|
if ((data = taosMemoryMalloc(reader->tombFooter->tombBlkPtr->size)) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||||
|
|
|
@ -72,13 +72,13 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) {
|
||||||
|
|
||||||
int32_t nt = tGetDFileSet(pData + n, &fSet);
|
int32_t nt = tGetDFileSet(pData + n, &fSet);
|
||||||
if (nt < 0) {
|
if (nt < 0) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
n += nt;
|
n += nt;
|
||||||
if (taosArrayPush(pFS->aDFileSet, &fSet) == NULL) {
|
if (taosArrayPush(pFS->aDFileSet, &fSet) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ static int32_t tsdbSaveFSToFile(STsdbFS *pFS, const char *fname) {
|
||||||
int32_t size = tsdbFSToBinary(NULL, pFS) + sizeof(TSCKSUM);
|
int32_t size = tsdbFSToBinary(NULL, pFS) + sizeof(TSCKSUM);
|
||||||
pData = taosMemoryMalloc(size);
|
pData = taosMemoryMalloc(size);
|
||||||
if (pData == NULL) {
|
if (pData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
int32_t tsize = tsdbFSToBinary(pData, pFS);
|
int32_t tsize = tsdbFSToBinary(pData, pFS);
|
||||||
|
@ -140,7 +140,7 @@ int32_t tsdbFSCreate(STsdbFS *pFS) {
|
||||||
pFS->pDelFile = NULL;
|
pFS->pDelFile = NULL;
|
||||||
pFS->aDFileSet = taosArrayInit(0, sizeof(SDFileSet));
|
pFS->aDFileSet = taosArrayInit(0, sizeof(SDFileSet));
|
||||||
if (pFS->aDFileSet == NULL) {
|
if (pFS->aDFileSet == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ static int32_t load_fs(const char *fname, STsdbFS *pFS) {
|
||||||
|
|
||||||
pData = taosMemoryMalloc(size);
|
pData = taosMemoryMalloc(size);
|
||||||
if (pData == NULL) {
|
if (pData == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
(void)taosCloseFile(&pFD);
|
(void)taosCloseFile(&pFD);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
||||||
// head
|
// head
|
||||||
pSetTo->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
pSetTo->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
||||||
if (pSetTo->pHeadF == NULL) {
|
if (pSetTo->pHeadF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetTo->pHeadF = *pSetFrom->pHeadF;
|
*pSetTo->pHeadF = *pSetFrom->pHeadF;
|
||||||
|
@ -395,7 +395,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
||||||
// data
|
// data
|
||||||
pSetTo->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
pSetTo->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
||||||
if (pSetTo->pDataF == NULL) {
|
if (pSetTo->pDataF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetTo->pDataF = *pSetFrom->pDataF;
|
*pSetTo->pDataF = *pSetFrom->pDataF;
|
||||||
|
@ -404,7 +404,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
||||||
// sma
|
// sma
|
||||||
pSetTo->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
pSetTo->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
||||||
if (pSetTo->pSmaF == NULL) {
|
if (pSetTo->pSmaF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetTo->pSmaF = *pSetFrom->pSmaF;
|
*pSetTo->pSmaF = *pSetFrom->pSmaF;
|
||||||
|
@ -414,7 +414,7 @@ static int32_t tsdbNewFileSet(STsdb *pTsdb, SDFileSet *pSetTo, SDFileSet *pSetFr
|
||||||
for (int32_t iStt = 0; iStt < pSetFrom->nSttF; iStt++) {
|
for (int32_t iStt = 0; iStt < pSetFrom->nSttF; iStt++) {
|
||||||
pSetTo->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetTo->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetTo->aSttF[iStt] == NULL) {
|
if (pSetTo->aSttF[iStt] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
if ((!sameDisk) || (pHeadF->commitID != pSetNew->pHeadF->commitID)) {
|
if ((!sameDisk) || (pHeadF->commitID != pSetNew->pHeadF->commitID)) {
|
||||||
pSetOld->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
pSetOld->pHeadF = (SHeadFile *)taosMemoryMalloc(sizeof(SHeadFile));
|
||||||
if (pSetOld->pHeadF == NULL) {
|
if (pSetOld->pHeadF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->pHeadF = *pSetNew->pHeadF;
|
*pSetOld->pHeadF = *pSetNew->pHeadF;
|
||||||
|
@ -465,7 +465,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
if ((!sameDisk) || (pDataF->commitID != pSetNew->pDataF->commitID)) {
|
if ((!sameDisk) || (pDataF->commitID != pSetNew->pDataF->commitID)) {
|
||||||
pSetOld->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
pSetOld->pDataF = (SDataFile *)taosMemoryMalloc(sizeof(SDataFile));
|
||||||
if (pSetOld->pDataF == NULL) {
|
if (pSetOld->pDataF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->pDataF = *pSetNew->pDataF;
|
*pSetOld->pDataF = *pSetNew->pDataF;
|
||||||
|
@ -486,7 +486,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
if ((!sameDisk) || (pSmaF->commitID != pSetNew->pSmaF->commitID)) {
|
if ((!sameDisk) || (pSmaF->commitID != pSetNew->pSmaF->commitID)) {
|
||||||
pSetOld->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
pSetOld->pSmaF = (SSmaFile *)taosMemoryMalloc(sizeof(SSmaFile));
|
||||||
if (pSetOld->pSmaF == NULL) {
|
if (pSetOld->pSmaF == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->pSmaF = *pSetNew->pSmaF;
|
*pSetOld->pSmaF = *pSetNew->pSmaF;
|
||||||
|
@ -507,7 +507,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
if (pSetNew->nSttF > pSetOld->nSttF) {
|
if (pSetNew->nSttF > pSetOld->nSttF) {
|
||||||
pSetOld->aSttF[pSetOld->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetOld->aSttF[pSetOld->nSttF] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetOld->aSttF[pSetOld->nSttF] == NULL) {
|
if (pSetOld->aSttF[pSetOld->nSttF] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->aSttF[pSetOld->nSttF] = *pSetNew->aSttF[pSetOld->nSttF];
|
*pSetOld->aSttF[pSetOld->nSttF] = *pSetNew->aSttF[pSetOld->nSttF];
|
||||||
|
@ -528,7 +528,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
pSetOld->nSttF = 1;
|
pSetOld->nSttF = 1;
|
||||||
pSetOld->aSttF[0] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetOld->aSttF[0] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetOld->aSttF[0] == NULL) {
|
if (pSetOld->aSttF[0] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->aSttF[0] = *pSetNew->aSttF[0];
|
*pSetOld->aSttF[0] = *pSetNew->aSttF[0];
|
||||||
|
@ -546,7 +546,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
|
|
||||||
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetOld->aSttF[iStt] == NULL) {
|
if (pSetOld->aSttF[iStt] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
*pSetOld->aSttF[iStt] = *pSetNew->aSttF[iStt];
|
*pSetOld->aSttF[iStt] = *pSetNew->aSttF[iStt];
|
||||||
|
@ -574,7 +574,7 @@ static int32_t tsdbMergeFileSet(STsdb *pTsdb, SDFileSet *pSetOld, SDFileSet *pSe
|
||||||
for (int32_t iStt = 0; iStt < pSetNew->nSttF; iStt++) {
|
for (int32_t iStt = 0; iStt < pSetNew->nSttF; iStt++) {
|
||||||
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
pSetOld->aSttF[iStt] = (SSttFile *)taosMemoryMalloc(sizeof(SSttFile));
|
||||||
if (pSetOld->aSttF[iStt] == NULL) {
|
if (pSetOld->aSttF[iStt] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
||||||
if (pDelFile == NULL || (pDelFile->commitID != pFS->pDelFile->commitID)) {
|
if (pDelFile == NULL || (pDelFile->commitID != pFS->pDelFile->commitID)) {
|
||||||
pTsdb->fs.pDelFile = (SDelFile *)taosMemoryMalloc(sizeof(SDelFile));
|
pTsdb->fs.pDelFile = (SDelFile *)taosMemoryMalloc(sizeof(SDelFile));
|
||||||
if (pTsdb->fs.pDelFile == NULL) {
|
if (pTsdb->fs.pDelFile == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,7 +668,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ static int32_t tsdbFSApplyChange(STsdb *pTsdb, STsdbFS *pFS) {
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
if (taosArrayInsert(pTsdb->fs.aDFileSet, iOld, &fSet) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ static int32_t load_json(const char *fname, cJSON **json) {
|
||||||
|
|
||||||
data = taosMemoryMalloc(size + 1);
|
data = taosMemoryMalloc(size + 1);
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(fp, data, size) < 0) {
|
if (taosReadFile(fp, data, size) < 0) {
|
||||||
|
@ -387,7 +387,7 @@ static void tsdbFSDestroyFileObjHash(STFileHash *hash);
|
||||||
|
|
||||||
static int32_t tsdbFSAddEntryToFileObjHash(STFileHash *hash, const char *fname) {
|
static int32_t tsdbFSAddEntryToFileObjHash(STFileHash *hash, const char *fname) {
|
||||||
STFileHashEntry *entry = taosMemoryMalloc(sizeof(*entry));
|
STFileHashEntry *entry = taosMemoryMalloc(sizeof(*entry));
|
||||||
if (entry == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (entry == NULL) return terrno;
|
||||||
|
|
||||||
strncpy(entry->fname, fname, TSDB_FILENAME_LEN);
|
strncpy(entry->fname, fname, TSDB_FILENAME_LEN);
|
||||||
|
|
||||||
|
@ -752,7 +752,7 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
||||||
STFileSystem *fs = pTsdb->pFS;
|
STFileSystem *fs = pTsdb->pFS;
|
||||||
SArray *channelArray = taosArrayInit(0, sizeof(SVAChannelID));
|
SArray *channelArray = taosArrayInit(0, sizeof(SVAChannelID));
|
||||||
if (channelArray == NULL) {
|
if (channelArray == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosThreadMutexLock(&pTsdb->mutex);
|
(void)taosThreadMutexLock(&pTsdb->mutex);
|
||||||
|
@ -913,7 +913,7 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
|
||||||
|
|
||||||
SMergeArg *arg = taosMemoryMalloc(sizeof(*arg));
|
SMergeArg *arg = taosMemoryMalloc(sizeof(*arg));
|
||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,7 +962,7 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
|
||||||
STFileSet *fset1;
|
STFileSet *fset1;
|
||||||
|
|
||||||
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
||||||
if (fsetArr[0] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (fsetArr[0] == NULL) return terrno;
|
||||||
|
|
||||||
TARRAY2_INIT(fsetArr[0]);
|
TARRAY2_INIT(fsetArr[0]);
|
||||||
|
|
||||||
|
@ -1058,7 +1058,7 @@ int32_t tsdbFSCreateCopyRangedSnapshot(STFileSystem *fs, TFileSetRangeArray *pRa
|
||||||
SHashObj *pHash = NULL;
|
SHashObj *pHash = NULL;
|
||||||
|
|
||||||
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
fsetArr[0] = taosMemoryMalloc(sizeof(TFileSetArray));
|
||||||
if (fsetArr == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if (fsetArr == NULL) return terrno;
|
||||||
TARRAY2_INIT(fsetArr[0]);
|
TARRAY2_INIT(fsetArr[0]);
|
||||||
|
|
||||||
if (pRanges) {
|
if (pRanges) {
|
||||||
|
|
|
@ -1051,7 +1051,9 @@ _end:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter) { (void)tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pIter); }
|
void tMergeTreeAddIter(SMergeTree *pMTree, SLDataIter *pIter) {
|
||||||
|
SRBTreeNode *node = tRBTreePut(&pMTree->rbt, (SRBTreeNode *)pIter);
|
||||||
|
}
|
||||||
|
|
||||||
bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree) { return pMTree->ignoreEarlierTs; }
|
bool tMergeTreeIgnoreEarlierTs(SMergeTree *pMTree) { return pMTree->ignoreEarlierTs; }
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,7 @@ int32_t resetDataBlockIterator(SDataBlockIter* pIter, int32_t order, bool needFr
|
||||||
if (pIter->blockList == NULL) {
|
if (pIter->blockList == NULL) {
|
||||||
pIter->blockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
pIter->blockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
||||||
if (pIter->blockList == NULL) {
|
if (pIter->blockList == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clearDataBlockIterator(pIter, needFree);
|
clearDataBlockIterator(pIter, needFree);
|
||||||
|
@ -691,7 +691,7 @@ static int32_t doLoadBlockIndex(STsdbReader* pReader, SDataFileReader* pFileRead
|
||||||
|
|
||||||
void* p1 = taosArrayPush(pIndexList, pBrinBlk);
|
void* p1 = taosArrayPush(pIndexList, pBrinBlk);
|
||||||
if (p1 == NULL) {
|
if (p1 == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
i += 1;
|
i += 1;
|
||||||
|
@ -815,7 +815,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
||||||
pScanInfo->pBlockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
pScanInfo->pBlockList = taosArrayInit(4, sizeof(SFileDataBlockInfo));
|
||||||
if (pScanInfo->pBlockList == NULL) {
|
if (pScanInfo->pBlockList == NULL) {
|
||||||
clearBrinBlockIter(&iter);
|
clearBrinBlockIter(&iter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -823,16 +823,20 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
||||||
pScanInfo->pBlockIdxList = taosArrayInit(4, sizeof(STableDataBlockIdx));
|
pScanInfo->pBlockIdxList = taosArrayInit(4, sizeof(STableDataBlockIdx));
|
||||||
if (pScanInfo->pBlockIdxList == NULL) {
|
if (pScanInfo->pBlockIdxList == NULL) {
|
||||||
clearBrinBlockIter(&iter);
|
clearBrinBlockIter(&iter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SFileDataBlockInfo blockInfo = {.tbBlockIdx = TARRAY_SIZE(pScanInfo->pBlockList)};
|
SFileDataBlockInfo blockInfo = {.tbBlockIdx = TARRAY_SIZE(pScanInfo->pBlockList)};
|
||||||
recordToBlockInfo(&blockInfo, pRecord);
|
code = recordToBlockInfo(&blockInfo, pRecord);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
clearBrinBlockIter(&iter);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
void* p1 = taosArrayPush(pScanInfo->pBlockList, &blockInfo);
|
void* p1 = taosArrayPush(pScanInfo->pBlockList, &blockInfo);
|
||||||
if (p1 == NULL) {
|
if (p1 == NULL) {
|
||||||
clearBrinBlockIter(&iter);
|
clearBrinBlockIter(&iter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo: refactor to record the fileset skey/ekey
|
// todo: refactor to record the fileset skey/ekey
|
||||||
|
@ -861,7 +865,7 @@ static int32_t loadFileBlockBrinInfo(STsdbReader* pReader, SArray* pIndexList, S
|
||||||
|
|
||||||
if (p1 == NULL) {
|
if (p1 == NULL) {
|
||||||
clearBrinBlockIter(&iter);
|
clearBrinBlockIter(&iter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2904,7 +2908,7 @@ int32_t initDelSkylineIterator(STableBlockScanInfo* pBlockScanInfo, int32_t orde
|
||||||
} else {
|
} else {
|
||||||
pBlockScanInfo->delSkyline = taosArrayInit(4, sizeof(TSDBKEY));
|
pBlockScanInfo->delSkyline = taosArrayInit(4, sizeof(TSDBKEY));
|
||||||
if (pBlockScanInfo->delSkyline == NULL) {
|
if (pBlockScanInfo->delSkyline == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3017,7 +3021,7 @@ static int32_t moveToNextFile(STsdbReader* pReader, SBlockNumber* pBlockNum, SAr
|
||||||
size_t numOfTables = tSimpleHashGetSize(pReader->status.pTableMap);
|
size_t numOfTables = tSimpleHashGetSize(pReader->status.pTableMap);
|
||||||
SArray* pIndexList = taosArrayInit(numOfTables, sizeof(SBrinBlk));
|
SArray* pIndexList = taosArrayInit(numOfTables, sizeof(SBrinBlk));
|
||||||
if (pIndexList == NULL) {
|
if (pIndexList == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -3537,7 +3541,7 @@ static int32_t initForFirstBlockInFile(STsdbReader* pReader, SDataBlockIter* pBl
|
||||||
SBlockNumber num = {0};
|
SBlockNumber num = {0};
|
||||||
SArray* pTableList = taosArrayInit(40, POINTER_BYTES);
|
SArray* pTableList = taosArrayInit(40, POINTER_BYTES);
|
||||||
if (pTableList == NULL) {
|
if (pTableList == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t code = moveToNextFile(pReader, &num, pTableList);
|
int32_t code = moveToNextFile(pReader, &num, pTableList);
|
||||||
|
@ -4931,7 +4935,7 @@ static int32_t doSuspendCurrentReader(STsdbReader* pCurrentReader) {
|
||||||
destroySttBlockReader(pStatus->pLDataIterArray, &pCost->sttCost);
|
destroySttBlockReader(pStatus->pLDataIterArray, &pCost->sttCost);
|
||||||
pStatus->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
pStatus->pLDataIterArray = taosArrayInit(4, POINTER_BYTES);
|
||||||
if (pStatus->pLDataIterArray == NULL) {
|
if (pStatus->pLDataIterArray == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
if (pBuf->pData == NULL) {
|
if (pBuf->pData == NULL) {
|
||||||
pBuf->pData = taosArrayInit(num + 1, POINTER_BYTES);
|
pBuf->pData = taosArrayInit(num + 1, POINTER_BYTES);
|
||||||
if (pBuf->pData == NULL) {
|
if (pBuf->pData == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
|
|
||||||
void* px = taosArrayPush(pBuf->pData, &p);
|
void* px = taosArrayPush(pBuf->pData, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ static int32_t initBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
}
|
}
|
||||||
void* px = taosArrayPush(pBuf->pData, &p);
|
void* px = taosArrayPush(pBuf->pData, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
|
|
||||||
void* px = taosArrayPush(pBuf->pData, &p);
|
void* px = taosArrayPush(pBuf->pData, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ int32_t ensureBlockScanInfoBuf(SBlockInfoBuf* pBuf, int32_t numOfTables) {
|
||||||
}
|
}
|
||||||
void* px = taosArrayPush(pBuf->pData, &p);
|
void* px = taosArrayPush(pBuf->pData, &p);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +559,7 @@ static int32_t fileDataBlockOrderCompar(const void* pLeft, const void* pRight, v
|
||||||
return pLeftBlock->offset > pRightBlock->offset ? 1 : -1;
|
return pLeftBlock->offset > pRightBlock->offset ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void recordToBlockInfo(SFileDataBlockInfo* pBlockInfo, SBrinRecord* record) {
|
int32_t recordToBlockInfo(SFileDataBlockInfo* pBlockInfo, SBrinRecord* record) {
|
||||||
pBlockInfo->uid = record->uid;
|
pBlockInfo->uid = record->uid;
|
||||||
pBlockInfo->firstKey = record->firstKey.key.ts;
|
pBlockInfo->firstKey = record->firstKey.key.ts;
|
||||||
pBlockInfo->lastKey = record->lastKey.key.ts;
|
pBlockInfo->lastKey = record->lastKey.key.ts;
|
||||||
|
@ -580,17 +580,24 @@ void recordToBlockInfo(SFileDataBlockInfo* pBlockInfo, SBrinRecord* record) {
|
||||||
pBlockInfo->lastPk.val = record->lastKey.key.pks[0].val;
|
pBlockInfo->lastPk.val = record->lastKey.key.pks[0].val;
|
||||||
} else {
|
} else {
|
||||||
char* p = taosMemoryCalloc(1, pFirstKey->pks[0].nData + VARSTR_HEADER_SIZE);
|
char* p = taosMemoryCalloc(1, pFirstKey->pks[0].nData + VARSTR_HEADER_SIZE);
|
||||||
|
if (p == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
memcpy(varDataVal(p), pFirstKey->pks[0].pData, pFirstKey->pks[0].nData);
|
memcpy(varDataVal(p), pFirstKey->pks[0].pData, pFirstKey->pks[0].nData);
|
||||||
varDataSetLen(p, pFirstKey->pks[0].nData);
|
varDataSetLen(p, pFirstKey->pks[0].nData);
|
||||||
pBlockInfo->firstPk.pData = (uint8_t*)p;
|
pBlockInfo->firstPk.pData = (uint8_t*)p;
|
||||||
|
|
||||||
int32_t keyLen = record->lastKey.key.pks[0].nData;
|
int32_t keyLen = record->lastKey.key.pks[0].nData;
|
||||||
p = taosMemoryCalloc(1, keyLen + VARSTR_HEADER_SIZE);
|
p = taosMemoryCalloc(1, keyLen + VARSTR_HEADER_SIZE);
|
||||||
|
if (p == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
memcpy(varDataVal(p), record->lastKey.key.pks[0].pData, keyLen);
|
memcpy(varDataVal(p), record->lastKey.key.pks[0].pData, keyLen);
|
||||||
varDataSetLen(p, keyLen);
|
varDataSetLen(p, keyLen);
|
||||||
pBlockInfo->lastPk.pData = (uint8_t*)p;
|
pBlockInfo->lastPk.pData = (uint8_t*)p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void freePkItem(void* pItem) {
|
static void freePkItem(void* pItem) {
|
||||||
|
@ -648,7 +655,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
|
||||||
char* buf = taosMemoryMalloc(sizeof(SBlockOrderWrapper) * num);
|
char* buf = taosMemoryMalloc(sizeof(SBlockOrderWrapper) * num);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
cleanupBlockOrderSupporter(&sup);
|
cleanupBlockOrderSupporter(&sup);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf;
|
sup.pDataBlockInfo[sup.numOfTables] = (SBlockOrderWrapper*)buf;
|
||||||
|
@ -679,7 +686,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
|
||||||
STableDataBlockIdx tableDataBlockIdx = {.globalIndex = i};
|
STableDataBlockIdx tableDataBlockIdx = {.globalIndex = i};
|
||||||
void* px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
|
void* px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -723,7 +730,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
|
||||||
|
|
||||||
void* px = taosArrayPush(pBlockIter->blockList, pBlockInfo);
|
void* px = taosArrayPush(pBlockIter->blockList, pBlockInfo);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
STableBlockScanInfo* pTableScanInfo = sup.pDataBlockInfo[pos][index].pInfo;
|
STableBlockScanInfo* pTableScanInfo = sup.pDataBlockInfo[pos][index].pInfo;
|
||||||
|
@ -731,7 +738,7 @@ int32_t initBlockIterator(STsdbReader* pReader, SDataBlockIter* pBlockIter, int3
|
||||||
|
|
||||||
px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
|
px = taosArrayPush(pTableScanInfo->pBlockIdxList, &tableDataBlockIdx);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set data block index overflow, in order to disable the offset comparator
|
// set data block index overflow, in order to disable the offset comparator
|
||||||
|
@ -855,7 +862,7 @@ static int32_t doCheckTombBlock(STombBlock* pBlock, STsdbReader* pReader, int32_
|
||||||
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
SDelData delData = {.version = record.version, .sKey = record.skey, .eKey = record.ekey};
|
||||||
void* px = taosArrayPush(pScanInfo->pFileDelData, &delData);
|
void* px = taosArrayPush(pScanInfo->pFileDelData, &delData);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1115,7 +1122,7 @@ int32_t doAdjustValidDataIters(SArray* pLDIterList, int32_t numOfFileObj) {
|
||||||
void* px = taosArrayPush(pLDIterList, &pIter);
|
void* px = taosArrayPush(pLDIterList, &pIter);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
taosMemoryFree(pIter);
|
taosMemoryFree(pIter);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (size > numOfFileObj) { // remove unused LDataIter
|
} else if (size > numOfFileObj) { // remove unused LDataIter
|
||||||
|
@ -1142,7 +1149,7 @@ int32_t adjustSttDataIters(SArray* pSttFileBlockIterArray, STFileSet* pFileSet)
|
||||||
}
|
}
|
||||||
void* px = taosArrayPush(pSttFileBlockIterArray, &pList);
|
void* px = taosArrayPush(pSttFileBlockIterArray, &pList);
|
||||||
if (px == NULL) {
|
if (px == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ int32_t loadSttTombDataForAll(STsdbReader* pReader, SSttFileReader* pSttFileRead
|
||||||
int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo* pBlockLoadInfo,
|
int32_t getNumOfRowsInSttBlock(SSttFileReader* pSttFileReader, SSttBlockLoadInfo* pBlockLoadInfo,
|
||||||
TStatisBlkArray* pStatisBlkArray, uint64_t suid, const uint64_t* pUidList,
|
TStatisBlkArray* pStatisBlkArray, uint64_t suid, const uint64_t* pUidList,
|
||||||
int32_t numOfTables, int32_t* pNumOfRows);
|
int32_t numOfTables, int32_t* pNumOfRows);
|
||||||
void recordToBlockInfo(SFileDataBlockInfo* pBlockInfo, SBrinRecord* record);
|
int32_t recordToBlockInfo(SFileDataBlockInfo* pBlockInfo, SBrinRecord* record);
|
||||||
|
|
||||||
void destroyLDataIter(SLDataIter* pIter);
|
void destroyLDataIter(SLDataIter* pIter);
|
||||||
int32_t adjustSttDataIters(SArray* pSttFileBlockIterArray, STFileSet* pFileSet);
|
int32_t adjustSttDataIters(SArray* pSttFileBlockIterArray, STFileSet* pFileSet);
|
||||||
|
|
|
@ -691,7 +691,7 @@ int32_t tsdbReadBlockIdx(SDataFReader *pReader, SArray *aBlockIdx) {
|
||||||
n += tGetBlockIdx(pReader->aBuf[0] + n, &blockIdx);
|
n += tGetBlockIdx(pReader->aBuf[0] + n, &blockIdx);
|
||||||
|
|
||||||
if (taosArrayPush(aBlockIdx, &blockIdx) == NULL) {
|
if (taosArrayPush(aBlockIdx, &blockIdx) == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n != size) {
|
if (n != size) {
|
||||||
|
@ -734,7 +734,7 @@ int32_t tsdbReadSttBlk(SDataFReader *pReader, int32_t iStt, SArray *aSttBlk) {
|
||||||
n += tGetSttBlk(pReader->aBuf[0] + n, &sttBlk);
|
n += tGetSttBlk(pReader->aBuf[0] + n, &sttBlk);
|
||||||
|
|
||||||
if (taosArrayPush(aSttBlk, &sttBlk) == NULL) {
|
if (taosArrayPush(aSttBlk, &sttBlk) == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (n != size) {
|
if (n != size) {
|
||||||
|
@ -866,7 +866,7 @@ int32_t tsdbReadDelDatav1(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelDa
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (taosArrayPush(aDelData, &delData) == NULL) {
|
if (taosArrayPush(aDelData, &delData) == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -908,7 +908,7 @@ int32_t tsdbReadDelIdx(SDelFReader *pReader, SArray *aDelIdx) {
|
||||||
n += tGetDelIdx(pReader->aBuf[0] + n, &delIdx);
|
n += tGetDelIdx(pReader->aBuf[0] + n, &delIdx);
|
||||||
|
|
||||||
if (taosArrayPush(aDelIdx, &delIdx) == NULL) {
|
if (taosArrayPush(aDelIdx, &delIdx) == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ static int32_t tsdbAsyncRetentionImpl(STsdb *tsdb, int64_t now, bool s3Migrate)
|
||||||
|
|
||||||
SRtnArg *arg = taosMemoryMalloc(sizeof(*arg));
|
SRtnArg *arg = taosMemoryMalloc(sizeof(*arg));
|
||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg->tsdb = tsdb;
|
arg->tsdb = tsdb;
|
||||||
|
|
|
@ -244,7 +244,7 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* reader, uint8_t** data) {
|
||||||
}
|
}
|
||||||
*data = taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
|
*data = taosMemoryMalloc(sizeof(SSnapDataHdr) + size);
|
||||||
if (*data == NULL) {
|
if (*data == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ static int32_t tsdbSnapCmprTombData(STsdbSnapReader* reader, uint8_t** data) {
|
||||||
|
|
||||||
data[0] = taosMemoryMalloc(size + sizeof(SSnapDataHdr));
|
data[0] = taosMemoryMalloc(size + sizeof(SSnapDataHdr));
|
||||||
if (data[0] == NULL) {
|
if (data[0] == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ int32_t tsdbSttFileReadStatisBlk(SSttFileReader *reader, const TStatisBlkArray *
|
||||||
int32_t size = reader->footer->statisBlkPtr->size / sizeof(SStatisBlk);
|
int32_t size = reader->footer->statisBlkPtr->size / sizeof(SStatisBlk);
|
||||||
void *data = taosMemoryMalloc(reader->footer->statisBlkPtr->size);
|
void *data = taosMemoryMalloc(reader->footer->statisBlkPtr->size);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||||
|
@ -157,7 +157,7 @@ int32_t tsdbSttFileReadTombBlk(SSttFileReader *reader, const TTombBlkArray **tom
|
||||||
int32_t size = reader->footer->tombBlkPtr->size / sizeof(STombBlk);
|
int32_t size = reader->footer->tombBlkPtr->size / sizeof(STombBlk);
|
||||||
void *data = taosMemoryMalloc(reader->footer->tombBlkPtr->size);
|
void *data = taosMemoryMalloc(reader->footer->tombBlkPtr->size);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||||
|
@ -191,7 +191,7 @@ int32_t tsdbSttFileReadSttBlk(SSttFileReader *reader, const TSttBlkArray **sttBl
|
||||||
int32_t size = reader->footer->sttBlkPtr->size / sizeof(SSttBlk);
|
int32_t size = reader->footer->sttBlkPtr->size / sizeof(SSttBlk);
|
||||||
void *data = taosMemoryMalloc(reader->footer->sttBlkPtr->size);
|
void *data = taosMemoryMalloc(reader->footer->sttBlkPtr->size);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
int32_t encryptAlgorithm = reader->config->tsdb->pVnode->config.tsdbCfg.encryptAlgorithm;
|
||||||
|
|
|
@ -56,7 +56,7 @@ static int32_t tsdbUpgradeHead(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReader *
|
||||||
|
|
||||||
// read SBlockIdx array
|
// read SBlockIdx array
|
||||||
if ((ctx->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) {
|
if ((ctx->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx))) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(tsdbReadBlockIdx(reader, ctx->aBlockIdx), &lino, _exit);
|
TAOS_CHECK_GOTO(tsdbReadBlockIdx(reader, ctx->aBlockIdx), &lino, _exit);
|
||||||
|
@ -236,7 +236,7 @@ static int32_t tsdbUpgradeSttFile(STsdb *tsdb, SDFileSet *pDFileSet, SDataFReade
|
||||||
|
|
||||||
SArray *aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
|
SArray *aSttBlk = taosArrayInit(0, sizeof(SSttBlk));
|
||||||
if (aSttBlk == NULL) {
|
if (aSttBlk == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(tsdbReadSttBlk(reader, iStt, aSttBlk), &lino, _exit);
|
TAOS_CHECK_GOTO(tsdbReadSttBlk(reader, iStt, aSttBlk), &lino, _exit);
|
||||||
|
@ -460,7 +460,7 @@ static int32_t tsdbDumpTombDataToFSet(STsdb *tsdb, SDelFReader *reader, SArray *
|
||||||
tsdbFidKeyRange(fset->fid, tsdb->keepCfg.days, tsdb->keepCfg.precision, &ctx->minKey, &ctx->maxKey);
|
tsdbFidKeyRange(fset->fid, tsdb->keepCfg.days, tsdb->keepCfg.precision, &ctx->minKey, &ctx->maxKey);
|
||||||
|
|
||||||
if ((ctx->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) {
|
if ((ctx->aDelData = taosArrayInit(0, sizeof(SDelData))) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t iDelIdx = 0; iDelIdx < taosArrayGetSize(aDelIdx); iDelIdx++) {
|
for (int32_t iDelIdx = 0; iDelIdx < taosArrayGetSize(aDelIdx); iDelIdx++) {
|
||||||
|
@ -550,7 +550,7 @@ static int32_t tsdbUpgradeTombFile(STsdb *tsdb, SDelFile *pDelFile, TFileSetArra
|
||||||
SArray *aDelIdx = NULL;
|
SArray *aDelIdx = NULL;
|
||||||
|
|
||||||
if ((aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) {
|
if ((aDelIdx = taosArrayInit(0, sizeof(SDelIdx))) == NULL) {
|
||||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit);
|
TAOS_CHECK_GOTO(terrno, &lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_CHECK_GOTO(tsdbDelFReaderOpen(&reader, pDelFile, tsdb), &lino, _exit);
|
TAOS_CHECK_GOTO(tsdbDelFReaderOpen(&reader, pDelFile, tsdb), &lino, _exit);
|
||||||
|
|
|
@ -116,7 +116,7 @@ int32_t tMapDataToArray(SMapData *pMapData, int32_t itemSize, int32_t (*tGetItem
|
||||||
|
|
||||||
SArray *pArray = taosArrayInit(pMapData->nItem, itemSize);
|
SArray *pArray = taosArrayInit(pMapData->nItem, itemSize);
|
||||||
if (pArray == NULL) {
|
if (pArray == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -679,7 +679,7 @@ int32_t vnodeAChannelInit(int64_t asyncID, SVAChannelID *channelID) {
|
||||||
// create channel object
|
// create channel object
|
||||||
SVAChannel *channel = (SVAChannel *)taosMemoryMalloc(sizeof(SVAChannel));
|
SVAChannel *channel = (SVAChannel *)taosMemoryMalloc(sizeof(SVAChannel));
|
||||||
if (channel == NULL) {
|
if (channel == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
channel->state = EVA_CHANNEL_STATE_OPEN;
|
channel->state = EVA_CHANNEL_STATE_OPEN;
|
||||||
for (int32_t i = 0; i < EVA_PRIORITY_MAX; i++) {
|
for (int32_t i = 0; i < EVA_PRIORITY_MAX; i++) {
|
||||||
|
@ -727,7 +727,7 @@ int32_t vnodeAChannelDestroy(SVAChannelID *channelID, bool waitRunning) {
|
||||||
};
|
};
|
||||||
SArray *cancelArray = taosArrayInit(0, sizeof(SVATaskCancelInfo));
|
SArray *cancelArray = taosArrayInit(0, sizeof(SVATaskCancelInfo));
|
||||||
if (cancelArray == NULL) {
|
if (cancelArray == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)taosThreadMutexLock(&async->mutex);
|
(void)taosThreadMutexLock(&async->mutex);
|
||||||
|
|
|
@ -21,7 +21,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
|
||||||
|
|
||||||
pPool = taosMemoryMalloc(sizeof(SVBufPool) + size);
|
pPool = taosMemoryMalloc(sizeof(SVBufPool) + size);
|
||||||
if (pPool == NULL) {
|
if (pPool == NULL) {
|
||||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
memset(pPool, 0, sizeof(SVBufPool));
|
memset(pPool, 0, sizeof(SVBufPool));
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ static int32_t vnodeBufPoolCreate(SVnode *pVnode, int32_t id, int64_t size, SVBu
|
||||||
pPool->lock = taosMemoryMalloc(sizeof(TdThreadSpinlock));
|
pPool->lock = taosMemoryMalloc(sizeof(TdThreadSpinlock));
|
||||||
if (!pPool->lock) {
|
if (!pPool->lock) {
|
||||||
taosMemoryFree(pPool);
|
taosMemoryFree(pPool);
|
||||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
if (taosThreadSpinInit(pPool->lock, 0) != 0) {
|
if (taosThreadSpinInit(pPool->lock, 0) != 0) {
|
||||||
taosMemoryFree((void *)pPool->lock);
|
taosMemoryFree((void *)pPool->lock);
|
||||||
|
|
|
@ -125,7 +125,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
|
||||||
}
|
}
|
||||||
SJson *pNodeRetentions = tjsonCreateArray();
|
SJson *pNodeRetentions = tjsonCreateArray();
|
||||||
if (pNodeRetentions == NULL) {
|
if (pNodeRetentions == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "retentions", pNodeRetentions));
|
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "retentions", pNodeRetentions));
|
||||||
for (int32_t i = 0; i < nRetention; ++i) {
|
for (int32_t i = 0; i < nRetention; ++i) {
|
||||||
|
@ -167,7 +167,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
|
||||||
|
|
||||||
SJson *nodeInfo = tjsonCreateArray();
|
SJson *nodeInfo = tjsonCreateArray();
|
||||||
if (nodeInfo == NULL) {
|
if (nodeInfo == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "syncCfg.nodeInfo", nodeInfo));
|
TAOS_CHECK_RETURN(tjsonAddItemToObject(pJson, "syncCfg.nodeInfo", nodeInfo));
|
||||||
vDebug("vgId:%d, encode config, replicas:%d totalReplicas:%d selfIndex:%d changeVersion:%d", pCfg->vgId,
|
vDebug("vgId:%d, encode config, replicas:%d totalReplicas:%d selfIndex:%d changeVersion:%d", pCfg->vgId,
|
||||||
|
@ -175,7 +175,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
|
||||||
for (int i = 0; i < pCfg->syncCfg.totalReplicaNum; ++i) {
|
for (int i = 0; i < pCfg->syncCfg.totalReplicaNum; ++i) {
|
||||||
SJson *info = tjsonCreateObject();
|
SJson *info = tjsonCreateObject();
|
||||||
if (info == NULL) {
|
if (info == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNodeInfo *pNode = (SNodeInfo *)&pCfg->syncCfg.nodeInfo[i];
|
SNodeInfo *pNode = (SNodeInfo *)&pCfg->syncCfg.nodeInfo[i];
|
||||||
|
|
|
@ -241,7 +241,7 @@ int vnodeLoadInfo(const char *dir, SVnodeInfo *pInfo) {
|
||||||
|
|
||||||
pData = taosMemoryMalloc(size + 1);
|
pData = taosMemoryMalloc(size + 1);
|
||||||
if (pData == NULL) {
|
if (pData == NULL) {
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosReadFile(pFile, pData, size) < 0) {
|
if (taosReadFile(pFile, pData, size) < 0) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ int32_t vHashInit(SVHashTable** ht, uint32_t (*hash)(const void*), int32_t (*com
|
||||||
|
|
||||||
(*ht) = (SVHashTable*)taosMemoryMalloc(sizeof(SVHashTable));
|
(*ht) = (SVHashTable*)taosMemoryMalloc(sizeof(SVHashTable));
|
||||||
if (*ht == NULL) {
|
if (*ht == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*ht)->hash = hash;
|
(*ht)->hash = hash;
|
||||||
|
@ -102,7 +102,7 @@ int32_t vHashPut(SVHashTable* ht, void* obj) {
|
||||||
|
|
||||||
SVHashEntry* entry = (SVHashEntry*)taosMemoryMalloc(sizeof(SVHashEntry));
|
SVHashEntry* entry = (SVHashEntry*)taosMemoryMalloc(sizeof(SVHashEntry));
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
entry->obj = obj;
|
entry->obj = obj;
|
||||||
entry->next = ht->buckets[bucketIndex];
|
entry->next = ht->buckets[bucketIndex];
|
||||||
|
|
|
@ -248,7 +248,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
cfgRsp.tagsLen = pTag->len;
|
cfgRsp.tagsLen = pTag->len;
|
||||||
cfgRsp.pTags = taosMemoryMalloc(cfgRsp.tagsLen);
|
cfgRsp.pTags = taosMemoryMalloc(cfgRsp.tagsLen);
|
||||||
if (NULL == cfgRsp.pTags) {
|
if (NULL == cfgRsp.pTags) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
(void)memcpy(cfgRsp.pTags, pTag, cfgRsp.tagsLen);
|
(void)memcpy(cfgRsp.pTags, pTag, cfgRsp.tagsLen);
|
||||||
|
@ -274,7 +274,7 @@ int32_t vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
|
||||||
cfgRsp.pSchemaExt = (SSchemaExt *)taosMemoryMalloc(cfgRsp.numOfColumns * sizeof(SSchemaExt));
|
cfgRsp.pSchemaExt = (SSchemaExt *)taosMemoryMalloc(cfgRsp.numOfColumns * sizeof(SSchemaExt));
|
||||||
|
|
||||||
if (NULL == cfgRsp.pSchemas || NULL == cfgRsp.pSchemaExt) {
|
if (NULL == cfgRsp.pSchemas || NULL == cfgRsp.pSchemaExt) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
(void)memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
|
(void)memcpy(cfgRsp.pSchemas, schema.pSchema, sizeof(SSchema) * schema.nCols);
|
||||||
|
@ -377,7 +377,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
|
|
||||||
batchRsp.pRsps = taosArrayInit(msgNum, sizeof(SBatchRspMsg));
|
batchRsp.pRsps = taosArrayInit(msgNum, sizeof(SBatchRspMsg));
|
||||||
if (NULL == batchRsp.pRsps) {
|
if (NULL == batchRsp.pRsps) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
qError("taosArrayInit %d SBatchRspMsg failed", msgNum);
|
qError("taosArrayInit %d SBatchRspMsg failed", msgNum);
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(batchRsp.pRsps, &rsp)) {
|
if (NULL == taosArrayPush(batchRsp.pRsps, &rsp)) {
|
||||||
qError("taosArrayPush failed");
|
qError("taosArrayPush failed");
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ int32_t vnodeGetAllTableList(SVnode *pVnode, uint64_t uid, SArray *list) {
|
||||||
STableKeyInfo info = {uid = id};
|
STableKeyInfo info = {uid = id};
|
||||||
if (NULL == taosArrayPush(list, &info)) {
|
if (NULL == taosArrayPush(list, &info)) {
|
||||||
qError("taosArrayPush failed");
|
qError("taosArrayPush failed");
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ int32_t vnodeGetCtbIdList(void *pVnode, int64_t suid, SArray *list) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(list, &id)) {
|
if (NULL == taosArrayPush(list, &id)) {
|
||||||
qError("taosArrayPush failed");
|
qError("taosArrayPush failed");
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,7 +621,7 @@ int32_t vnodeGetStbIdList(SVnode *pVnode, int64_t suid, SArray *list) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(list, &id)) {
|
if (NULL == taosArrayPush(list, &id)) {
|
||||||
qError("taosArrayPush failed");
|
qError("taosArrayPush failed");
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -651,7 +651,7 @@ int32_t vnodeGetStbIdListByFilter(SVnode *pVnode, int64_t suid, SArray *list, bo
|
||||||
|
|
||||||
if (NULL == taosArrayPush(list, &id)) {
|
if (NULL == taosArrayPush(list, &id)) {
|
||||||
qError("taosArrayPush failed");
|
qError("taosArrayPush failed");
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -766,7 +766,7 @@ int32_t vnodeGetTimeSeriesNum(SVnode *pVnode, int64_t *num) {
|
||||||
SArray *suidList = NULL;
|
SArray *suidList = NULL;
|
||||||
|
|
||||||
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
if (!(suidList = taosArrayInit(1, sizeof(tb_uid_t)))) {
|
||||||
return terrno = TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tbFilterSize = 0;
|
int32_t tbFilterSize = 0;
|
||||||
|
|
|
@ -281,7 +281,7 @@ int32_t vnodeSnapRead(SVSnapReader *pReader, uint8_t **ppData, uint32_t *nData)
|
||||||
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size + 1);
|
*ppData = taosMemoryMalloc(sizeof(SSnapDataHdr) + size + 1);
|
||||||
if (*ppData == NULL) {
|
if (*ppData == NULL) {
|
||||||
(void)taosCloseFile(&pFile);
|
(void)taosCloseFile(&pFile);
|
||||||
TSDB_CHECK_CODE(code = TSDB_CODE_OUT_OF_MEMORY, lino, _exit);
|
TSDB_CHECK_CODE(code = terrno, lino, _exit);
|
||||||
}
|
}
|
||||||
((SSnapDataHdr *)(*ppData))->type = SNAP_DATA_CFG;
|
((SSnapDataHdr *)(*ppData))->type = SNAP_DATA_CFG;
|
||||||
((SSnapDataHdr *)(*ppData))->size = size + 1;
|
((SSnapDataHdr *)(*ppData))->size = size + 1;
|
||||||
|
|
|
@ -180,7 +180,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
{ // find expired uids
|
{ // find expired uids
|
||||||
tbUids = taosArrayInit(8, sizeof(tb_uid_t));
|
tbUids = taosArrayInit(8, sizeof(tb_uid_t));
|
||||||
if (tbUids == NULL) {
|
if (tbUids == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ static int32_t vnodePreProcessDropTtlMsg(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
|
|
||||||
SMsgHead *pContNew = rpcMallocCont(contLenNew);
|
SMsgHead *pContNew = rpcMallocCont(contLenNew);
|
||||||
if (pContNew == NULL) {
|
if (pContNew == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1535,7 +1535,7 @@ static int32_t vnodeResetTableCxt(SMeta *pMeta, SSubmitReqConvertCxt *pCxt) {
|
||||||
pCxt->pTbData->pCreateTbReq = NULL;
|
pCxt->pTbData->pCreateTbReq = NULL;
|
||||||
pCxt->pTbData->aRowP = taosArrayInit(128, POINTER_BYTES);
|
pCxt->pTbData->aRowP = taosArrayInit(128, POINTER_BYTES);
|
||||||
if (NULL == pCxt->pTbData->aRowP) {
|
if (NULL == pCxt->pTbData->aRowP) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pCxt->pColValues);
|
taosArrayDestroy(pCxt->pColValues);
|
||||||
|
@ -1622,7 +1622,7 @@ static int32_t vnodeDecodeCreateTbReq(SSubmitReqConvertCxt *pCxt) {
|
||||||
static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pReq, SSubmitReq2 *pReq2) {
|
static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pReq, SSubmitReq2 *pReq2) {
|
||||||
pReq2->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData));
|
pReq2->aSubmitTbData = taosArrayInit(128, sizeof(SSubmitTbData));
|
||||||
if (NULL == pReq2->aSubmitTbData) {
|
if (NULL == pReq2->aSubmitTbData) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSubmitReqConvertCxt cxt = {0};
|
SSubmitReqConvertCxt cxt = {0};
|
||||||
|
@ -1650,7 +1650,7 @@ static int32_t vnodeSubmitReqConvertToSubmitReq2(SVnode *pVnode, SSubmitReq *pRe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = (NULL == taosArrayPush(pReq2->aSubmitTbData, cxt.pTbData) ? TSDB_CODE_OUT_OF_MEMORY : TSDB_CODE_SUCCESS);
|
code = (NULL == taosArrayPush(pReq2->aSubmitTbData, cxt.pTbData) ? terrno : TSDB_CODE_SUCCESS);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
taosMemoryFreeClear(cxt.pTbData);
|
taosMemoryFreeClear(cxt.pTbData);
|
||||||
|
@ -1669,7 +1669,7 @@ static int32_t vnodeRebuildSubmitReqMsg(SSubmitReq2 *pSubmitReq, void **ppMsg) {
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pMsg = taosMemoryMalloc(msglen);
|
pMsg = taosMemoryMalloc(msglen);
|
||||||
if (NULL == pMsg) {
|
if (NULL == pMsg) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -1846,7 +1846,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
||||||
if (pSubmitRsp->aCreateTbRsp == NULL &&
|
if (pSubmitRsp->aCreateTbRsp == NULL &&
|
||||||
(pSubmitRsp->aCreateTbRsp = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(SVCreateTbRsp))) ==
|
(pSubmitRsp->aCreateTbRsp = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(SVCreateTbRsp))) ==
|
||||||
NULL) {
|
NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1858,7 +1858,7 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
||||||
|
|
||||||
if (newTbUids == NULL &&
|
if (newTbUids == NULL &&
|
||||||
(newTbUids = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(int64_t))) == NULL) {
|
(newTbUids = taosArrayInit(TARRAY_SIZE(pSubmitReq->aSubmitTbData), sizeof(int64_t))) == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _exit;
|
goto _exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2237,7 +2237,7 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t ver, void *pReq, in
|
||||||
|
|
||||||
pRes->uidList = taosArrayInit(0, sizeof(tb_uid_t));
|
pRes->uidList = taosArrayInit(0, sizeof(tb_uid_t));
|
||||||
if (pRes->uidList == NULL) {
|
if (pRes->uidList == NULL) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ typedef struct {
|
||||||
SAuditCfg cfg;
|
SAuditCfg cfg;
|
||||||
SArray *records;
|
SArray *records;
|
||||||
TdThreadMutex lock;
|
TdThreadMutex lock;
|
||||||
|
int32_t dnodeId;
|
||||||
} SAudit;
|
} SAudit;
|
||||||
|
|
||||||
#endif /*_TD_AUDIT_INT_H_*/
|
#endif /*_TD_AUDIT_INT_H_*/
|
||||||
|
|
|
@ -32,10 +32,12 @@ char* tsAuditBatchUri = "/audit-batch";
|
||||||
int32_t auditInit(const SAuditCfg *pCfg) {
|
int32_t auditInit(const SAuditCfg *pCfg) {
|
||||||
tsAudit.cfg = *pCfg;
|
tsAudit.cfg = *pCfg;
|
||||||
tsAudit.records = taosArrayInit(0, sizeof(SAuditRecord *));
|
tsAudit.records = taosArrayInit(0, sizeof(SAuditRecord *));
|
||||||
if(tsAudit.records == NULL) return TSDB_CODE_OUT_OF_MEMORY;
|
if(tsAudit.records == NULL) return terrno;
|
||||||
return taosThreadMutexInit(&tsAudit.lock, NULL);
|
return taosThreadMutexInit(&tsAudit.lock, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void auditSetDnodeId(int32_t dnodeId) { tsAudit.dnodeId = dnodeId; }
|
||||||
|
|
||||||
static FORCE_INLINE void auditDeleteRecord(SAuditRecord * record) {
|
static FORCE_INLINE void auditDeleteRecord(SAuditRecord * record) {
|
||||||
if (record) {
|
if (record) {
|
||||||
taosMemoryFree(record->detail);
|
taosMemoryFree(record->detail);
|
||||||
|
|
|
@ -443,7 +443,7 @@ int32_t ctgGetTbTag(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName,
|
||||||
if (tTagIsJson(pTag)) {
|
if (tTagIsJson(pTag)) {
|
||||||
pTagVals = taosArrayInit(1, sizeof(STagVal));
|
pTagVals = taosArrayInit(1, sizeof(STagVal));
|
||||||
if (NULL == pTagVals) {
|
if (NULL == pTagVals) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* pJson = NULL;
|
char* pJson = NULL;
|
||||||
|
@ -460,7 +460,7 @@ int32_t ctgGetTbTag(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName,
|
||||||
if (NULL == taosArrayPush(pTagVals, &tagVal)) {
|
if (NULL == taosArrayPush(pTagVals, &tagVal)) {
|
||||||
taosMemoryFree(pJson);
|
taosMemoryFree(pJson);
|
||||||
taosArrayDestroy(pTagVals);
|
taosArrayDestroy(pTagVals);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTG_ERR_JRET(tTagToValArray((const STag*)pCfg->pTags, &pTagVals));
|
CTG_ERR_JRET(tTagToValArray((const STag*)pCfg->pTags, &pTagVals));
|
||||||
|
@ -938,14 +938,14 @@ int32_t catalogGetHandle(int64_t clusterId, SCatalog** catalogHandle) {
|
||||||
false, HASH_ENTRY_LOCK);
|
false, HASH_ENTRY_LOCK);
|
||||||
if (NULL == clusterCtg->dbCache) {
|
if (NULL == clusterCtg->dbCache) {
|
||||||
qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER);
|
qError("taosHashInit %d dbCache failed", CTG_DEFAULT_CACHE_DB_NUMBER);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
clusterCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum,
|
clusterCtg->userCache = taosHashInit(gCtgMgmt.cfg.maxUserCacheNum,
|
||||||
taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_ENTRY_LOCK);
|
||||||
if (NULL == clusterCtg->userCache) {
|
if (NULL == clusterCtg->userCache) {
|
||||||
qError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum);
|
qError("taosHashInit %d user cache failed", gCtgMgmt.cfg.maxUserCacheNum);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = taosHashPut(gCtgMgmt.pCluster, &clusterId, sizeof(clusterId), &clusterCtg, POINTER_BYTES);
|
code = taosHashPut(gCtgMgmt.pCluster, &clusterId, sizeof(clusterId), &clusterCtg, POINTER_BYTES);
|
||||||
|
@ -1592,7 +1592,7 @@ int32_t catalogGetExpiredViews(SCatalog* pCtg, SViewVersion** views, uint32_t* n
|
||||||
|
|
||||||
*dynViewVersion = taosMemoryMalloc(sizeof(SDynViewVersion));
|
*dynViewVersion = taosMemoryMalloc(sizeof(SDynViewVersion));
|
||||||
if (NULL == *dynViewVersion) {
|
if (NULL == *dynViewVersion) {
|
||||||
CTG_API_LEAVE(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_API_LEAVE(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*dynViewVersion)->svrBootTs = atomic_load_64(&pCtg->dynViewVer.svrBootTs);
|
(*dynViewVersion)->svrBootTs = atomic_load_64(&pCtg->dynViewVer.svrBootTs);
|
||||||
|
|
|
@ -61,7 +61,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||||
if (NULL == ctx->pName) {
|
if (NULL == ctx->pName) {
|
||||||
taosMemoryFree(task.taskCtx);
|
taosMemoryFree(task.taskCtx);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||||
|
@ -69,7 +69,7 @@ int32_t ctgInitGetTbMetaTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -97,12 +97,12 @@ int32_t ctgInitGetTbMetasTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbMetaNum,
|
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbMetaNum,
|
||||||
(int32_t)sizeof(SMetaRes));
|
(int32_t)sizeof(SMetaRes));
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
|
||||||
|
@ -130,7 +130,7 @@ int32_t ctgInitGetDbVgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -158,7 +158,7 @@ int32_t ctgInitGetDbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -186,7 +186,7 @@ int32_t ctgInitGetDbInfoTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbFName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -212,7 +212,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||||
if (NULL == ctx->pName) {
|
if (NULL == ctx->pName) {
|
||||||
taosMemoryFree(task.taskCtx);
|
taosMemoryFree(task.taskCtx);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||||
|
@ -220,7 +220,7 @@ int32_t ctgInitGetTbHashTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tableName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tableName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -248,12 +248,12 @@ int32_t ctgInitGetTbHashsTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbHashNum,
|
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbHashNum,
|
||||||
(int32_t)sizeof(SMetaRes));
|
(int32_t)sizeof(SMetaRes));
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, tbNum:%d", pJob->queryId, taskIdx,
|
||||||
|
@ -272,7 +272,7 @@ int32_t ctgInitGetQnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
||||||
|
@ -290,7 +290,7 @@ int32_t ctgInitGetDnodeTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
||||||
|
@ -317,7 +317,7 @@ int32_t ctgInitGetIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, indexFName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, indexFName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -345,7 +345,7 @@ int32_t ctgInitGetUdfTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, udfName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, udfName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -373,7 +373,7 @@ int32_t ctgInitGetUserTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, user:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, user:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -391,7 +391,7 @@ int32_t ctgInitGetSvrVerTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized", pJob->queryId, taskIdx, ctgTaskTypeStr(task.type));
|
||||||
|
@ -416,14 +416,14 @@ int32_t ctgInitGetTbIndexTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||||
if (NULL == ctx->pName) {
|
if (NULL == ctx->pName) {
|
||||||
taosMemoryFree(task.taskCtx);
|
taosMemoryFree(task.taskCtx);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -449,14 +449,14 @@ int32_t ctgInitGetTbCfgTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||||
if (NULL == ctx->pName) {
|
if (NULL == ctx->pName) {
|
||||||
taosMemoryFree(task.taskCtx);
|
taosMemoryFree(task.taskCtx);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -482,14 +482,14 @@ int32_t ctgInitGetTbTagTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
ctx->pName = taosMemoryMalloc(sizeof(*name));
|
||||||
if (NULL == ctx->pName) {
|
if (NULL == ctx->pName) {
|
||||||
taosMemoryFree(task.taskCtx);
|
taosMemoryFree(task.taskCtx);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
TAOS_MEMCPY(ctx->pName, name, sizeof(*name));
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, tbName:%s", pJob->queryId, taskIdx,
|
||||||
|
@ -517,12 +517,12 @@ int32_t ctgInitGetViewsTask(SCtgJob* pJob, int32_t taskIdx, void* param) {
|
||||||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->viewNum,
|
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->viewNum,
|
||||||
(int32_t)sizeof(SMetaRes));
|
(int32_t)sizeof(SMetaRes));
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, viewNum:%d", pJob->queryId, taskIdx,
|
qDebug("qid:0x%" PRIx64 " the %dth task type %s initialized, dbNum:%lu, viewNum:%d", pJob->queryId, taskIdx,
|
||||||
|
@ -549,12 +549,12 @@ int32_t ctgInitGetTbTSMATask(SCtgJob* pJob, int32_t taskId, void* param) {
|
||||||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbTsmaNum,
|
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tbTsmaNum,
|
||||||
(int32_t)sizeof(SMetaRes));
|
(int32_t)sizeof(SMetaRes));
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -577,12 +577,12 @@ int32_t ctgInitGetTSMATask(SCtgJob* pJob, int32_t taskId, void* param) {
|
||||||
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tsmaNum,
|
qError("qid:0x%" PRIx64 " taosArrayInit %d SMetaRes %d failed", pJob->queryId, pJob->tsmaNum,
|
||||||
(int32_t)sizeof(SMetaRes));
|
(int32_t)sizeof(SMetaRes));
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
if (NULL == taosArrayPush(pJob->pTasks, &task)) {
|
||||||
ctgFreeTask(&task, true);
|
ctgFreeTask(&task, true);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -614,7 +614,7 @@ int32_t ctgHandleForceUpdate(SCatalog* pCtg, int32_t taskNum, SCtgJob* pJob, con
|
||||||
if (NULL == pDb || NULL == pTb) {
|
if (NULL == pDb || NULL == pTb) {
|
||||||
taosHashCleanup(pDb);
|
taosHashCleanup(pDb);
|
||||||
taosHashCleanup(pTb);
|
taosHashCleanup(pTb);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pJob->dbVgNum; ++i) {
|
for (int32_t i = 0; i < pJob->dbVgNum; ++i) {
|
||||||
|
@ -865,14 +865,14 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo* pConn, SCtgJob** job, const
|
||||||
taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||||
if (NULL == pJob->pBatchs) {
|
if (NULL == pJob->pBatchs) {
|
||||||
ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM);
|
ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask));
|
pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask));
|
||||||
if (NULL == pJob->pTasks) {
|
if (NULL == pJob->pTasks) {
|
||||||
ctgError("taosArrayInit %d tasks failed", taskNum);
|
ctgError("taosArrayInit %d tasks failed", taskNum);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pReq->forceUpdate && taskNum) {
|
if (pReq->forceUpdate && taskNum) {
|
||||||
|
@ -1035,7 +1035,7 @@ int32_t ctgDumpTbMetaRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pTableMeta) {
|
if (NULL == pJob->jobRes.pTableMeta) {
|
||||||
pJob->jobRes.pTableMeta = taosArrayInit(pJob->tbMetaNum, sizeof(SMetaRes));
|
pJob->jobRes.pTableMeta = taosArrayInit(pJob->tbMetaNum, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pTableMeta) {
|
if (NULL == pJob->jobRes.pTableMeta) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1068,7 +1068,7 @@ int32_t ctgDumpDbVgRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pDbVgroup) {
|
if (NULL == pJob->jobRes.pDbVgroup) {
|
||||||
pJob->jobRes.pDbVgroup = taosArrayInit(pJob->dbVgNum, sizeof(SMetaRes));
|
pJob->jobRes.pDbVgroup = taosArrayInit(pJob->dbVgNum, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pDbVgroup) {
|
if (NULL == pJob->jobRes.pDbVgroup) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1089,7 +1089,7 @@ int32_t ctgDumpTbHashRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pTableHash) {
|
if (NULL == pJob->jobRes.pTableHash) {
|
||||||
pJob->jobRes.pTableHash = taosArrayInit(pJob->tbHashNum, sizeof(SMetaRes));
|
pJob->jobRes.pTableHash = taosArrayInit(pJob->tbHashNum, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pTableHash) {
|
if (NULL == pJob->jobRes.pTableHash) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,7 +1197,7 @@ int32_t ctgDumpIndexRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pIndex) {
|
if (NULL == pJob->jobRes.pIndex) {
|
||||||
pJob->jobRes.pIndex = taosArrayInit(pJob->indexNum, sizeof(SMetaRes));
|
pJob->jobRes.pIndex = taosArrayInit(pJob->indexNum, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pIndex) {
|
if (NULL == pJob->jobRes.pIndex) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,7 +1218,7 @@ int32_t ctgDumpQnodeRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pQnodeList) {
|
if (NULL == pJob->jobRes.pQnodeList) {
|
||||||
pJob->jobRes.pQnodeList = taosArrayInit(1, sizeof(SMetaRes));
|
pJob->jobRes.pQnodeList = taosArrayInit(1, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pQnodeList) {
|
if (NULL == pJob->jobRes.pQnodeList) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1239,7 +1239,7 @@ int32_t ctgDumpDnodeRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pDnodeList) {
|
if (NULL == pJob->jobRes.pDnodeList) {
|
||||||
pJob->jobRes.pDnodeList = taosArrayInit(1, sizeof(SMetaRes));
|
pJob->jobRes.pDnodeList = taosArrayInit(1, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pDnodeList) {
|
if (NULL == pJob->jobRes.pDnodeList) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1260,7 +1260,7 @@ int32_t ctgDumpDbCfgRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pDbCfg) {
|
if (NULL == pJob->jobRes.pDbCfg) {
|
||||||
pJob->jobRes.pDbCfg = taosArrayInit(pJob->dbCfgNum, sizeof(SMetaRes));
|
pJob->jobRes.pDbCfg = taosArrayInit(pJob->dbCfgNum, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pDbCfg) {
|
if (NULL == pJob->jobRes.pDbCfg) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1281,7 +1281,7 @@ int32_t ctgDumpDbInfoRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pDbInfo) {
|
if (NULL == pJob->jobRes.pDbInfo) {
|
||||||
pJob->jobRes.pDbInfo = taosArrayInit(pJob->dbInfoNum, sizeof(SMetaRes));
|
pJob->jobRes.pDbInfo = taosArrayInit(pJob->dbInfoNum, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pDbInfo) {
|
if (NULL == pJob->jobRes.pDbInfo) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1302,7 +1302,7 @@ int32_t ctgDumpUdfRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pUdfList) {
|
if (NULL == pJob->jobRes.pUdfList) {
|
||||||
pJob->jobRes.pUdfList = taosArrayInit(pJob->udfNum, sizeof(SMetaRes));
|
pJob->jobRes.pUdfList = taosArrayInit(pJob->udfNum, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pUdfList) {
|
if (NULL == pJob->jobRes.pUdfList) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1323,7 +1323,7 @@ int32_t ctgDumpUserRes(SCtgTask* pTask) {
|
||||||
if (NULL == pJob->jobRes.pUser) {
|
if (NULL == pJob->jobRes.pUser) {
|
||||||
pJob->jobRes.pUser = taosArrayInit(pJob->userNum, sizeof(SMetaRes));
|
pJob->jobRes.pUser = taosArrayInit(pJob->userNum, sizeof(SMetaRes));
|
||||||
if (NULL == pJob->jobRes.pUser) {
|
if (NULL == pJob->jobRes.pUser) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1909,7 +1909,7 @@ int32_t ctgHandleGetTbHashRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf
|
||||||
|
|
||||||
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
|
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
|
||||||
if (NULL == pTask->res) {
|
if (NULL == pTask->res) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pTask->pJob->conn.mgmtEps, pOut->dbVgroup, ctx->pName,
|
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pTask->pJob->conn.mgmtEps, pOut->dbVgroup, ctx->pName,
|
||||||
|
@ -2088,7 +2088,7 @@ int32_t ctgHandleGetTbTagRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
|
||||||
if (tTagIsJson(pTag)) {
|
if (tTagIsJson(pTag)) {
|
||||||
pTagVals = taosArrayInit(1, sizeof(STagVal));
|
pTagVals = taosArrayInit(1, sizeof(STagVal));
|
||||||
if (NULL == pTagVals) {
|
if (NULL == pTagVals) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* pJson = NULL;
|
char* pJson = NULL;
|
||||||
|
@ -2105,7 +2105,7 @@ int32_t ctgHandleGetTbTagRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf*
|
||||||
if (NULL == taosArrayPush(pTagVals, &tagVal)) {
|
if (NULL == taosArrayPush(pTagVals, &tagVal)) {
|
||||||
taosMemoryFree(pJson);
|
taosMemoryFree(pJson);
|
||||||
taosArrayDestroy(pTagVals);
|
taosArrayDestroy(pTagVals);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CTG_ERR_JRET(tTagToValArray((const STag*)pRsp->pTags, &pTagVals));
|
CTG_ERR_JRET(tTagToValArray((const STag*)pRsp->pTags, &pTagVals));
|
||||||
|
@ -2850,7 +2850,7 @@ int32_t ctgLaunchGetTbMetasTask(SCtgTask* pTask) {
|
||||||
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
||||||
if (NULL == pTask->msgCtxs) {
|
if (NULL == pTask->msgCtxs) {
|
||||||
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
||||||
|
@ -2953,7 +2953,7 @@ int32_t ctgLaunchGetTbHashTask(SCtgTask* pTask) {
|
||||||
if (NULL != dbCache) {
|
if (NULL != dbCache) {
|
||||||
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
|
pTask->res = taosMemoryMalloc(sizeof(SVgroupInfo));
|
||||||
if (NULL == pTask->res) {
|
if (NULL == pTask->res) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pConn->mgmtEps, dbCache->vgCache.vgInfo, pCtx->pName,
|
CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, &pConn->mgmtEps, dbCache->vgCache.vgInfo, pCtx->pName,
|
||||||
(SVgroupInfo*)pTask->res));
|
(SVgroupInfo*)pTask->res));
|
||||||
|
@ -3021,7 +3021,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
|
||||||
int32_t inc = baseResIdx - taosArrayGetSize(pCtx->pResList);
|
int32_t inc = baseResIdx - taosArrayGetSize(pCtx->pResList);
|
||||||
for (int32_t j = 0; j < inc; ++j) {
|
for (int32_t j = 0; j < inc; ++j) {
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3038,7 +3038,7 @@ int32_t ctgLaunchGetTbHashsTask(SCtgTask* pTask) {
|
||||||
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
||||||
if (NULL == pTask->msgCtxs) {
|
if (NULL == pTask->msgCtxs) {
|
||||||
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
||||||
|
@ -3507,7 +3507,7 @@ int32_t ctgLaunchGetViewsTask(SCtgTask* pTask) {
|
||||||
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
||||||
if (NULL == pTask->msgCtxs) {
|
if (NULL == pTask->msgCtxs) {
|
||||||
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
||||||
|
@ -3600,7 +3600,7 @@ int32_t ctgLaunchGetTbTSMATask(SCtgTask* pTask) {
|
||||||
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
pTask->msgCtxs = taosArrayInit_s(sizeof(SCtgMsgCtx), pCtx->fetchNum);
|
||||||
if (NULL == pTask->msgCtxs) {
|
if (NULL == pTask->msgCtxs) {
|
||||||
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
ctgError("taosArrayInit_s %d SCtgMsgCtx %d failed", pCtx->fetchNum, (int32_t)sizeof(SCtgMsgCtx));
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
for (int32_t i = 0; i < pCtx->fetchNum; ++i) {
|
||||||
|
|
|
@ -600,7 +600,7 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
|
||||||
metaSize = CTG_META_SIZE(stbMeta);
|
metaSize = CTG_META_SIZE(stbMeta);
|
||||||
*pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize);
|
*pTableMeta = taosMemoryRealloc(*pTableMeta, metaSize);
|
||||||
if (NULL == *pTableMeta) {
|
if (NULL == *pTableMeta) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_MEMCPY(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta));
|
TAOS_MEMCPY(&(*pTableMeta)->sversion, &stbMeta->sversion, metaSize - sizeof(SCTableMeta));
|
||||||
|
@ -814,7 +814,7 @@ int32_t ctgGetCachedStbNameFromSuid(SCatalog* pCtg, char* dbFName, uint64_t suid
|
||||||
|
|
||||||
*stbName = taosStrdup(stb);
|
*stbName = taosStrdup(stb);
|
||||||
if (NULL == *stbName) {
|
if (NULL == *stbName) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRelease(dbCache->stbCache, stb);
|
taosHashRelease(dbCache->stbCache, stb);
|
||||||
|
@ -956,7 +956,7 @@ int32_t ctgDropDbCacheEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId)
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDBMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropDBMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *p = strchr(dbFName, '.');
|
char *p = strchr(dbFName, '.');
|
||||||
|
@ -1032,7 +1032,7 @@ int32_t ctgDropStbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropStbMetaMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropStbMetaMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1067,7 +1067,7 @@ int32_t ctgDropTbMetaEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTblMetaMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTblMetaMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1102,7 +1102,7 @@ int32_t ctgUpdateVgroupEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateVgMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
freeVgInfo(dbInfo);
|
freeVgInfo(dbInfo);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *p = strchr(dbFName, '.');
|
char *p = strchr(dbFName, '.');
|
||||||
|
@ -1152,7 +1152,7 @@ int32_t ctgUpdateDbCfgEnqueue(SCatalog *pCtg, const char *dbFName, int64_t dbId,
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateDbCfgMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateDbCfgMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
freeDbCfgInfo(cfgInfo);
|
freeDbCfgInfo(cfgInfo);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *p = strchr(dbFName, '.');
|
char *p = strchr(dbFName, '.');
|
||||||
|
@ -1193,7 +1193,7 @@ int32_t ctgUpdateTbMetaEnqueue(SCatalog *pCtg, STableMetaOutput *output, bool sy
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbMetaMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbMetaMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *p = strchr(output->dbFName, '.');
|
char *p = strchr(output->dbFName, '.');
|
||||||
|
@ -1235,7 +1235,7 @@ int32_t ctgUpdateVgEpsetEnqueue(SCatalog *pCtg, char *dbFName, int32_t vgId, SEp
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateEpsetMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateEpsetMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1269,7 +1269,7 @@ int32_t ctgUpdateUserEnqueue(SCatalog *pCtg, SGetUserAuthRsp *pAuth, bool syncOp
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateUserMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1303,7 +1303,7 @@ int32_t ctgUpdateTbIndexEnqueue(SCatalog *pCtg, STableIndex **pIndex, bool syncO
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbIndexMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbIndexMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1339,7 +1339,7 @@ int32_t ctgDropTbIndexEnqueue(SCatalog *pCtg, SName *pName, bool syncOp) {
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbIndexMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropTbIndexMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1374,7 +1374,7 @@ int32_t ctgClearCacheEnqueue(SCatalog *pCtg, bool clearMeta, bool freeCtg, bool
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgClearCacheMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgClearCacheMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1406,7 +1406,7 @@ int32_t ctgUpdateViewMetaEnqueue(SCatalog *pCtg, SViewMetaRsp *pRsp, bool syncOp
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateViewMetaMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateViewMetaMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *p = strchr(pRsp->dbFName, '.');
|
char *p = strchr(pRsp->dbFName, '.');
|
||||||
|
@ -1450,7 +1450,7 @@ int32_t ctgDropViewMetaEnqueue(SCatalog *pCtg, const char *dbFName, uint64_t dbI
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropViewMetaMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgDropViewMetaMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1485,7 +1485,7 @@ int32_t ctgUpdateTbTSMAEnqueue(SCatalog *pCtg, STSMACache **pTsma, int32_t tsmaV
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1644,7 +1644,7 @@ int32_t ctgUpdateDbTsmaVersionEnqueue(SCatalog* pCtg, int32_t tsmaVersion, const
|
||||||
if (NULL == msg) {
|
if (NULL == msg) {
|
||||||
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
|
ctgError("malloc %d failed", (int32_t)sizeof(SCtgUpdateTbTSMAMsg));
|
||||||
taosMemoryFree(op);
|
taosMemoryFree(op);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->pCtg = pCtg;
|
msg->pCtg = pCtg;
|
||||||
|
@ -1675,28 +1675,28 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
|
||||||
true, HASH_ENTRY_LOCK);
|
true, HASH_ENTRY_LOCK);
|
||||||
if (NULL == newDBCache.tbCache) {
|
if (NULL == newDBCache.tbCache) {
|
||||||
ctgError("taosHashInit %d tbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
|
ctgError("taosHashInit %d tbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT),
|
newDBCache.stbCache = taosHashInit(gCtgMgmt.cfg.maxTblCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT),
|
||||||
true, HASH_ENTRY_LOCK);
|
true, HASH_ENTRY_LOCK);
|
||||||
if (NULL == newDBCache.stbCache) {
|
if (NULL == newDBCache.stbCache) {
|
||||||
ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
|
ctgError("taosHashInit %d stbCache failed", gCtgMgmt.cfg.maxTblCacheNum);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
newDBCache.viewCache = taosHashInit(gCtgMgmt.cfg.maxViewCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
|
newDBCache.viewCache = taosHashInit(gCtgMgmt.cfg.maxViewCacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
|
||||||
true, HASH_ENTRY_LOCK);
|
true, HASH_ENTRY_LOCK);
|
||||||
if (NULL == newDBCache.viewCache) {
|
if (NULL == newDBCache.viewCache) {
|
||||||
ctgError("taosHashInit %d viewCache failed", gCtgMgmt.cfg.maxViewCacheNum);
|
ctgError("taosHashInit %d viewCache failed", gCtgMgmt.cfg.maxViewCacheNum);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
newDBCache.tsmaCache = taosHashInit(gCtgMgmt.cfg.maxTSMACacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
|
newDBCache.tsmaCache = taosHashInit(gCtgMgmt.cfg.maxTSMACacheNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY),
|
||||||
true, HASH_ENTRY_LOCK);
|
true, HASH_ENTRY_LOCK);
|
||||||
if (!newDBCache.tsmaCache) {
|
if (!newDBCache.tsmaCache) {
|
||||||
ctgError("taosHashInit %d tsmaCache failed", gCtgMgmt.cfg.maxTSMACacheNum);
|
ctgError("taosHashInit %d tsmaCache failed", gCtgMgmt.cfg.maxTSMACacheNum);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = taosHashPut(pCtg->dbCache, dbFName, strlen(dbFName), &newDBCache, sizeof(SCtgDBCache));
|
code = taosHashPut(pCtg->dbCache, dbFName, strlen(dbFName), &newDBCache, sizeof(SCtgDBCache));
|
||||||
|
@ -1707,7 +1707,7 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName);
|
ctgError("taosHashPut db to cache failed, dbFName:%s", dbFName);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTG_CACHE_NUM_INC(CTG_CI_DB, 1);
|
CTG_CACHE_NUM_INC(CTG_CI_DB, 1);
|
||||||
|
@ -1845,7 +1845,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
|
||||||
if (taosHashPut(dbCache->tbCache, tbName, strlen(tbName), &cache, sizeof(SCtgTbCache)) != 0) {
|
if (taosHashPut(dbCache->tbCache, tbName, strlen(tbName), &cache, sizeof(SCtgTbCache)) != 0) {
|
||||||
ctgError("taosHashPut new tbCache failed, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType);
|
ctgError("taosHashPut new tbCache failed, dbFName:%s, tbName:%s, tbType:%d", dbFName, tbName, meta->tableType);
|
||||||
taosMemoryFree(meta);
|
taosMemoryFree(meta);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(meta));
|
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbMetaCacheSize(meta));
|
||||||
|
@ -1879,7 +1879,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
|
||||||
|
|
||||||
if (taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) {
|
if (taosHashPut(dbCache->stbCache, &meta->suid, sizeof(meta->suid), tbName, strlen(tbName) + 1) != 0) {
|
||||||
ctgError("taosHashPut to stable cache failed, suid:0x%" PRIx64, meta->suid);
|
ctgError("taosHashPut to stable cache failed, suid:0x%" PRIx64, meta->suid);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, sizeof(meta->suid) + strlen(tbName) + 1);
|
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, sizeof(meta->suid) + strlen(tbName) + 1);
|
||||||
|
@ -1911,7 +1911,7 @@ int32_t ctgWriteTbIndexToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNa
|
||||||
ctgFreeSTableIndex(*index);
|
ctgFreeSTableIndex(*index);
|
||||||
taosMemoryFreeClear(*index);
|
taosMemoryFreeClear(*index);
|
||||||
ctgError("taosHashPut new tbCache failed, tbName:%s", tbName);
|
ctgError("taosHashPut new tbCache failed, tbName:%s", tbName);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbIndexCacheSize(pIndex));
|
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(SCtgTbCache) + ctgGetTbIndexCacheSize(pIndex));
|
||||||
|
@ -1971,7 +1971,7 @@ int32_t ctgWriteViewMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFN
|
||||||
|
|
||||||
if (taosHashPut(dbCache->viewCache, viewName, strlen(viewName), &cache, sizeof(cache)) != 0) {
|
if (taosHashPut(dbCache->viewCache, viewName, strlen(viewName), &cache, sizeof(cache)) != 0) {
|
||||||
ctgError("taosHashPut new tbCache failed, viewName:%s", viewName);
|
ctgError("taosHashPut new tbCache failed, viewName:%s", viewName);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(viewName) + sizeof(SCtgViewCache) + ctgGetViewMetaCacheSize(pMeta));
|
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(viewName) + sizeof(SCtgViewCache) + ctgGetViewMetaCacheSize(pMeta));
|
||||||
|
@ -2101,16 +2101,16 @@ int32_t ctgWriteTbTSMAToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
|
||||||
SCtgTSMACache cache = {0};
|
SCtgTSMACache cache = {0};
|
||||||
cache.pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
|
cache.pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
|
||||||
if (NULL == cache.pTsmas) {
|
if (NULL == cache.pTsmas) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(cache.pTsmas, &pTsmaCache)) {
|
if (NULL == taosArrayPush(cache.pTsmas, &pTsmaCache)) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taosHashPut(dbCache->tsmaCache, tbName, strlen(tbName), &cache, sizeof(cache))) {
|
if (taosHashPut(dbCache->tsmaCache, tbName, strlen(tbName), &cache, sizeof(cache))) {
|
||||||
ctgError("taosHashPut new tsmacache for tb: %s.%s failed", dbFName, tbName);
|
ctgError("taosHashPut new tsmacache for tb: %s.%s failed", dbFName, tbName);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(STSMACache) + ctgGetTbTSMACacheSize(pTsmaCache));
|
(void)atomic_add_fetch_64(&dbCache->dbCacheSize, strlen(tbName) + sizeof(STSMACache) + ctgGetTbTSMACacheSize(pTsmaCache));
|
||||||
|
@ -2155,13 +2155,13 @@ int32_t ctgWriteTbTSMAToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
|
||||||
pCache->pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
|
pCache->pTsmas = taosArrayInit(4, sizeof(POINTER_BYTES));
|
||||||
if (!pCache->pTsmas) {
|
if (!pCache->pTsmas) {
|
||||||
CTG_UNLOCK(CTG_WRITE, &pCache->tsmaLock);
|
CTG_UNLOCK(CTG_WRITE, &pCache->tsmaLock);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// push the new cache
|
// push the new cache
|
||||||
if (NULL == taosArrayPush(pCache->pTsmas, &pTsmaCache)) {
|
if (NULL == taosArrayPush(pCache->pTsmas, &pTsmaCache)) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = terrno;
|
||||||
} else {
|
} else {
|
||||||
*ppTsmaCache = NULL;
|
*ppTsmaCache = NULL;
|
||||||
|
|
||||||
|
@ -2437,7 +2437,7 @@ int32_t ctgOpUpdateTbMeta(SCtgCacheOperation *operation) {
|
||||||
if (CTG_IS_META_CTABLE(pMeta->metaType) || CTG_IS_META_BOTH(pMeta->metaType)) {
|
if (CTG_IS_META_CTABLE(pMeta->metaType) || CTG_IS_META_BOTH(pMeta->metaType)) {
|
||||||
SCTableMeta *ctbMeta = taosMemoryMalloc(sizeof(SCTableMeta));
|
SCTableMeta *ctbMeta = taosMemoryMalloc(sizeof(SCTableMeta));
|
||||||
if (NULL == ctbMeta) {
|
if (NULL == ctbMeta) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
TAOS_MEMCPY(ctbMeta, &pMeta->ctbMeta, sizeof(SCTableMeta));
|
TAOS_MEMCPY(ctbMeta, &pMeta->ctbMeta, sizeof(SCTableMeta));
|
||||||
CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->ctbName,
|
CTG_ERR_JRET(ctgWriteTbMetaToCache(pCtg, dbCache, pMeta->dbFName, pMeta->dbId, pMeta->ctbName,
|
||||||
|
@ -2590,7 +2590,7 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) {
|
||||||
|
|
||||||
if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) {
|
if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) {
|
||||||
ctgError("taosHashPut user %s to cache failed", msg->userAuth.user);
|
ctgError("taosHashPut user %s to cache failed", msg->userAuth.user);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFreeClear(msg);
|
taosMemoryFreeClear(msg);
|
||||||
|
@ -3423,7 +3423,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
for (int32_t i = 0; i < tbNum; ++i) {
|
for (int32_t i = 0; i < tbNum; ++i) {
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3442,7 +3442,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName);
|
ctgDebug("tb %s not in cache, dbFName:%s", pName->tname, dbFName);
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTG_META_NHIT_INC();
|
CTG_META_NHIT_INC();
|
||||||
|
@ -3459,7 +3459,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
|
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTG_META_NHIT_INC();
|
CTG_META_NHIT_INC();
|
||||||
|
@ -3508,7 +3508,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
|
|
||||||
res.pRes = pTableMeta;
|
res.pRes = pTableMeta;
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -3533,7 +3533,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
|
|
||||||
res.pRes = pTableMeta;
|
res.pRes = pTableMeta;
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -3559,7 +3559,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName);
|
ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", pTableMeta->suid, dbFName);
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
taosMemoryFreeClear(pTableMeta);
|
taosMemoryFreeClear(pTableMeta);
|
||||||
|
|
||||||
|
@ -3574,7 +3574,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
|
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
taosMemoryFreeClear(pTableMeta);
|
taosMemoryFreeClear(pTableMeta);
|
||||||
|
|
||||||
|
@ -3593,7 +3593,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
|
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFreeClear(pTableMeta);
|
taosMemoryFreeClear(pTableMeta);
|
||||||
|
@ -3612,7 +3612,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
|
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFreeClear(pTableMeta);
|
taosMemoryFreeClear(pTableMeta);
|
||||||
|
@ -3629,7 +3629,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
pTableMeta = taosMemoryRealloc(pTableMeta, metaSize + schemaExtSize);
|
pTableMeta = taosMemoryRealloc(pTableMeta, metaSize + schemaExtSize);
|
||||||
if (NULL == pTableMeta) {
|
if (NULL == pTableMeta) {
|
||||||
ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
|
ctgReleaseTbMetaToCache(pCtg, dbCache, pCache);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_MEMCPY(&pTableMeta->sversion, &stbMeta->sversion, metaSize + schemaExtSize - sizeof(SCTableMeta));
|
TAOS_MEMCPY(&pTableMeta->sversion, &stbMeta->sversion, metaSize + schemaExtSize - sizeof(SCTableMeta));
|
||||||
|
@ -3646,7 +3646,7 @@ int32_t ctgGetTbMetasFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgTbMe
|
||||||
|
|
||||||
res.pRes = pTableMeta;
|
res.pRes = pTableMeta;
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastSuid = pTableMeta->suid;
|
lastSuid = pTableMeta->suid;
|
||||||
|
@ -3759,7 +3759,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
||||||
for (int32_t i = 0; i < tbNum; ++i) {
|
for (int32_t i = 0; i < tbNum; ++i) {
|
||||||
CTG_ERR_RET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_RET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaData){0})) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3778,7 +3778,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
||||||
ctgDebug("view %s not in cache, dbFName:%s", pName->tname, dbFName);
|
ctgDebug("view %s not in cache, dbFName:%s", pName->tname, dbFName);
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
|
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
|
||||||
|
|
||||||
|
@ -3792,7 +3792,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
||||||
ctgDebug("view %s meta not in cache, dbFName:%s", pName->tname, dbFName);
|
ctgDebug("view %s meta not in cache, dbFName:%s", pName->tname, dbFName);
|
||||||
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
CTG_ERR_JRET(ctgAddFetch(&ctx->pFetchs, dbIdx, i, fetchIdx, baseResIdx + i, flag));
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(ctx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
|
CTG_CACHE_NHIT_INC(CTG_CI_VIEW, 1);
|
||||||
|
|
||||||
|
@ -3824,7 +3824,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
||||||
ctgReleaseViewMetaToCache(pCtg, dbCache, pCache);
|
ctgReleaseViewMetaToCache(pCtg, dbCache, pCache);
|
||||||
ctgFreeSViewMeta(pViewMeta);
|
ctgFreeSViewMeta(pViewMeta);
|
||||||
taosMemoryFree(pViewMeta);
|
taosMemoryFree(pViewMeta);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
TAOS_MEMCPY(pViewMeta->pSchema, pCache->pMeta->pSchema, pViewMeta->numOfCols * sizeof(SSchema));
|
TAOS_MEMCPY(pViewMeta->pSchema, pCache->pMeta->pSchema, pViewMeta->numOfCols * sizeof(SSchema));
|
||||||
|
|
||||||
|
@ -3835,7 +3835,7 @@ int32_t ctgGetViewsFromCache(SCatalog *pCtg, SRequestConnInfo *pConn, SCtgViewsC
|
||||||
|
|
||||||
res.pRes = pViewMeta;
|
res.pRes = pViewMeta;
|
||||||
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
if (NULL == taosArrayPush(ctx->pResList, &res)) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3875,7 +3875,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
for (int32_t i = 0; i < tbNum; ++i) {
|
for (int32_t i = 0; i < tbNum; ++i) {
|
||||||
CTG_ERR_RET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
CTG_ERR_RET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaData){0})) {
|
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaData){0})) {
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3895,7 +3895,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname);
|
ctgDebug("tb: %s.%s not in cache", dbFName, pName->tname);
|
||||||
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -3908,7 +3908,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
|
|
||||||
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosHashRelease(dbCache->tbCache, pTbCache);
|
taosHashRelease(dbCache->tbCache, pTbCache);
|
||||||
|
@ -3933,7 +3933,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
|
|
||||||
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TSMA_SOURCE_TB_META, NULL));
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -3945,7 +3945,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
if (!pCache || !pCache->pTsmas || pCache->pTsmas->size == 0) {
|
if (!pCache || !pCache->pTsmas || pCache->pTsmas->size == 0) {
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||||
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -3960,7 +3960,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
|
|
||||||
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TB_TSMA, &tsmaSourceTbName));
|
CTG_ERR_JRET(ctgAddTSMAFetch(&pCtx->pFetches, dbIdx, i, fetchIdx, baseResIdx + i, flag, FETCH_TB_TSMA, &tsmaSourceTbName));
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
if (NULL == taosArrayPush(pCtx->pResList, &(SMetaRes){0})) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTG_CACHE_NHIT_INC(CTG_CI_TBL_TSMA, 1);
|
CTG_CACHE_NHIT_INC(CTG_CI_TBL_TSMA, 1);
|
||||||
|
@ -3979,7 +3979,7 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
if (!pRsp->pTsmas) {
|
if (!pRsp->pTsmas) {
|
||||||
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
||||||
taosMemoryFreeClear(pRsp);
|
taosMemoryFreeClear(pRsp);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMetaRes res = {0};
|
SMetaRes res = {0};
|
||||||
|
@ -3998,14 +3998,14 @@ int32_t ctgGetTbTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, int32_t dbIdx
|
||||||
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
ctgReleaseTSMAToCache(pCtg, dbCache, pCache);
|
||||||
tFreeTableTSMAInfoRsp(pRsp);
|
tFreeTableTSMAInfoRsp(pRsp);
|
||||||
taosMemoryFreeClear(pRsp);
|
taosMemoryFreeClear(pRsp);
|
||||||
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_RET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.pRes = pRsp;
|
res.pRes = pRsp;
|
||||||
CTG_UNLOCK(CTG_READ, &pCache->tsmaLock);
|
CTG_UNLOCK(CTG_READ, &pCache->tsmaLock);
|
||||||
taosHashRelease(dbCache->tsmaCache, pCache);
|
taosHashRelease(dbCache->tsmaCache, pCache);
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4075,16 +4075,16 @@ int32_t ctgGetTSMAFromCache(SCatalog* pCtg, SCtgTbTSMACtx* pCtx, SName* pTsmaNam
|
||||||
pRsp->pTsmas = taosArrayInit(1, POINTER_BYTES);
|
pRsp->pTsmas = taosArrayInit(1, POINTER_BYTES);
|
||||||
if (!pRsp->pTsmas) {
|
if (!pRsp->pTsmas) {
|
||||||
tFreeAndClearTableTSMAInfo(pTsmaOut);
|
tFreeAndClearTableTSMAInfo(pTsmaOut);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pRsp->pTsmas, &pTsmaOut)) {
|
if (NULL == taosArrayPush(pRsp->pTsmas, &pTsmaOut)) {
|
||||||
tFreeAndClearTableTSMAInfo(pTsmaOut);
|
tFreeAndClearTableTSMAInfo(pTsmaOut);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
if (NULL == taosArrayPush(pCtx->pResList, &res)) {
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,13 +52,13 @@ int32_t ctgMetaRentAdd(SCtgRentMgmt *mgmt, void *meta, int64_t id, int32_t size)
|
||||||
if (NULL == slot->meta) {
|
if (NULL == slot->meta) {
|
||||||
qError("taosArrayInit %d failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx,
|
qError("taosArrayInit %d failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", CTG_DEFAULT_RENT_SLOT_SIZE, id, widx,
|
||||||
mgmt->type);
|
mgmt->type);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == taosArrayPush(slot->meta, meta)) {
|
if (NULL == taosArrayPush(slot->meta, meta)) {
|
||||||
qError("taosArrayPush meta to rent failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
|
qError("taosArrayPush meta to rent failed, id:0x%" PRIx64 ", slot idx:%d, type:%d", id, widx, mgmt->type);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
mgmt->rentCacheSize += size;
|
mgmt->rentCacheSize += size;
|
||||||
|
@ -181,7 +181,7 @@ int32_t ctgMetaRentGetImpl(SCtgRentMgmt *mgmt, void **res, uint32_t *num, int32_
|
||||||
*res = taosMemoryMalloc(msize);
|
*res = taosMemoryMalloc(msize);
|
||||||
if (NULL == *res) {
|
if (NULL == *res) {
|
||||||
qError("malloc %d failed", (int32_t)msize);
|
qError("malloc %d failed", (int32_t)msize);
|
||||||
CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY);
|
CTG_ERR_JRET(terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *meta = taosArrayGet(slot->meta, 0);
|
void *meta = taosArrayGet(slot->meta, 0);
|
||||||
|
|
|
@ -2833,11 +2833,13 @@ void printDataBlock(SSDataBlock* pBlock, const char* flag, const char* taskIdStr
|
||||||
qDebug("%s===stream===%s: Block is Empty. block type %d", taskIdStr, flag, pBlock->info.type);
|
qDebug("%s===stream===%s: Block is Empty. block type %d", taskIdStr, flag, pBlock->info.type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char* pBuf = NULL;
|
if (qDebugFlag & DEBUG_DEBUG) {
|
||||||
int32_t code = dumpBlockData(pBlock, flag, &pBuf, taskIdStr);
|
char* pBuf = NULL;
|
||||||
if (code == 0) {
|
int32_t code = dumpBlockData(pBlock, flag, &pBuf, taskIdStr);
|
||||||
qDebug("%s", pBuf);
|
if (code == 0) {
|
||||||
taosMemoryFree(pBuf);
|
qDebug("%s", pBuf);
|
||||||
|
taosMemoryFree(pBuf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -314,6 +314,8 @@ static int32_t doCreateConstantValColumnInfo(SInputColumnInfoData* pInput, SFunc
|
||||||
}
|
}
|
||||||
} else if (type == TSDB_DATA_TYPE_VARCHAR || type == TSDB_DATA_TYPE_GEOMETRY) {
|
} else if (type == TSDB_DATA_TYPE_VARCHAR || type == TSDB_DATA_TYPE_GEOMETRY) {
|
||||||
char* tmp = taosMemoryMalloc(pFuncParam->param.nLen + VARSTR_HEADER_SIZE);
|
char* tmp = taosMemoryMalloc(pFuncParam->param.nLen + VARSTR_HEADER_SIZE);
|
||||||
|
QUERY_CHECK_NULL(tmp, code, lino, _end, terrno);
|
||||||
|
|
||||||
STR_WITH_SIZE_TO_VARSTR(tmp, pFuncParam->param.pz, pFuncParam->param.nLen);
|
STR_WITH_SIZE_TO_VARSTR(tmp, pFuncParam->param.pz, pFuncParam->param.nLen);
|
||||||
for (int32_t i = 0; i < numOfRows; ++i) {
|
for (int32_t i = 0; i < numOfRows; ++i) {
|
||||||
code = colDataSetVal(pColInfo, i, tmp, false);
|
code = colDataSetVal(pColInfo, i, tmp, false);
|
||||||
|
|
|
@ -1555,7 +1555,7 @@ static void destroyStreamPartitionOperatorInfo(void* param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr,
|
int32_t initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pParSup, SExprSupp* pExpr,
|
||||||
SExprSupp* pTbnameExpr) {
|
SExprSupp* pTbnameExpr, SExprSupp* pResExprSupp, int32_t* pPkColIndex) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SStorageAPI* pAPI = &downstream->pTaskInfo->storageAPI;
|
SStorageAPI* pAPI = &downstream->pTaskInfo->storageAPI;
|
||||||
|
@ -1568,6 +1568,11 @@ int32_t initParDownStream(SOperatorInfo* downstream, SPartitionBySupporter* pPar
|
||||||
pScanInfo->partitionSup = *pParSup;
|
pScanInfo->partitionSup = *pParSup;
|
||||||
pScanInfo->pPartScalarSup = pExpr;
|
pScanInfo->pPartScalarSup = pExpr;
|
||||||
pScanInfo->pPartTbnameSup = pTbnameExpr;
|
pScanInfo->pPartTbnameSup = pTbnameExpr;
|
||||||
|
for (int32_t j = 0; j < pResExprSupp->numOfExprs; j++) {
|
||||||
|
if (pScanInfo->primaryKeyIndex == pResExprSupp->pExprInfo[j].base.pParam[0].pCol->slotId) {
|
||||||
|
*pPkColIndex = j;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!pScanInfo->pUpdateInfo) {
|
if (!pScanInfo->pUpdateInfo) {
|
||||||
code = pAPI->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0, pScanInfo->igCheckUpdate,
|
code = pAPI->stateStore.updateInfoInit(60000, TSDB_TIME_PRECISION_MILLI, 0, pScanInfo->igCheckUpdate,
|
||||||
pScanInfo->pkColType, pScanInfo->pkColLen, &pScanInfo->pUpdateInfo);
|
pScanInfo->pkColType, pScanInfo->pkColLen, &pScanInfo->pUpdateInfo);
|
||||||
|
@ -1729,7 +1734,8 @@ int32_t createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPart
|
||||||
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
|
||||||
setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState);
|
setOperatorStreamStateFn(pOperator, streamOpReleaseState, streamOpReloadState);
|
||||||
|
|
||||||
code = initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup, &pInfo->tbnameCalSup);
|
pInfo->basic.primaryPkIndex = -1;
|
||||||
|
code = initParDownStream(downstream, &pInfo->partitionSup, &pInfo->scalarSup, &pInfo->tbnameCalSup, &pOperator->exprSupp, &pInfo->basic.primaryPkIndex);
|
||||||
QUERY_CHECK_CODE(code, lino, _error);
|
QUERY_CHECK_CODE(code, lino, _error);
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
|
|
@ -4078,6 +4078,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode*
|
||||||
|
|
||||||
SDataType pkType = {0};
|
SDataType pkType = {0};
|
||||||
pInfo->primaryKeyIndex = -1;
|
pInfo->primaryKeyIndex = -1;
|
||||||
|
pInfo->basic.primaryPkIndex = -1;
|
||||||
int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList);
|
int32_t numOfOutput = taosArrayGetSize(pInfo->matchInfo.pList);
|
||||||
pColIds = taosArrayInit(numOfOutput, sizeof(int16_t));
|
pColIds = taosArrayInit(numOfOutput, sizeof(int16_t));
|
||||||
QUERY_CHECK_NULL(pColIds, code, lino, _error, terrno);
|
QUERY_CHECK_NULL(pColIds, code, lino, _error, terrno);
|
||||||
|
@ -4095,6 +4096,7 @@ int32_t createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNode*
|
||||||
}
|
}
|
||||||
if (id->isPk) {
|
if (id->isPk) {
|
||||||
pInfo->primaryKeyIndex = id->dstSlotId;
|
pInfo->primaryKeyIndex = id->dstSlotId;
|
||||||
|
pInfo->basic.primaryPkIndex = id->dstSlotId;
|
||||||
pkType = id->dataType;
|
pkType = id->dataType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -541,14 +541,21 @@ void reloadFromDownStream(SOperatorInfo* downstream, SStreamIntervalOperatorInfo
|
||||||
pInfo->pUpdateInfo = pScanInfo->pUpdateInfo;
|
pInfo->pUpdateInfo = pScanInfo->pUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SStreamIntervalOperatorInfo* pInfo) {
|
bool hasSrcPrimaryKeyCol(SSteamOpBasicInfo* pInfo) { return pInfo->primaryPkIndex != -1; }
|
||||||
|
|
||||||
|
int32_t initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SStreamIntervalOperatorInfo* pInfo, struct SSteamOpBasicInfo* pBasic) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
int32_t lino = 0;
|
int32_t lino = 0;
|
||||||
SStateStore* pAPI = &downstream->pTaskInfo->storageAPI.stateStore;
|
SStateStore* pAPI = &downstream->pTaskInfo->storageAPI.stateStore;
|
||||||
SExecTaskInfo* pTaskInfo = downstream->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = downstream->pTaskInfo;
|
||||||
|
|
||||||
|
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) {
|
||||||
|
SStreamPartitionOperatorInfo* pScanInfo = downstream->info;
|
||||||
|
pBasic->primaryPkIndex = pScanInfo->basic.primaryPkIndex;
|
||||||
|
}
|
||||||
|
|
||||||
if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
||||||
return initIntervalDownStream(downstream->pDownstream[0], type, pInfo);
|
return initIntervalDownStream(downstream->pDownstream[0], type, pInfo, pBasic);
|
||||||
}
|
}
|
||||||
|
|
||||||
SStreamScanInfo* pScanInfo = downstream->info;
|
SStreamScanInfo* pScanInfo = downstream->info;
|
||||||
|
@ -564,7 +571,9 @@ int32_t initIntervalDownStream(SOperatorInfo* downstream, uint16_t type, SStream
|
||||||
pScanInfo->twAggSup = pInfo->twAggSup;
|
pScanInfo->twAggSup = pInfo->twAggSup;
|
||||||
pScanInfo->pState = pInfo->pState;
|
pScanInfo->pState = pInfo->pState;
|
||||||
pInfo->pUpdateInfo = pScanInfo->pUpdateInfo;
|
pInfo->pUpdateInfo = pScanInfo->pUpdateInfo;
|
||||||
pInfo->basic.primaryPkIndex = pScanInfo->primaryKeyIndex;
|
if (!hasSrcPrimaryKeyCol(pBasic)) {
|
||||||
|
pBasic->primaryPkIndex = pScanInfo->basic.primaryPkIndex;
|
||||||
|
}
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -1013,8 +1022,6 @@ static int32_t getNextQualifiedFinalWindow(SInterval* pInterval, STimeWindow* pN
|
||||||
return startPos;
|
return startPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasSrcPrimaryKeyCol(SSteamOpBasicInfo* pInfo) { return pInfo->primaryPkIndex != -1; }
|
|
||||||
|
|
||||||
static int32_t doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, uint64_t groupId,
|
static int32_t doStreamIntervalAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBlock, uint64_t groupId,
|
||||||
SSHashObj* pUpdatedMap, SSHashObj* pDeletedMap) {
|
SSHashObj* pUpdatedMap, SSHashObj* pDeletedMap) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
@ -2036,7 +2043,8 @@ int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiN
|
||||||
setOperatorStreamStateFn(pOperator, streamIntervalReleaseState, streamIntervalReloadState);
|
setOperatorStreamStateFn(pOperator, streamIntervalReleaseState, streamIntervalReloadState);
|
||||||
if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL ||
|
if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL ||
|
||||||
pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) {
|
pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL) {
|
||||||
code = initIntervalDownStream(downstream, pPhyNode->type, pInfo);
|
pInfo->basic.primaryPkIndex = -1;
|
||||||
|
code = initIntervalDownStream(downstream, pPhyNode->type, pInfo, &pInfo->basic);
|
||||||
QUERY_CHECK_CODE(code, lino, _error);
|
QUERY_CHECK_CODE(code, lino, _error);
|
||||||
}
|
}
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
@ -2140,6 +2148,7 @@ int32_t initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup,
|
||||||
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) {
|
if (downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION) {
|
||||||
SStreamPartitionOperatorInfo* pScanInfo = downstream->info;
|
SStreamPartitionOperatorInfo* pScanInfo = downstream->info;
|
||||||
pScanInfo->tsColIndex = tsColIndex;
|
pScanInfo->tsColIndex = tsColIndex;
|
||||||
|
pBasic->primaryPkIndex = pScanInfo->basic.primaryPkIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
if (downstream->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
||||||
|
@ -2157,7 +2166,9 @@ int32_t initDownStream(SOperatorInfo* downstream, SStreamAggSupporter* pAggSup,
|
||||||
}
|
}
|
||||||
pScanInfo->twAggSup = *pTwSup;
|
pScanInfo->twAggSup = *pTwSup;
|
||||||
pAggSup->pUpdateInfo = pScanInfo->pUpdateInfo;
|
pAggSup->pUpdateInfo = pScanInfo->pUpdateInfo;
|
||||||
pBasic->primaryPkIndex = pScanInfo->primaryKeyIndex;
|
if (!hasSrcPrimaryKeyCol(pBasic)) {
|
||||||
|
pBasic->primaryPkIndex = pScanInfo->basic.primaryPkIndex;
|
||||||
|
}
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -3218,7 +3229,7 @@ int32_t doStreamSessionEncodeOpState(void** buf, int32_t len, SOperatorInfo* pOp
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
int32_t iter = 0;
|
int32_t iter = 0;
|
||||||
while ((pIte = tSimpleHashIterate(pInfo->streamAggSup.pResultRows, pIte, &iter)) != NULL) {
|
while ((pIte = tSimpleHashIterate(pInfo->streamAggSup.pResultRows, pIte, &iter)) != NULL) {
|
||||||
void* key = taosHashGetKey(pIte, &keyLen);
|
void* key = tSimpleHashGetKey(pIte, &keyLen);
|
||||||
tlen += encodeSSessionKey(buf, key);
|
tlen += encodeSSessionKey(buf, key);
|
||||||
tlen += encodeSResultWindowInfo(buf, pIte, pInfo->streamAggSup.resultRowSize);
|
tlen += encodeSResultWindowInfo(buf, pIte, pInfo->streamAggSup.resultRowSize);
|
||||||
}
|
}
|
||||||
|
@ -3866,6 +3877,7 @@ int32_t createStreamSessionAggOperatorInfo(SOperatorInfo* downstream, SPhysiNode
|
||||||
setOperatorStreamStateFn(pOperator, streamSessionReleaseState, streamSessionReloadState);
|
setOperatorStreamStateFn(pOperator, streamSessionReleaseState, streamSessionReloadState);
|
||||||
|
|
||||||
if (downstream) {
|
if (downstream) {
|
||||||
|
pInfo->basic.primaryPkIndex = -1;
|
||||||
code = initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex,
|
code = initDownStream(downstream, &pInfo->streamAggSup, pOperator->operatorType, pInfo->primaryTsIndex,
|
||||||
&pInfo->twAggSup, &pInfo->basic);
|
&pInfo->twAggSup, &pInfo->basic);
|
||||||
QUERY_CHECK_CODE(code, lino, _error);
|
QUERY_CHECK_CODE(code, lino, _error);
|
||||||
|
@ -5377,7 +5389,8 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
|
||||||
taosMemoryFree(buff);
|
taosMemoryFree(buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
code = initIntervalDownStream(downstream, pPhyNode->type, pInfo);
|
pInfo->basic.primaryPkIndex = -1;
|
||||||
|
code = initIntervalDownStream(downstream, pPhyNode->type, pInfo, &pInfo->basic);
|
||||||
QUERY_CHECK_CODE(code, lino, _error);
|
QUERY_CHECK_CODE(code, lino, _error);
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
|
|
|
@ -238,11 +238,14 @@ static int32_t doAddNewBucket(SLHashObj* pHashObj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SLHashBucket* pBucket = taosMemoryCalloc(1, sizeof(SLHashBucket));
|
SLHashBucket* pBucket = taosMemoryCalloc(1, sizeof(SLHashBucket));
|
||||||
|
if (pBucket == NULL) {
|
||||||
|
return terrno;
|
||||||
|
}
|
||||||
pHashObj->pBucket[pHashObj->numOfBuckets] = pBucket;
|
pHashObj->pBucket[pHashObj->numOfBuckets] = pBucket;
|
||||||
|
|
||||||
pBucket->pPageIdList = taosArrayInit(2, sizeof(int32_t));
|
pBucket->pPageIdList = taosArrayInit(2, sizeof(int32_t));
|
||||||
if (pBucket->pPageIdList == NULL) {
|
if (pBucket->pPageIdList == NULL) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t pageId = -1;
|
int32_t pageId = -1;
|
||||||
|
@ -281,13 +284,14 @@ SLHashObj* tHashInit(int32_t inMemPages, int32_t pageSize, _hash_fn_t fn, int32_
|
||||||
|
|
||||||
int32_t code = createDiskbasedBuf(&pHashObj->pBuf, pageSize, inMemPages * pageSize, "", tsTempDir);
|
int32_t code = createDiskbasedBuf(&pHashObj->pBuf, pageSize, inMemPages * pageSize, "", tsTempDir);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
taosMemoryFree(pHashObj);
|
goto _error;
|
||||||
terrno = code;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable compress when flushing to disk
|
// disable compress when flushing to disk
|
||||||
setBufPageCompressOnDisk(pHashObj->pBuf, false);
|
code = setBufPageCompressOnDisk(pHashObj->pBuf, false);
|
||||||
|
if (code != 0) {
|
||||||
|
goto _error;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The number of bits in the hash value, which is used to decide the exact bucket where the object should be located
|
* The number of bits in the hash value, which is used to decide the exact bucket where the object should be located
|
||||||
|
@ -299,16 +303,32 @@ SLHashObj* tHashInit(int32_t inMemPages, int32_t pageSize, _hash_fn_t fn, int32_
|
||||||
|
|
||||||
pHashObj->numOfAlloc = 4; // initial allocated array list
|
pHashObj->numOfAlloc = 4; // initial allocated array list
|
||||||
pHashObj->pBucket = taosMemoryCalloc(pHashObj->numOfAlloc, POINTER_BYTES);
|
pHashObj->pBucket = taosMemoryCalloc(pHashObj->numOfAlloc, POINTER_BYTES);
|
||||||
|
if (pHashObj->pBucket == NULL) {
|
||||||
|
code = terrno;
|
||||||
|
goto _error;
|
||||||
|
}
|
||||||
|
|
||||||
code = doAddNewBucket(pHashObj);
|
code = doAddNewBucket(pHashObj);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
destroyDiskbasedBuf(pHashObj->pBuf);
|
goto _error;
|
||||||
taosMemoryFreeClear(pHashObj);
|
|
||||||
terrno = code;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return pHashObj;
|
return pHashObj;
|
||||||
|
|
||||||
|
_error:
|
||||||
|
if (pHashObj->pBuf) {
|
||||||
|
destroyDiskbasedBuf(pHashObj->pBuf);
|
||||||
|
}
|
||||||
|
if (pHashObj->pBucket) {
|
||||||
|
for (int32_t i = 0; i < pHashObj->numOfBuckets; ++i) {
|
||||||
|
taosArrayDestroy(pHashObj->pBucket[i]->pPageIdList);
|
||||||
|
taosMemoryFree(pHashObj->pBucket[i]);
|
||||||
|
}
|
||||||
|
taosMemoryFree(pHashObj->pBucket);
|
||||||
|
}
|
||||||
|
taosMemoryFree(pHashObj);
|
||||||
|
terrno = code;
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* tHashCleanup(SLHashObj* pHashObj) {
|
void* tHashCleanup(SLHashObj* pHashObj) {
|
||||||
|
|
|
@ -3902,8 +3902,7 @@ int32_t doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSD
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
SVariant val = {0};
|
SVariant val = {0};
|
||||||
// TODO(smj) : this func need err code
|
TAOS_CHECK_RETURN(taosVariantCreateFromBinary(&val, pData, tDataTypes[type].bytes, type));
|
||||||
taosVariantCreateFromBinary(&val, pData, tDataTypes[type].bytes, type);
|
|
||||||
|
|
||||||
STopBotResItem* pItems = pRes->pItems;
|
STopBotResItem* pItems = pRes->pItems;
|
||||||
|
|
||||||
|
|
|
@ -1091,7 +1091,7 @@ int32_t acquireUdfFuncHandle(char *udfName, UdfcFuncHandle *pHandle) {
|
||||||
taosArrayRemove(gUdfcProxy.udfStubs, stubIndex);
|
taosArrayRemove(gUdfcProxy.udfStubs, stubIndex);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fnInfo("udf handle expired for %s, will setup udf. move it to expired list", udfName);
|
fnDebug("udf handle expired for %s, will setup udf. move it to expired list", udfName);
|
||||||
if (taosArrayPush(gUdfcProxy.expiredUdfStubs, foundStub) == NULL) {
|
if (taosArrayPush(gUdfcProxy.expiredUdfStubs, foundStub) == NULL) {
|
||||||
fnError("acquireUdfFuncHandle: failed to push udf stub to array");
|
fnError("acquireUdfFuncHandle: failed to push udf stub to array");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1718,7 +1718,7 @@ int32_t udfcQueueUvTask(SClientUvTaskNode *uvTask) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uv_sem_wait(&uvTask->taskSem);
|
uv_sem_wait(&uvTask->taskSem);
|
||||||
fnInfo("udfc uvTask finished. uvTask:%" PRId64 "-%d-%p", uvTask->seqNum, uvTask->type, uvTask);
|
fnDebug("udfc uvTask finished. uvTask:%" PRId64 "-%d-%p", uvTask->seqNum, uvTask->type, uvTask);
|
||||||
uv_sem_destroy(&uvTask->taskSem);
|
uv_sem_destroy(&uvTask->taskSem);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|