Merge branch 'main' into fix/liaohj
This commit is contained in:
commit
564e9bb833
|
@ -0,0 +1,47 @@
|
||||||
|
# 贡献者契约行为准则
|
||||||
|
|
||||||
|
[](code_of_conduct.md)
|
||||||
|
|
||||||
|
## 我们的承诺
|
||||||
|
|
||||||
|
为了营造一个开放和热情的环境,作为贡献者和维护者,我们承诺让每个人参与我们的项目和社区成为一种无骚扰的体验,无论年龄、体型、残疾、种族、性别特征、性别认同和表达、经验水平、教育、社会经济地位、国籍、个人外表、种族、宗教或性认同和取向如何。
|
||||||
|
|
||||||
|
## 我们的标准
|
||||||
|
|
||||||
|
有助于创造积极环境的行为示例包括:
|
||||||
|
|
||||||
|
- 使用热情和包容的语言
|
||||||
|
- 尊重不同的观点和经历
|
||||||
|
- 优雅地接受建设性的批评
|
||||||
|
- 专注于对社区最有利的事情
|
||||||
|
- 对其他社区成员表示同情
|
||||||
|
|
||||||
|
参与者不可接受的行为示例包括:
|
||||||
|
|
||||||
|
- 使用性感的语言或图像以及不受欢迎的性关注或进步
|
||||||
|
- 拖钓、侮辱/贬损评论以及人身或政治攻击
|
||||||
|
- 公共或私人骚扰
|
||||||
|
- 未经明确许可发布他人的私人信息,例如物理地址或电子地址
|
||||||
|
- 在专业环境中可能被合理认为不适当的其他行为
|
||||||
|
|
||||||
|
## 我们的责任
|
||||||
|
|
||||||
|
项目维护人员负责阐明可接受行为的标准,并期望针对任何不可接受行为的情况采取适当和公平的纠正措施。
|
||||||
|
|
||||||
|
项目维护者有权利和责任删除、编辑或拒绝评论、提交、代码、wiki 编辑、问题和其他不符合本行为准则的贡献,或暂时或永久禁止任何贡献者从事他们认为不适当、威胁、冒犯或有害的其他行为。
|
||||||
|
|
||||||
|
## 范围
|
||||||
|
|
||||||
|
本行为准则适用于所有项目空间,也适用于个人在公共场所代表项目或其社区时。 代表项目或社区的示例包括使用官方项目电子邮件地址、通过官方社交媒体帐户发布信息或在在线或离线活动中担任指定代表。 项目的表示可以由项目维护者进一步定义和澄清。
|
||||||
|
|
||||||
|
## 执法
|
||||||
|
|
||||||
|
可以通过 support@taosdata.com 联系项目团队来报告辱骂、骚扰或其他不可接受的行为。 所有投诉都将被审查和调查,并将产生被认为必要且适合具体情况的回应。 项目团队有义务对事件的报告者保密。 具体执行政策的更多细节可能会单独发布。
|
||||||
|
|
||||||
|
不善意遵守或执行行为准则的项目维护者可能会面临由项目领导的其他成员确定的临时或永久影响。
|
||||||
|
|
||||||
|
## 来源
|
||||||
|
|
||||||
|
本行为准则改编自贡献者公约 1.4 版,可在 https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 获取
|
||||||
|
|
||||||
|
有关此行为准则的常见问题的答案,请参阅 https://www.contributor-covenant.org/faq
|
|
@ -313,7 +313,8 @@ def pre_test_build_win() {
|
||||||
bat '''
|
bat '''
|
||||||
cd %WIN_CONNECTOR_ROOT%
|
cd %WIN_CONNECTOR_ROOT%
|
||||||
python.exe -m pip install --upgrade pip
|
python.exe -m pip install --upgrade pip
|
||||||
python -m pip install .
|
python -m pip uninstall taospy -y
|
||||||
|
python -m pip install taospy==2.7.6
|
||||||
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
|
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
|
||||||
'''
|
'''
|
||||||
return 1
|
return 1
|
||||||
|
@ -331,8 +332,6 @@ def run_win_test() {
|
||||||
bat '''
|
bat '''
|
||||||
echo "windows test ..."
|
echo "windows test ..."
|
||||||
cd %WIN_CONNECTOR_ROOT%
|
cd %WIN_CONNECTOR_ROOT%
|
||||||
python.exe -m pip install --upgrade pip
|
|
||||||
python -m pip install .
|
|
||||||
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
|
xcopy /e/y/i/f %WIN_INTERNAL_ROOT%\\debug\\build\\lib\\taos.dll C:\\Windows\\System32
|
||||||
ls -l C:\\Windows\\System32\\taos.dll
|
ls -l C:\\Windows\\System32\\taos.dll
|
||||||
time /t
|
time /t
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
IF (DEFINED VERNUMBER)
|
IF (DEFINED VERNUMBER)
|
||||||
SET(TD_VER_NUMBER ${VERNUMBER})
|
SET(TD_VER_NUMBER ${VERNUMBER})
|
||||||
ELSE ()
|
ELSE ()
|
||||||
SET(TD_VER_NUMBER "3.0.2.6")
|
SET(TD_VER_NUMBER "3.0.3.0")
|
||||||
ENDIF ()
|
ENDIF ()
|
||||||
|
|
||||||
IF (DEFINED VERCOMPATIBLE)
|
IF (DEFINED VERCOMPATIBLE)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taosadapter
|
# taosadapter
|
||||||
ExternalProject_Add(taosadapter
|
ExternalProject_Add(taosadapter
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||||
GIT_TAG 7920f98
|
GIT_TAG d8059ff
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# taos-tools
|
# taos-tools
|
||||||
ExternalProject_Add(taos-tools
|
ExternalProject_Add(taos-tools
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||||
GIT_TAG 0111c66
|
GIT_TAG 41affde
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -32,7 +32,7 @@ Python 连接器的源码托管在 [GitHub](https://github.com/taosdata/taos-con
|
||||||
|
|
||||||
### 准备
|
### 准备
|
||||||
|
|
||||||
1. 安装 Python。新近版本 taospy 包要求 Python 3.6+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。
|
1. 安装 Python。新近版本 taospy 包要求 Python 3.6.2+。早期版本 taospy 包要求 Python 3.7+。taos-ws-py 包要求 Python 3.7+。如果系统上还没有 Python 可参考 [Python BeginnersGuide](https://wiki.python.org/moin/BeginnersGuide/Download) 安装。
|
||||||
2. 安装 [pip](https://pypi.org/project/pip/)。大部分情况下 Python 的安装包都自带了 pip 工具, 如果没有请参考 [pip documentation](https://pip.pypa.io/en/stable/installation/) 安装。
|
2. 安装 [pip](https://pypi.org/project/pip/)。大部分情况下 Python 的安装包都自带了 pip 工具, 如果没有请参考 [pip documentation](https://pip.pypa.io/en/stable/installation/) 安装。
|
||||||
3. 如果使用原生连接,还需[安装客户端驱动](../#安装客户端驱动)。客户端软件包含了 TDengine 客户端动态链接库(libtaos.so 或 taos.dll) 和 TDengine CLI。
|
3. 如果使用原生连接,还需[安装客户端驱动](../#安装客户端驱动)。客户端软件包含了 TDengine 客户端动态链接库(libtaos.so 或 taos.dll) 和 TDengine CLI。
|
||||||
|
|
||||||
|
|
|
@ -612,6 +612,7 @@ typedef struct {
|
||||||
char user[TSDB_USER_LEN];
|
char user[TSDB_USER_LEN];
|
||||||
char passwd[TSDB_PASSWORD_LEN];
|
char passwd[TSDB_PASSWORD_LEN];
|
||||||
int64_t startTime;
|
int64_t startTime;
|
||||||
|
char sVer[TSDB_VERSION_LEN];
|
||||||
} SConnectReq;
|
} SConnectReq;
|
||||||
|
|
||||||
int32_t tSerializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq);
|
int32_t tSerializeSConnectReq(void* buf, int32_t bufLen, SConnectReq* pReq);
|
||||||
|
@ -844,6 +845,7 @@ typedef struct {
|
||||||
int8_t cacheLast;
|
int8_t cacheLast;
|
||||||
int8_t replications;
|
int8_t replications;
|
||||||
int32_t sstTrigger;
|
int32_t sstTrigger;
|
||||||
|
int32_t minRows;
|
||||||
} SAlterDbReq;
|
} SAlterDbReq;
|
||||||
|
|
||||||
int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq);
|
int32_t tSerializeSAlterDbReq(void* buf, int32_t bufLen, SAlterDbReq* pReq);
|
||||||
|
@ -1031,7 +1033,8 @@ int32_t tDeserializeSUserAuthBatchRsp(void* buf, int32_t bufLen, SUserAuthBatchR
|
||||||
void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp);
|
void tFreeSUserAuthBatchRsp(SUserAuthBatchRsp* pRsp);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char db[TSDB_DB_FNAME_LEN];
|
char db[TSDB_DB_FNAME_LEN];
|
||||||
|
STimeWindow timeRange;
|
||||||
} SCompactDbReq;
|
} SCompactDbReq;
|
||||||
|
|
||||||
int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq);
|
int32_t tSerializeSCompactDbReq(void* buf, int32_t bufLen, SCompactDbReq* pReq);
|
||||||
|
@ -1290,9 +1293,10 @@ int32_t tSerializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq);
|
||||||
int32_t tDeserializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq);
|
int32_t tDeserializeSDropIdxReq(void* buf, int32_t bufLen, SDropIndexReq* pReq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int64_t dbUid;
|
int64_t dbUid;
|
||||||
char db[TSDB_DB_FNAME_LEN];
|
char db[TSDB_DB_FNAME_LEN];
|
||||||
int64_t compactStartTime;
|
int64_t compactStartTime;
|
||||||
|
STimeWindow tw;
|
||||||
} SCompactVnodeReq;
|
} SCompactVnodeReq;
|
||||||
|
|
||||||
int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq);
|
int32_t tSerializeSCompactVnodeReq(void* buf, int32_t bufLen, SCompactVnodeReq* pReq);
|
||||||
|
@ -1313,6 +1317,9 @@ typedef struct {
|
||||||
int8_t strict;
|
int8_t strict;
|
||||||
int8_t cacheLast;
|
int8_t cacheLast;
|
||||||
int64_t reserved[8];
|
int64_t reserved[8];
|
||||||
|
// 1st modification
|
||||||
|
int16_t sttTrigger;
|
||||||
|
int32_t minRows;
|
||||||
} SAlterVnodeConfigReq;
|
} SAlterVnodeConfigReq;
|
||||||
|
|
||||||
int32_t tSerializeSAlterVnodeConfigReq(void* buf, int32_t bufLen, SAlterVnodeConfigReq* pReq);
|
int32_t tSerializeSAlterVnodeConfigReq(void* buf, int32_t bufLen, SAlterVnodeConfigReq* pReq);
|
||||||
|
|
|
@ -110,168 +110,168 @@
|
||||||
#define TK_TABLE_SUFFIX 92
|
#define TK_TABLE_SUFFIX 92
|
||||||
#define TK_NK_COLON 93
|
#define TK_NK_COLON 93
|
||||||
#define TK_MAX_SPEED 94
|
#define TK_MAX_SPEED 94
|
||||||
#define TK_TABLE 95
|
#define TK_START 95
|
||||||
#define TK_NK_LP 96
|
#define TK_WITH 96
|
||||||
#define TK_NK_RP 97
|
#define TK_TIMESTAMP 97
|
||||||
#define TK_STABLE 98
|
#define TK_END 98
|
||||||
#define TK_ADD 99
|
#define TK_TABLE 99
|
||||||
#define TK_COLUMN 100
|
#define TK_NK_LP 100
|
||||||
#define TK_MODIFY 101
|
#define TK_NK_RP 101
|
||||||
#define TK_RENAME 102
|
#define TK_STABLE 102
|
||||||
#define TK_TAG 103
|
#define TK_ADD 103
|
||||||
#define TK_SET 104
|
#define TK_COLUMN 104
|
||||||
#define TK_NK_EQ 105
|
#define TK_MODIFY 105
|
||||||
#define TK_USING 106
|
#define TK_RENAME 106
|
||||||
#define TK_TAGS 107
|
#define TK_TAG 107
|
||||||
#define TK_COMMENT 108
|
#define TK_SET 108
|
||||||
#define TK_BOOL 109
|
#define TK_NK_EQ 109
|
||||||
#define TK_TINYINT 110
|
#define TK_USING 110
|
||||||
#define TK_SMALLINT 111
|
#define TK_TAGS 111
|
||||||
#define TK_INT 112
|
#define TK_COMMENT 112
|
||||||
#define TK_INTEGER 113
|
#define TK_BOOL 113
|
||||||
#define TK_BIGINT 114
|
#define TK_TINYINT 114
|
||||||
#define TK_FLOAT 115
|
#define TK_SMALLINT 115
|
||||||
#define TK_DOUBLE 116
|
#define TK_INT 116
|
||||||
#define TK_BINARY 117
|
#define TK_INTEGER 117
|
||||||
#define TK_TIMESTAMP 118
|
#define TK_BIGINT 118
|
||||||
#define TK_NCHAR 119
|
#define TK_FLOAT 119
|
||||||
#define TK_UNSIGNED 120
|
#define TK_DOUBLE 120
|
||||||
#define TK_JSON 121
|
#define TK_BINARY 121
|
||||||
#define TK_VARCHAR 122
|
#define TK_NCHAR 122
|
||||||
#define TK_MEDIUMBLOB 123
|
#define TK_UNSIGNED 123
|
||||||
#define TK_BLOB 124
|
#define TK_JSON 124
|
||||||
#define TK_VARBINARY 125
|
#define TK_VARCHAR 125
|
||||||
#define TK_DECIMAL 126
|
#define TK_MEDIUMBLOB 126
|
||||||
#define TK_MAX_DELAY 127
|
#define TK_BLOB 127
|
||||||
#define TK_WATERMARK 128
|
#define TK_VARBINARY 128
|
||||||
#define TK_ROLLUP 129
|
#define TK_DECIMAL 129
|
||||||
#define TK_TTL 130
|
#define TK_MAX_DELAY 130
|
||||||
#define TK_SMA 131
|
#define TK_WATERMARK 131
|
||||||
#define TK_DELETE_MARK 132
|
#define TK_ROLLUP 132
|
||||||
#define TK_FIRST 133
|
#define TK_TTL 133
|
||||||
#define TK_LAST 134
|
#define TK_SMA 134
|
||||||
#define TK_SHOW 135
|
#define TK_DELETE_MARK 135
|
||||||
#define TK_PRIVILEGES 136
|
#define TK_FIRST 136
|
||||||
#define TK_DATABASES 137
|
#define TK_LAST 137
|
||||||
#define TK_TABLES 138
|
#define TK_SHOW 138
|
||||||
#define TK_STABLES 139
|
#define TK_PRIVILEGES 139
|
||||||
#define TK_MNODES 140
|
#define TK_DATABASES 140
|
||||||
#define TK_QNODES 141
|
#define TK_TABLES 141
|
||||||
#define TK_FUNCTIONS 142
|
#define TK_STABLES 142
|
||||||
#define TK_INDEXES 143
|
#define TK_MNODES 143
|
||||||
#define TK_ACCOUNTS 144
|
#define TK_QNODES 144
|
||||||
#define TK_APPS 145
|
#define TK_FUNCTIONS 145
|
||||||
#define TK_CONNECTIONS 146
|
#define TK_INDEXES 146
|
||||||
#define TK_LICENCES 147
|
#define TK_ACCOUNTS 147
|
||||||
#define TK_GRANTS 148
|
#define TK_APPS 148
|
||||||
#define TK_QUERIES 149
|
#define TK_CONNECTIONS 149
|
||||||
#define TK_SCORES 150
|
#define TK_LICENCES 150
|
||||||
#define TK_TOPICS 151
|
#define TK_GRANTS 151
|
||||||
#define TK_VARIABLES 152
|
#define TK_QUERIES 152
|
||||||
#define TK_CLUSTER 153
|
#define TK_SCORES 153
|
||||||
#define TK_BNODES 154
|
#define TK_TOPICS 154
|
||||||
#define TK_SNODES 155
|
#define TK_VARIABLES 155
|
||||||
#define TK_TRANSACTIONS 156
|
#define TK_CLUSTER 156
|
||||||
#define TK_DISTRIBUTED 157
|
#define TK_BNODES 157
|
||||||
#define TK_CONSUMERS 158
|
#define TK_SNODES 158
|
||||||
#define TK_SUBSCRIPTIONS 159
|
#define TK_TRANSACTIONS 159
|
||||||
#define TK_VNODES 160
|
#define TK_DISTRIBUTED 160
|
||||||
#define TK_ALIVE 161
|
#define TK_CONSUMERS 161
|
||||||
#define TK_LIKE 162
|
#define TK_SUBSCRIPTIONS 162
|
||||||
#define TK_TBNAME 163
|
#define TK_VNODES 163
|
||||||
#define TK_QTAGS 164
|
#define TK_ALIVE 164
|
||||||
#define TK_AS 165
|
#define TK_LIKE 165
|
||||||
#define TK_INDEX 166
|
#define TK_TBNAME 166
|
||||||
#define TK_FUNCTION 167
|
#define TK_QTAGS 167
|
||||||
#define TK_INTERVAL 168
|
#define TK_AS 168
|
||||||
#define TK_COUNT 169
|
#define TK_INDEX 169
|
||||||
#define TK_LAST_ROW 170
|
#define TK_FUNCTION 170
|
||||||
#define TK_TOPIC 171
|
#define TK_INTERVAL 171
|
||||||
#define TK_WITH 172
|
#define TK_COUNT 172
|
||||||
#define TK_META 173
|
#define TK_LAST_ROW 173
|
||||||
#define TK_CONSUMER 174
|
#define TK_TOPIC 174
|
||||||
#define TK_GROUP 175
|
#define TK_META 175
|
||||||
#define TK_DESC 176
|
#define TK_CONSUMER 176
|
||||||
#define TK_DESCRIBE 177
|
#define TK_GROUP 177
|
||||||
#define TK_RESET 178
|
#define TK_DESC 178
|
||||||
#define TK_QUERY 179
|
#define TK_DESCRIBE 179
|
||||||
#define TK_CACHE 180
|
#define TK_RESET 180
|
||||||
#define TK_EXPLAIN 181
|
#define TK_QUERY 181
|
||||||
#define TK_ANALYZE 182
|
#define TK_CACHE 182
|
||||||
#define TK_VERBOSE 183
|
#define TK_EXPLAIN 183
|
||||||
#define TK_NK_BOOL 184
|
#define TK_ANALYZE 184
|
||||||
#define TK_RATIO 185
|
#define TK_VERBOSE 185
|
||||||
#define TK_NK_FLOAT 186
|
#define TK_NK_BOOL 186
|
||||||
#define TK_OUTPUTTYPE 187
|
#define TK_RATIO 187
|
||||||
#define TK_AGGREGATE 188
|
#define TK_NK_FLOAT 188
|
||||||
#define TK_BUFSIZE 189
|
#define TK_OUTPUTTYPE 189
|
||||||
#define TK_STREAM 190
|
#define TK_AGGREGATE 190
|
||||||
#define TK_INTO 191
|
#define TK_BUFSIZE 191
|
||||||
#define TK_TRIGGER 192
|
#define TK_STREAM 192
|
||||||
#define TK_AT_ONCE 193
|
#define TK_INTO 193
|
||||||
#define TK_WINDOW_CLOSE 194
|
#define TK_TRIGGER 194
|
||||||
#define TK_IGNORE 195
|
#define TK_AT_ONCE 195
|
||||||
#define TK_EXPIRED 196
|
#define TK_WINDOW_CLOSE 196
|
||||||
#define TK_FILL_HISTORY 197
|
#define TK_IGNORE 197
|
||||||
#define TK_UPDATE 198
|
#define TK_EXPIRED 198
|
||||||
#define TK_SUBTABLE 199
|
#define TK_FILL_HISTORY 199
|
||||||
#define TK_KILL 200
|
#define TK_UPDATE 200
|
||||||
#define TK_CONNECTION 201
|
#define TK_SUBTABLE 201
|
||||||
#define TK_TRANSACTION 202
|
#define TK_KILL 202
|
||||||
#define TK_BALANCE 203
|
#define TK_CONNECTION 203
|
||||||
#define TK_VGROUP 204
|
#define TK_TRANSACTION 204
|
||||||
#define TK_MERGE 205
|
#define TK_BALANCE 205
|
||||||
#define TK_REDISTRIBUTE 206
|
#define TK_VGROUP 206
|
||||||
#define TK_SPLIT 207
|
#define TK_MERGE 207
|
||||||
#define TK_DELETE 208
|
#define TK_REDISTRIBUTE 208
|
||||||
#define TK_INSERT 209
|
#define TK_SPLIT 209
|
||||||
#define TK_NULL 210
|
#define TK_DELETE 210
|
||||||
#define TK_NK_QUESTION 211
|
#define TK_INSERT 211
|
||||||
#define TK_NK_ARROW 212
|
#define TK_NULL 212
|
||||||
#define TK_ROWTS 213
|
#define TK_NK_QUESTION 213
|
||||||
#define TK_QSTART 214
|
#define TK_NK_ARROW 214
|
||||||
#define TK_QEND 215
|
#define TK_ROWTS 215
|
||||||
#define TK_QDURATION 216
|
#define TK_QSTART 216
|
||||||
#define TK_WSTART 217
|
#define TK_QEND 217
|
||||||
#define TK_WEND 218
|
#define TK_QDURATION 218
|
||||||
#define TK_WDURATION 219
|
#define TK_WSTART 219
|
||||||
#define TK_IROWTS 220
|
#define TK_WEND 220
|
||||||
#define TK_ISFILLED 221
|
#define TK_WDURATION 221
|
||||||
#define TK_CAST 222
|
#define TK_IROWTS 222
|
||||||
#define TK_NOW 223
|
#define TK_ISFILLED 223
|
||||||
#define TK_TODAY 224
|
#define TK_CAST 224
|
||||||
#define TK_TIMEZONE 225
|
#define TK_NOW 225
|
||||||
#define TK_CLIENT_VERSION 226
|
#define TK_TODAY 226
|
||||||
#define TK_SERVER_VERSION 227
|
#define TK_TIMEZONE 227
|
||||||
#define TK_SERVER_STATUS 228
|
#define TK_CLIENT_VERSION 228
|
||||||
#define TK_CURRENT_USER 229
|
#define TK_SERVER_VERSION 229
|
||||||
#define TK_CASE 230
|
#define TK_SERVER_STATUS 230
|
||||||
#define TK_END 231
|
#define TK_CURRENT_USER 231
|
||||||
#define TK_WHEN 232
|
#define TK_CASE 232
|
||||||
#define TK_THEN 233
|
#define TK_WHEN 233
|
||||||
#define TK_ELSE 234
|
#define TK_THEN 234
|
||||||
#define TK_BETWEEN 235
|
#define TK_ELSE 235
|
||||||
#define TK_IS 236
|
#define TK_BETWEEN 236
|
||||||
#define TK_NK_LT 237
|
#define TK_IS 237
|
||||||
#define TK_NK_GT 238
|
#define TK_NK_LT 238
|
||||||
#define TK_NK_LE 239
|
#define TK_NK_GT 239
|
||||||
#define TK_NK_GE 240
|
#define TK_NK_LE 240
|
||||||
#define TK_NK_NE 241
|
#define TK_NK_GE 241
|
||||||
#define TK_MATCH 242
|
#define TK_NK_NE 242
|
||||||
#define TK_NMATCH 243
|
#define TK_MATCH 243
|
||||||
#define TK_CONTAINS 244
|
#define TK_NMATCH 244
|
||||||
#define TK_IN 245
|
#define TK_CONTAINS 245
|
||||||
#define TK_JOIN 246
|
#define TK_IN 246
|
||||||
#define TK_INNER 247
|
#define TK_JOIN 247
|
||||||
#define TK_SELECT 248
|
#define TK_INNER 248
|
||||||
#define TK_DISTINCT 249
|
#define TK_SELECT 249
|
||||||
#define TK_WHERE 250
|
#define TK_DISTINCT 250
|
||||||
#define TK_PARTITION 251
|
#define TK_WHERE 251
|
||||||
#define TK_BY 252
|
#define TK_PARTITION 252
|
||||||
#define TK_SESSION 253
|
#define TK_BY 253
|
||||||
#define TK_STATE_WINDOW 254
|
#define TK_SESSION 254
|
||||||
#define TK_EVENT_WINDOW 255
|
#define TK_STATE_WINDOW 255
|
||||||
#define TK_START 256
|
#define TK_EVENT_WINDOW 256
|
||||||
#define TK_SLIDING 257
|
#define TK_SLIDING 257
|
||||||
#define TK_FILL 258
|
#define TK_FILL 258
|
||||||
#define TK_VALUE 259
|
#define TK_VALUE 259
|
||||||
|
|
|
@ -219,6 +219,7 @@ int32_t qStreamRecoverFinish(qTaskInfo_t tinfo);
|
||||||
int32_t qStreamRestoreParam(qTaskInfo_t tinfo);
|
int32_t qStreamRestoreParam(qTaskInfo_t tinfo);
|
||||||
bool qStreamRecoverScanFinished(qTaskInfo_t tinfo);
|
bool qStreamRecoverScanFinished(qTaskInfo_t tinfo);
|
||||||
void qStreamCloseTsdbReader(void* task);
|
void qStreamCloseTsdbReader(void* task);
|
||||||
|
void resetTaskInfo(qTaskInfo_t tinfo);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,8 @@ typedef struct STrimDatabaseStmt {
|
||||||
typedef struct SCompactDatabaseStmt {
|
typedef struct SCompactDatabaseStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
char dbName[TSDB_DB_NAME_LEN];
|
char dbName[TSDB_DB_NAME_LEN];
|
||||||
|
SNode* pStart;
|
||||||
|
SNode* pEnd;
|
||||||
} SCompactDatabaseStmt;
|
} SCompactDatabaseStmt;
|
||||||
|
|
||||||
typedef struct STableOptions {
|
typedef struct STableOptions {
|
||||||
|
|
|
@ -240,6 +240,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0355)
|
#define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0355)
|
||||||
#define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0356)
|
#define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0356)
|
||||||
#define TSDB_CODE_MND_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0357)
|
#define TSDB_CODE_MND_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0357)
|
||||||
|
#define TSDB_CODE_MND_USER_NOT_AVAILABLE TAOS_DEF_ERROR_CODE(0, 0x0358)
|
||||||
|
|
||||||
// mnode-stable-part1
|
// mnode-stable-part1
|
||||||
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
|
#define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TD_UTIL_VERSION_H_
|
#ifndef _TD_UTIL_TVERSION_H_
|
||||||
#define _TD_UTIL_VERSION_H_
|
#define _TD_UTIL_TVERSION_H_
|
||||||
|
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
@ -25,9 +25,11 @@ extern "C" {
|
||||||
int32_t taosVersionStrToInt(const char *vstr, int32_t *vint);
|
int32_t taosVersionStrToInt(const char *vstr, int32_t *vint);
|
||||||
int32_t taosVersionIntToStr(int32_t vint, char *vstr, int32_t len);
|
int32_t taosVersionIntToStr(int32_t vint, char *vstr, int32_t len);
|
||||||
int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t comparedSegments);
|
int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t comparedSegments);
|
||||||
|
int32_t taosCheckVersionCompatibleFromStr(const char *pClientVersion, const char *pServerVersion,
|
||||||
|
int32_t comparedSegments);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*_TD_UTIL_VERSION_H_*/
|
#endif /*_TD_UTIL_TVERSION_H_*/
|
||||||
|
|
|
@ -1307,6 +1307,7 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) {
|
||||||
tstrncpy(connectReq.app, appInfo.appName, sizeof(connectReq.app));
|
tstrncpy(connectReq.app, appInfo.appName, sizeof(connectReq.app));
|
||||||
tstrncpy(connectReq.user, pObj->user, sizeof(connectReq.user));
|
tstrncpy(connectReq.user, pObj->user, sizeof(connectReq.user));
|
||||||
tstrncpy(connectReq.passwd, pObj->pass, sizeof(connectReq.passwd));
|
tstrncpy(connectReq.passwd, pObj->pass, sizeof(connectReq.passwd));
|
||||||
|
tstrncpy(connectReq.sVer, version, sizeof(connectReq.sVer));
|
||||||
|
|
||||||
int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq);
|
int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq);
|
||||||
void* pReq = taosMemoryMalloc(contLen);
|
void* pReq = taosMemoryMalloc(contLen);
|
||||||
|
|
|
@ -18,10 +18,12 @@
|
||||||
#include "clientLog.h"
|
#include "clientLog.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include "tdef.h"
|
|
||||||
#include "tname.h"
|
|
||||||
#include "tdatablock.h"
|
|
||||||
#include "systable.h"
|
#include "systable.h"
|
||||||
|
#include "tdatablock.h"
|
||||||
|
#include "tdef.h"
|
||||||
|
#include "tglobal.h"
|
||||||
|
#include "tname.h"
|
||||||
|
#include "tversion.h"
|
||||||
|
|
||||||
static void setErrno(SRequestObj* pRequest, int32_t code) {
|
static void setErrno(SRequestObj* pRequest, int32_t code) {
|
||||||
pRequest->code = code;
|
pRequest->code = code;
|
||||||
|
@ -47,11 +49,11 @@ int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
SRequestObj *pRequest = acquireRequest(*(int64_t*)param);
|
SRequestObj* pRequest = acquireRequest(*(int64_t*)param);
|
||||||
if (NULL == pRequest) {
|
if (NULL == pRequest) {
|
||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
setErrno(pRequest, code);
|
setErrno(pRequest, code);
|
||||||
tsem_post(&pRequest->body.rspSem);
|
tsem_post(&pRequest->body.rspSem);
|
||||||
|
@ -65,7 +67,7 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
tsem_post(&pRequest->body.rspSem);
|
tsem_post(&pRequest->body.rspSem);
|
||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
|
||||||
SConnectRsp connectRsp = {0};
|
SConnectRsp connectRsp = {0};
|
||||||
if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) {
|
if (tDeserializeSConnectRsp(pMsg->pData, pMsg->len, &connectRsp) != 0) {
|
||||||
code = TSDB_CODE_TSC_INVALID_VERSION;
|
code = TSDB_CODE_TSC_INVALID_VERSION;
|
||||||
|
@ -74,6 +76,12 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((code = taosCheckVersionCompatibleFromStr(version, connectRsp.sVer, 2)) != 0) {
|
||||||
|
setErrno(pRequest, code);
|
||||||
|
tsem_post(&pRequest->body.rspSem);
|
||||||
|
goto End;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t now = taosGetTimestampSec();
|
int32_t now = taosGetTimestampSec();
|
||||||
int32_t delta = abs(now - connectRsp.svrTimestamp);
|
int32_t delta = abs(now - connectRsp.svrTimestamp);
|
||||||
if (delta > timestampDeltaLimit) {
|
if (delta > timestampDeltaLimit) {
|
||||||
|
@ -127,14 +135,14 @@ int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
|
|
||||||
tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId,
|
tscDebug("0x%" PRIx64 " clusterId:%" PRId64 ", totalConn:%" PRId64, pRequest->requestId, connectRsp.clusterId,
|
||||||
pTscObj->pAppInfo->numOfConns);
|
pTscObj->pAppInfo->numOfConns);
|
||||||
|
|
||||||
tsem_post(&pRequest->body.rspSem);
|
tsem_post(&pRequest->body.rspSem);
|
||||||
End:
|
End:
|
||||||
|
|
||||||
if (pRequest) {
|
if (pRequest) {
|
||||||
releaseRequest(pRequest->self);
|
releaseRequest(pRequest->self);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosMemoryFree(param);
|
taosMemoryFree(param);
|
||||||
taosMemoryFree(pMsg->pEpSet);
|
taosMemoryFree(pMsg->pEpSet);
|
||||||
taosMemoryFree(pMsg->pData);
|
taosMemoryFree(pMsg->pData);
|
||||||
|
@ -166,18 +174,18 @@ int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
struct SCatalog* pCatalog = NULL;
|
struct SCatalog* pCatalog = NULL;
|
||||||
int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
STscObj* pTscObj = pRequest->pTscObj;
|
STscObj* pTscObj = pRequest->pTscObj;
|
||||||
|
|
||||||
SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter,
|
SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter,
|
||||||
.requestId = pRequest->requestId,
|
.requestId = pRequest->requestId,
|
||||||
.requestObjRefId = pRequest->self,
|
.requestObjRefId = pRequest->self,
|
||||||
.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
|
.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
|
||||||
char dbFName[TSDB_DB_FNAME_LEN];
|
char dbFName[TSDB_DB_FNAME_LEN];
|
||||||
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB);
|
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB);
|
||||||
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
||||||
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB);
|
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB);
|
||||||
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pRequest->body.queryFp) {
|
if (pRequest->body.queryFp) {
|
||||||
|
@ -197,7 +205,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
tDeserializeSUseDbRsp(pMsg->pData, pMsg->len, &usedbRsp);
|
||||||
struct SCatalog* pCatalog = NULL;
|
struct SCatalog* pCatalog = NULL;
|
||||||
|
|
||||||
if (usedbRsp.vgVersion >= 0) { // cached in local
|
if (usedbRsp.vgVersion >= 0) { // cached in local
|
||||||
uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId;
|
uint64_t clusterId = pRequest->pTscObj->pAppInfo->clusterId;
|
||||||
int32_t code1 = catalogGetHandle(clusterId, &pCatalog);
|
int32_t code1 = catalogGetHandle(clusterId, &pCatalog);
|
||||||
if (code1 != TSDB_CODE_SUCCESS) {
|
if (code1 != TSDB_CODE_SUCCESS) {
|
||||||
|
@ -289,7 +297,7 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
if(pMsg == NULL || param == NULL){
|
if (pMsg == NULL || param == NULL) {
|
||||||
return TSDB_CODE_TSC_INVALID_INPUT;
|
return TSDB_CODE_TSC_INVALID_INPUT;
|
||||||
}
|
}
|
||||||
SRequestObj* pRequest = param;
|
SRequestObj* pRequest = param;
|
||||||
|
@ -344,13 +352,13 @@ int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
|
||||||
int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
int32_t code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid);
|
catalogRemoveDB(pCatalog, dropdbRsp.db, dropdbRsp.uid);
|
||||||
STscObj* pTscObj = pRequest->pTscObj;
|
STscObj* pTscObj = pRequest->pTscObj;
|
||||||
|
|
||||||
SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter,
|
SRequestConnInfo conn = {.pTrans = pTscObj->pAppInfo->pTransporter,
|
||||||
.requestId = pRequest->requestId,
|
.requestId = pRequest->requestId,
|
||||||
.requestObjRefId = pRequest->self,
|
.requestObjRefId = pRequest->self,
|
||||||
.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
|
.mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)};
|
||||||
char dbFName[TSDB_DB_FNAME_LEN];
|
char dbFName[TSDB_DB_FNAME_LEN];
|
||||||
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB);
|
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_INFORMATION_SCHEMA_DB);
|
||||||
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
catalogRefreshDBVgInfo(pCatalog, &conn, dbFName);
|
||||||
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB);
|
snprintf(dbFName, sizeof(dbFName) - 1, "%d.%s", pTscObj->acctId, TSDB_PERFORMANCE_SCHEMA_DB);
|
||||||
|
@ -474,8 +482,9 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) {
|
||||||
int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS);
|
int32_t len = blockEncode(pBlock, (*pRsp)->data, SHOW_VARIABLES_RESULT_COLS);
|
||||||
blockDataDestroy(pBlock);
|
blockDataDestroy(pBlock);
|
||||||
|
|
||||||
if(len != rspSize - sizeof(SRetrieveTableRsp)){
|
if (len != rspSize - sizeof(SRetrieveTableRsp)) {
|
||||||
uError("buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len, (uint64_t) (rspSize - sizeof(SRetrieveTableRsp)));
|
uError("buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%" PRIu64, len,
|
||||||
|
(uint64_t)(rspSize - sizeof(SRetrieveTableRsp)));
|
||||||
return TSDB_CODE_TSC_INVALID_INPUT;
|
return TSDB_CODE_TSC_INVALID_INPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1213,6 +1213,12 @@ static int32_t smlParseLineBottom(SSmlHandle *info) {
|
||||||
static int32_t smlInsertData(SSmlHandle *info) {
|
static int32_t smlInsertData(SSmlHandle *info) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
|
if(info->pRequest->dbList == NULL){
|
||||||
|
info->pRequest->dbList = taosArrayInit(1, TSDB_DB_FNAME_LEN);
|
||||||
|
}
|
||||||
|
void* data = taosArrayReserve(info->pRequest->dbList, 1);
|
||||||
|
memcpy(data, info->pRequest->pDb, TSDB_DB_FNAME_LEN > strlen(info->pRequest->pDb) ? strlen(info->pRequest->pDb) : TSDB_DB_FNAME_LEN);
|
||||||
|
|
||||||
SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL);
|
SSmlTableInfo **oneTable = (SSmlTableInfo **)taosHashIterate(info->childTables, NULL);
|
||||||
while (oneTable) {
|
while (oneTable) {
|
||||||
SSmlTableInfo *tableData = *oneTable;
|
SSmlTableInfo *tableData = *oneTable;
|
||||||
|
@ -1221,6 +1227,11 @@ static int32_t smlInsertData(SSmlHandle *info) {
|
||||||
tstrncpy(pName.dbname, info->pRequest->pDb, sizeof(pName.dbname));
|
tstrncpy(pName.dbname, info->pRequest->pDb, sizeof(pName.dbname));
|
||||||
memcpy(pName.tname, tableData->childTableName, strlen(tableData->childTableName));
|
memcpy(pName.tname, tableData->childTableName, strlen(tableData->childTableName));
|
||||||
|
|
||||||
|
if(info->pRequest->tableList == NULL){
|
||||||
|
info->pRequest->tableList = taosArrayInit(1, sizeof(SName));
|
||||||
|
}
|
||||||
|
taosArrayPush(info->pRequest->tableList, &pName);
|
||||||
|
|
||||||
SRequestConnInfo conn = {0};
|
SRequestConnInfo conn = {0};
|
||||||
conn.pTrans = info->taos->pAppInfo->pTransporter;
|
conn.pTrans = info->taos->pAppInfo->pTransporter;
|
||||||
conn.requestId = info->pRequest->requestId;
|
conn.requestId = info->pRequest->requestId;
|
||||||
|
@ -1422,6 +1433,7 @@ static int smlProcess(SSmlHandle *info, char *lines[], char *rawLine, char *rawL
|
||||||
do {
|
do {
|
||||||
code = smlModifyDBSchemas(info);
|
code = smlModifyDBSchemas(info);
|
||||||
if (code == 0) break;
|
if (code == 0) break;
|
||||||
|
taosMsleep(200);
|
||||||
} while (retryNum++ < taosHashGetSize(info->superTables) * MAX_RETRY_TIMES);
|
} while (retryNum++ < taosHashGetSize(info->superTables) * MAX_RETRY_TIMES);
|
||||||
|
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
@ -1446,62 +1458,75 @@ TAOS_RES *taos_schemaless_insert_inner(TAOS *taos, char *lines[], char *rawLine,
|
||||||
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
terrno = TSDB_CODE_TSC_DISCONNECTED;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
SRequestObj *request = NULL;
|
||||||
|
SSmlHandle *info = NULL;
|
||||||
|
while(1){
|
||||||
|
request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid);
|
||||||
|
if (request == NULL) {
|
||||||
|
uError("SML:taos_schemaless_insert error request is null");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SRequestObj *request = (SRequestObj *)createRequest(*(int64_t *)taos, TSDB_SQL_INSERT, reqid);
|
info = smlBuildSmlInfo(taos);
|
||||||
if (request == NULL) {
|
if (info == NULL) {
|
||||||
uError("SML:taos_schemaless_insert error request is null");
|
request->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
return NULL;
|
uError("SML:taos_schemaless_insert error SSmlHandle is null");
|
||||||
|
return (TAOS_RES *)request;
|
||||||
|
}
|
||||||
|
info->pRequest = request;
|
||||||
|
info->isRawLine = rawLine != NULL;
|
||||||
|
info->ttl = ttl;
|
||||||
|
info->precision = precision;
|
||||||
|
info->protocol = (TSDB_SML_PROTOCOL_TYPE)protocol;
|
||||||
|
info->msgBuf.buf = info->pRequest->msgBuf;
|
||||||
|
info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE;
|
||||||
|
info->lineNum = numLines;
|
||||||
|
|
||||||
|
SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf};
|
||||||
|
if (request->pDb == NULL) {
|
||||||
|
request->code = TSDB_CODE_PAR_DB_NOT_SPECIFIED;
|
||||||
|
smlBuildInvalidDataMsg(&msg, "Database not specified", NULL);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (protocol < TSDB_SML_LINE_PROTOCOL || protocol > TSDB_SML_JSON_PROTOCOL) {
|
||||||
|
request->code = TSDB_CODE_SML_INVALID_PROTOCOL_TYPE;
|
||||||
|
smlBuildInvalidDataMsg(&msg, "protocol invalidate", NULL);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (protocol == TSDB_SML_LINE_PROTOCOL &&
|
||||||
|
(precision < TSDB_SML_TIMESTAMP_NOT_CONFIGURED || precision > TSDB_SML_TIMESTAMP_NANO_SECONDS)) {
|
||||||
|
request->code = TSDB_CODE_SML_INVALID_PRECISION_TYPE;
|
||||||
|
smlBuildInvalidDataMsg(&msg, "precision invalidate for line protocol", NULL);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (protocol == TSDB_SML_JSON_PROTOCOL) {
|
||||||
|
numLines = 1;
|
||||||
|
} else if (numLines <= 0) {
|
||||||
|
request->code = TSDB_CODE_SML_INVALID_DATA;
|
||||||
|
smlBuildInvalidDataMsg(&msg, "line num is invalid", NULL);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
code = smlProcess(info, lines, rawLine, rawLineEnd, numLines);
|
||||||
|
request->code = code;
|
||||||
|
info->cost.endTime = taosGetTimestampUs();
|
||||||
|
info->cost.code = code;
|
||||||
|
smlPrintStatisticInfo(info);
|
||||||
|
if(code == TSDB_CODE_TDB_INVALID_TABLE_SCHEMA_VER || code == TSDB_CODE_SDB_OBJ_CREATING){
|
||||||
|
refreshMeta(request->pTscObj, request);
|
||||||
|
uInfo("SML:%"PRIx64" ver is old retry or object is creating code:%d", info->id, code);
|
||||||
|
smlDestroyInfo(info);
|
||||||
|
info = NULL;
|
||||||
|
taos_free_result(request);
|
||||||
|
request = NULL;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SSmlHandle *info = smlBuildSmlInfo(taos);
|
|
||||||
if (info == NULL) {
|
|
||||||
request->code = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
uError("SML:taos_schemaless_insert error SSmlHandle is null");
|
|
||||||
return (TAOS_RES *)request;
|
|
||||||
}
|
|
||||||
info->pRequest = request;
|
|
||||||
info->isRawLine = rawLine != NULL;
|
|
||||||
info->ttl = ttl;
|
|
||||||
info->precision = precision;
|
|
||||||
info->protocol = (TSDB_SML_PROTOCOL_TYPE)protocol;
|
|
||||||
info->msgBuf.buf = info->pRequest->msgBuf;
|
|
||||||
info->msgBuf.len = ERROR_MSG_BUF_DEFAULT_SIZE;
|
|
||||||
info->lineNum = numLines;
|
|
||||||
|
|
||||||
SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf};
|
|
||||||
if (request->pDb == NULL) {
|
|
||||||
request->code = TSDB_CODE_PAR_DB_NOT_SPECIFIED;
|
|
||||||
smlBuildInvalidDataMsg(&msg, "Database not specified", NULL);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protocol < TSDB_SML_LINE_PROTOCOL || protocol > TSDB_SML_JSON_PROTOCOL) {
|
|
||||||
request->code = TSDB_CODE_SML_INVALID_PROTOCOL_TYPE;
|
|
||||||
smlBuildInvalidDataMsg(&msg, "protocol invalidate", NULL);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protocol == TSDB_SML_LINE_PROTOCOL &&
|
|
||||||
(precision < TSDB_SML_TIMESTAMP_NOT_CONFIGURED || precision > TSDB_SML_TIMESTAMP_NANO_SECONDS)) {
|
|
||||||
request->code = TSDB_CODE_SML_INVALID_PRECISION_TYPE;
|
|
||||||
smlBuildInvalidDataMsg(&msg, "precision invalidate for line protocol", NULL);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (protocol == TSDB_SML_JSON_PROTOCOL) {
|
|
||||||
numLines = 1;
|
|
||||||
} else if (numLines <= 0) {
|
|
||||||
request->code = TSDB_CODE_SML_INVALID_DATA;
|
|
||||||
smlBuildInvalidDataMsg(&msg, "line num is invalid", NULL);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
code = smlProcess(info, lines, rawLine, rawLineEnd, numLines);
|
|
||||||
request->code = code;
|
|
||||||
info->cost.endTime = taosGetTimestampUs();
|
|
||||||
info->cost.code = code;
|
|
||||||
smlPrintStatisticInfo(info);
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
smlDestroyInfo(info);
|
smlDestroyInfo(info);
|
||||||
return (TAOS_RES *)request;
|
return (TAOS_RES *)request;
|
||||||
|
|
|
@ -436,7 +436,7 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd, SSmlLin
|
||||||
// bind data
|
// bind data
|
||||||
ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, cnt + 1);
|
ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, cnt + 1);
|
||||||
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
if (unlikely(ret != TSDB_CODE_SUCCESS)) {
|
||||||
uError("smlBuildCol error, retry");
|
uDebug("smlBuildCol error, retry");
|
||||||
info->dataFormat = false;
|
info->dataFormat = false;
|
||||||
info->reRun = true;
|
info->reRun = true;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -582,8 +582,10 @@ int32_t smlParseInfluxString(SSmlHandle *info, char *sql, char *sqlEnd, SSmlLine
|
||||||
.i = ts,
|
.i = ts,
|
||||||
.length = (size_t)tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes};
|
.length = (size_t)tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes};
|
||||||
if (info->dataFormat) {
|
if (info->dataFormat) {
|
||||||
smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, 0);
|
ret = smlBuildCol(info->currTableDataCtx, info->currSTableMeta->schema, &kv, 0);
|
||||||
smlBuildRow(info->currTableDataCtx);
|
if(ret != TSDB_CODE_SUCCESS){return ret;}
|
||||||
|
ret = smlBuildRow(info->currTableDataCtx);
|
||||||
|
if(ret != TSDB_CODE_SUCCESS){return ret;}
|
||||||
clearColValArray(info->currTableDataCtx->pValues);
|
clearColValArray(info->currTableDataCtx->pValues);
|
||||||
} else {
|
} else {
|
||||||
taosArraySet(elements->colArray, 0, &kv);
|
taosArraySet(elements->colArray, 0, &kv);
|
||||||
|
|
|
@ -33,6 +33,7 @@ static const SSysDbTableSchema dnodesSchema[] = {
|
||||||
{.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
|
{.name = "support_vnodes", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
|
||||||
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
|
||||||
|
{.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
|
||||||
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "note", .bytes = 256 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,6 +43,7 @@ static const SSysDbTableSchema mnodesSchema[] = {
|
||||||
{.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "role", .bytes = 12 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
{.name = "status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "status", .bytes = 9 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
|
{.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
|
||||||
|
{.name = "reboot_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SSysDbTableSchema modulesSchema[] = {
|
static const SSysDbTableSchema modulesSchema[] = {
|
||||||
|
|
|
@ -2044,8 +2044,8 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
|
||||||
if (len >= size - 1) return dumpBuf;
|
if (len >= size - 1) return dumpBuf;
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_DOUBLE:
|
case TSDB_DATA_TYPE_DOUBLE:
|
||||||
// len += snprintf(dumpBuf + len, size - len, " %15lf |", *(double*)var);
|
len += snprintf(dumpBuf + len, size - len, " %15f |", *(double*)var);
|
||||||
// if (len >= size - 1) return dumpBuf;
|
if (len >= size - 1) return dumpBuf;
|
||||||
break;
|
break;
|
||||||
case TSDB_DATA_TYPE_BOOL:
|
case TSDB_DATA_TYPE_BOOL:
|
||||||
len += snprintf(dumpBuf + len, size - len, " %15d |", *(bool*)var);
|
len += snprintf(dumpBuf + len, size - len, " %15d |", *(bool*)var);
|
||||||
|
|
|
@ -2219,6 +2219,10 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
|
||||||
if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->cacheLast) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pReq->replications) < 0) return -1;
|
if (tEncodeI8(&encoder, pReq->replications) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pReq->sstTrigger) < 0) return -1;
|
if (tEncodeI32(&encoder, pReq->sstTrigger) < 0) return -1;
|
||||||
|
|
||||||
|
// 1st modification
|
||||||
|
if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1;
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -2246,6 +2250,13 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
|
||||||
if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1;
|
if (tDecodeI8(&decoder, &pReq->cacheLast) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1;
|
if (tDecodeI8(&decoder, &pReq->replications) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pReq->sstTrigger) < 0) return -1;
|
if (tDecodeI32(&decoder, &pReq->sstTrigger) < 0) return -1;
|
||||||
|
|
||||||
|
// 1st modification
|
||||||
|
if (!tDecodeIsEnd(&decoder)) {
|
||||||
|
if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1;
|
||||||
|
} else {
|
||||||
|
pReq->minRows = -1;
|
||||||
|
}
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
|
@ -2531,6 +2542,8 @@ int32_t tSerializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq)
|
||||||
|
|
||||||
if (tStartEncode(&encoder) < 0) return -1;
|
if (tStartEncode(&encoder) < 0) return -1;
|
||||||
if (tEncodeCStr(&encoder, pReq->db) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->db) < 0) return -1;
|
||||||
|
if (tEncodeI64(&encoder, pReq->timeRange.skey) < 0) return -1;
|
||||||
|
if (tEncodeI64(&encoder, pReq->timeRange.ekey) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -2544,6 +2557,8 @@ int32_t tDeserializeSCompactDbReq(void *buf, int32_t bufLen, SCompactDbReq *pReq
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
if (tStartDecode(&decoder) < 0) return -1;
|
||||||
if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1;
|
if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1;
|
||||||
|
if (tDecodeI64(&decoder, &pReq->timeRange.skey) < 0) return -1;
|
||||||
|
if (tDecodeI64(&decoder, &pReq->timeRange.ekey) < 0) return -1;
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
|
@ -3737,6 +3752,7 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
|
||||||
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->user) < 0) return -1;
|
||||||
if (tEncodeCStrWithLen(&encoder, pReq->passwd, TSDB_PASSWORD_LEN) < 0) return -1;
|
if (tEncodeCStrWithLen(&encoder, pReq->passwd, TSDB_PASSWORD_LEN) < 0) return -1;
|
||||||
if (tEncodeI64(&encoder, pReq->startTime) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->startTime) < 0) return -1;
|
||||||
|
if (tEncodeCStr(&encoder, pReq->sVer) < 0) return -1;
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -3756,6 +3772,12 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
|
||||||
if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
|
if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1;
|
||||||
if (tDecodeCStrTo(&decoder, pReq->passwd) < 0) return -1;
|
if (tDecodeCStrTo(&decoder, pReq->passwd) < 0) return -1;
|
||||||
if (tDecodeI64(&decoder, &pReq->startTime) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->startTime) < 0) return -1;
|
||||||
|
// Check the client version from version 3.0.3.0
|
||||||
|
if (tDecodeIsEnd(&decoder)) {
|
||||||
|
tDecoderClear(&decoder);
|
||||||
|
return TSDB_CODE_VERSION_NOT_COMPATIBLE;
|
||||||
|
}
|
||||||
|
if (tDecodeCStrTo(&decoder, pReq->sVer) < 0) return -1;
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
|
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
|
@ -4104,6 +4126,11 @@ int32_t tSerializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq *
|
||||||
if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->dbUid) < 0) return -1;
|
||||||
if (tEncodeCStr(&encoder, pReq->db) < 0) return -1;
|
if (tEncodeCStr(&encoder, pReq->db) < 0) return -1;
|
||||||
if (tEncodeI64(&encoder, pReq->compactStartTime) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->compactStartTime) < 0) return -1;
|
||||||
|
|
||||||
|
// 1.1 add tw.skey and tw.ekey
|
||||||
|
if (tEncodeI64(&encoder, pReq->tw.skey) < 0) return -1;
|
||||||
|
if (tEncodeI64(&encoder, pReq->tw.ekey) < 0) return -1;
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -4116,11 +4143,21 @@ int32_t tDeserializeSCompactVnodeReq(void *buf, int32_t bufLen, SCompactVnodeReq
|
||||||
tDecoderInit(&decoder, buf, bufLen);
|
tDecoderInit(&decoder, buf, bufLen);
|
||||||
|
|
||||||
if (tStartDecode(&decoder) < 0) return -1;
|
if (tStartDecode(&decoder) < 0) return -1;
|
||||||
|
|
||||||
if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->dbUid) < 0) return -1;
|
||||||
if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1;
|
if (tDecodeCStrTo(&decoder, pReq->db) < 0) return -1;
|
||||||
if (tDecodeI64(&decoder, &pReq->compactStartTime) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->compactStartTime) < 0) return -1;
|
||||||
tEndDecode(&decoder);
|
|
||||||
|
|
||||||
|
// 1.1
|
||||||
|
if (tDecodeIsEnd(&decoder)) {
|
||||||
|
pReq->tw.skey = TSKEY_MIN;
|
||||||
|
pReq->tw.ekey = TSKEY_MAX;
|
||||||
|
} else {
|
||||||
|
if (tDecodeI64(&decoder, &pReq->tw.skey) < 0) return -1;
|
||||||
|
if (tDecodeI64(&decoder, &pReq->tw.ekey) < 0) return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tEndDecode(&decoder);
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -4146,6 +4183,11 @@ int32_t tSerializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeCon
|
||||||
for (int32_t i = 0; i < 8; ++i) {
|
for (int32_t i = 0; i < 8; ++i) {
|
||||||
if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1;
|
if (tEncodeI64(&encoder, pReq->reserved[i]) < 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 1st modification
|
||||||
|
if (tEncodeI16(&encoder, pReq->sttTrigger) < 0) return -1;
|
||||||
|
if (tEncodeI32(&encoder, pReq->minRows) < 0) return -1;
|
||||||
|
|
||||||
tEndEncode(&encoder);
|
tEndEncode(&encoder);
|
||||||
|
|
||||||
int32_t tlen = encoder.pos;
|
int32_t tlen = encoder.pos;
|
||||||
|
@ -4175,6 +4217,15 @@ int32_t tDeserializeSAlterVnodeConfigReq(void *buf, int32_t bufLen, SAlterVnodeC
|
||||||
if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1;
|
if (tDecodeI64(&decoder, &pReq->reserved[i]) < 0) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 1st modification
|
||||||
|
if (tDecodeIsEnd(&decoder)) {
|
||||||
|
pReq->sttTrigger = -1;
|
||||||
|
pReq->minRows = -1;
|
||||||
|
} else {
|
||||||
|
if (tDecodeI16(&decoder, &pReq->sttTrigger) < 0) return -1;
|
||||||
|
if (tDecodeI32(&decoder, &pReq->minRows) < 0) return -1;
|
||||||
|
}
|
||||||
|
|
||||||
tEndDecode(&decoder);
|
tEndDecode(&decoder);
|
||||||
tDecoderClear(&decoder);
|
tDecoderClear(&decoder);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -61,6 +61,16 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
|
||||||
rpcFreeCont(pRsp->pCont);
|
rpcFreeCont(pRsp->pCont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void dmEpSetToStr(char *buf, int32_t len, SEpSet *epSet) {
|
||||||
|
int32_t n = 0;
|
||||||
|
n += snprintf(buf + n, len - n, "%s", "{");
|
||||||
|
for (int i = 0; i < epSet->numOfEps; i++) {
|
||||||
|
n += snprintf(buf + n, len - n, "%s:%d%s", epSet->eps[i].fqdn, epSet->eps[i].port,
|
||||||
|
(i + 1 < epSet->numOfEps ? ", " : ""));
|
||||||
|
}
|
||||||
|
n += snprintf(buf + n, len - n, "%s", "}");
|
||||||
|
}
|
||||||
|
|
||||||
void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
||||||
SStatusReq req = {0};
|
SStatusReq req = {0};
|
||||||
|
|
||||||
|
@ -119,11 +129,10 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
|
||||||
dmGetMnodeEpSet(pMgmt->pData, &epSet);
|
dmGetMnodeEpSet(pMgmt->pData, &epSet);
|
||||||
rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp);
|
rpcSendRecv(pMgmt->msgCb.clientRpc, &epSet, &rpcMsg, &rpcRsp);
|
||||||
if (rpcRsp.code != 0) {
|
if (rpcRsp.code != 0) {
|
||||||
dError("failed to send status req since %s, numOfEps:%d inUse:%d", tstrerror(rpcRsp.code), epSet.numOfEps,
|
dmRotateMnodeEpSet(pMgmt->pData);
|
||||||
epSet.inUse);
|
char tbuf[256];
|
||||||
for (int32_t i = 0; i < epSet.numOfEps; ++i) {
|
dmEpSetToStr(tbuf, sizeof(tbuf), &epSet);
|
||||||
dDebug("index:%d, mnode ep:%s:%u", i, epSet.eps[i].fqdn, epSet.eps[i].port);
|
dError("failed to send status req since %s, epSet:%s, inUse:%d", tstrerror(rpcRsp.code), tbuf, epSet.inUse);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dmProcessStatusRsp(pMgmt, &rpcRsp);
|
dmProcessStatusRsp(pMgmt, &rpcRsp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ void vmGetVnodeLoads(SVnodeMgmt *pMgmt, SMonVloadInfo *pInfo, bool isReset) {
|
||||||
pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoad));
|
pInfo->pVloads = taosArrayInit(pMgmt->state.totalVnodes, sizeof(SVnodeLoad));
|
||||||
if (pInfo->pVloads == NULL) return;
|
if (pInfo->pVloads == NULL) return;
|
||||||
|
|
||||||
|
tfsUpdateSize(pMgmt->pTfs);
|
||||||
|
|
||||||
taosThreadRwlockRdlock(&pMgmt->lock);
|
taosThreadRwlockRdlock(&pMgmt->lock);
|
||||||
|
|
||||||
void *pIter = taosHashIterate(pMgmt->hash, NULL);
|
void *pIter = taosHashIterate(pMgmt->hash, NULL);
|
||||||
|
|
|
@ -124,7 +124,7 @@ void vmCloseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode, bool commitAndRemoveWal)
|
||||||
vmFreeQueue(pMgmt, pVnode);
|
vmFreeQueue(pMgmt, pVnode);
|
||||||
|
|
||||||
if (commitAndRemoveWal) {
|
if (commitAndRemoveWal) {
|
||||||
dInfo("vgId:%d, commit data", pVnode->vgId);
|
dInfo("vgId:%d, commit data for vnode split", pVnode->vgId);
|
||||||
vnodeSyncCommit(pVnode->pImpl);
|
vnodeSyncCommit(pVnode->pImpl);
|
||||||
vnodeBegin(pVnode->pImpl);
|
vnodeBegin(pVnode->pImpl);
|
||||||
dInfo("vgId:%d, commit data finished", pVnode->vgId);
|
dInfo("vgId:%d, commit data finished", pVnode->vgId);
|
||||||
|
|
|
@ -166,6 +166,7 @@ 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);
|
||||||
void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet);
|
void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet);
|
||||||
|
void dmRotateMnodeEpSet(SDnodeData *pData);
|
||||||
void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet);
|
void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet);
|
||||||
void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet);
|
void dmSetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet);
|
||||||
bool dmUpdateDnodeInfo(void *pData, int32_t *dnodeId, int64_t *clusterId, char *fqdn, uint16_t *port);
|
bool dmUpdateDnodeInfo(void *pData, int32_t *dnodeId, int64_t *clusterId, char *fqdn, uint16_t *port);
|
||||||
|
|
|
@ -325,6 +325,28 @@ void dmGetMnodeEpSet(SDnodeData *pData, SEpSet *pEpSet) {
|
||||||
taosThreadRwlockUnlock(&pData->lock);
|
taosThreadRwlockUnlock(&pData->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static FORCE_INLINE void dmSwapEps(SEp *epLhs, SEp *epRhs) {
|
||||||
|
SEp epTmp;
|
||||||
|
|
||||||
|
epTmp.port = epLhs->port;
|
||||||
|
tstrncpy(epTmp.fqdn, epLhs->fqdn, tListLen(epTmp.fqdn));
|
||||||
|
|
||||||
|
epLhs->port = epRhs->port;
|
||||||
|
tstrncpy(epLhs->fqdn, epRhs->fqdn, tListLen(epLhs->fqdn));
|
||||||
|
|
||||||
|
epRhs->port = epTmp.port;
|
||||||
|
tstrncpy(epRhs->fqdn, epTmp.fqdn, tListLen(epRhs->fqdn));
|
||||||
|
}
|
||||||
|
|
||||||
|
void dmRotateMnodeEpSet(SDnodeData *pData) {
|
||||||
|
taosThreadRwlockRdlock(&pData->lock);
|
||||||
|
SEpSet *pEpSet = &pData->mnodeEps;
|
||||||
|
for (int i = 1; i < pEpSet->numOfEps; i++) {
|
||||||
|
dmSwapEps(&pEpSet->eps[i - 1], &pEpSet->eps[i]);
|
||||||
|
}
|
||||||
|
taosThreadRwlockUnlock(&pData->lock);
|
||||||
|
}
|
||||||
|
|
||||||
void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
void dmGetMnodeEpSetForRedirect(SDnodeData *pData, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
||||||
dmGetMnodeEpSet(pData, pEpSet);
|
dmGetMnodeEpSet(pData, pEpSet);
|
||||||
dTrace("msg is redirected, handle:%p num:%d use:%d", pMsg->info.handle, pEpSet->numOfEps, pEpSet->inUse);
|
dTrace("msg is redirected, handle:%p num:%d use:%d", pMsg->info.handle, pEpSet->numOfEps, pEpSet->inUse);
|
||||||
|
|
|
@ -543,7 +543,7 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int32_t vgId;
|
int32_t vgId;
|
||||||
char* qmsg; //SubPlanToString
|
char* qmsg; // SubPlanToString
|
||||||
SEpSet epSet;
|
SEpSet epSet;
|
||||||
} SMqVgEp;
|
} SMqVgEp;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ int32_t mndAddDropVnodeAction(SMnode *, STrans *pTrans, SDbObj *pDb, SVgObj *pVg
|
||||||
int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force);
|
int32_t mndSetMoveVgroupsInfoToTrans(SMnode *, STrans *pTrans, int32_t dropDnodeId, bool force);
|
||||||
int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup,
|
int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb, SDbObj *pNewDb, SVgObj *pVgroup,
|
||||||
SArray *pArray);
|
SArray *pArray);
|
||||||
int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs);
|
int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs,
|
||||||
|
STimeWindow tw);
|
||||||
|
|
||||||
void *mndBuildCreateVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
void *mndBuildCreateVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
||||||
void *mndBuildDropVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
void *mndBuildDropVnodeReq(SMnode *, SDnodeObj *pDnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen);
|
||||||
|
|
|
@ -725,6 +725,18 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) {
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pAlter->sstTrigger > 0 && pAlter->sstTrigger != pDb->cfg.sstTrigger) {
|
||||||
|
pDb->cfg.sstTrigger = pAlter->sstTrigger;
|
||||||
|
pDb->vgVersion++;
|
||||||
|
terrno = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pAlter->minRows > 0 && pAlter->minRows != pDb->cfg.minRows) {
|
||||||
|
pDb->cfg.minRows = pAlter->minRows;
|
||||||
|
pDb->vgVersion++;
|
||||||
|
terrno = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1074,6 +1074,9 @@ static int32_t mndRetrieveDnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->createdTime, false);
|
||||||
|
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
colDataSetVal(pColInfo, numOfRows, (const char *)&pDnode->rebootTime, false);
|
||||||
|
|
||||||
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]);
|
||||||
|
|
||||||
|
|
|
@ -644,6 +644,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
|
||||||
|
|
||||||
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->stateStartTime, false);
|
||||||
|
|
||||||
numOfRows++;
|
numOfRows++;
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "mndStb.h"
|
#include "mndStb.h"
|
||||||
#include "mndUser.h"
|
#include "mndUser.h"
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
#include "version.h"
|
#include "tversion.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
@ -221,11 +221,18 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
|
||||||
char ip[24] = {0};
|
char ip[24] = {0};
|
||||||
const STraceId *trace = &pReq->info.traceId;
|
const STraceId *trace = &pReq->info.traceId;
|
||||||
|
|
||||||
if (tDeserializeSConnectReq(pReq->pCont, pReq->contLen, &connReq) != 0) {
|
if ((code = tDeserializeSConnectReq(pReq->pCont, pReq->contLen, &connReq)) != 0) {
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = (-1 == code ? TSDB_CODE_INVALID_MSG : code);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((code = taosCheckVersionCompatibleFromStr(connReq.sVer, version, 2)) != 0) {
|
||||||
|
terrno = code;
|
||||||
|
goto _OVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
code = -1;
|
||||||
|
|
||||||
taosIp2String(pReq->info.conn.clientIp, ip);
|
taosIp2String(pReq->info.conn.clientIp, ip);
|
||||||
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONNECT) != 0) {
|
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CONNECT) != 0) {
|
||||||
mGError("user:%s, failed to login from %s since %s", pReq->info.conn.user, ip, terrstr());
|
mGError("user:%s, failed to login from %s since %s", pReq->info.conn.user, ip, terrstr());
|
||||||
|
|
|
@ -337,7 +337,11 @@ SUserObj *mndAcquireUser(SMnode *pMnode, const char *userName) {
|
||||||
SSdb *pSdb = pMnode->pSdb;
|
SSdb *pSdb = pMnode->pSdb;
|
||||||
SUserObj *pUser = sdbAcquire(pSdb, SDB_USER, userName);
|
SUserObj *pUser = sdbAcquire(pSdb, SDB_USER, userName);
|
||||||
if (pUser == NULL) {
|
if (pUser == NULL) {
|
||||||
terrno = TSDB_CODE_MND_USER_NOT_EXIST;
|
if (terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
|
||||||
|
terrno = TSDB_CODE_MND_USER_NOT_EXIST;
|
||||||
|
} else {
|
||||||
|
terrno = TSDB_CODE_MND_USER_NOT_AVAILABLE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return pUser;
|
return pUser;
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,6 +319,8 @@ static void *mndBuildAlterVnodeConfigReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pV
|
||||||
alterReq.walLevel = pDb->cfg.walLevel;
|
alterReq.walLevel = pDb->cfg.walLevel;
|
||||||
alterReq.strict = pDb->cfg.strict;
|
alterReq.strict = pDb->cfg.strict;
|
||||||
alterReq.cacheLast = pDb->cfg.cacheLast;
|
alterReq.cacheLast = pDb->cfg.cacheLast;
|
||||||
|
alterReq.sttTrigger = pDb->cfg.sstTrigger;
|
||||||
|
alterReq.minRows = pDb->cfg.minRows;
|
||||||
|
|
||||||
mInfo("vgId:%d, build alter vnode config req", pVgroup->vgId);
|
mInfo("vgId:%d, build alter vnode config req", pVgroup->vgId);
|
||||||
int32_t contLen = tSerializeSAlterVnodeConfigReq(NULL, 0, &alterReq);
|
int32_t contLen = tSerializeSAlterVnodeConfigReq(NULL, 0, &alterReq);
|
||||||
|
@ -2209,11 +2211,12 @@ _OVER:
|
||||||
|
|
||||||
bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid) { return !pVgroup->isTsma && pVgroup->dbUid == dbUid; }
|
bool mndVgroupInDb(SVgObj *pVgroup, int64_t dbUid) { return !pVgroup->isTsma && pVgroup->dbUid == dbUid; }
|
||||||
|
|
||||||
static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen,
|
static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_t *pContLen, int64_t compactTs,
|
||||||
int64_t compactTs) {
|
STimeWindow tw) {
|
||||||
SCompactVnodeReq compactReq = {0};
|
SCompactVnodeReq compactReq = {0};
|
||||||
compactReq.dbUid = pDb->uid;
|
compactReq.dbUid = pDb->uid;
|
||||||
compactReq.compactStartTime = compactTs;
|
compactReq.compactStartTime = compactTs;
|
||||||
|
compactReq.tw = tw;
|
||||||
tstrncpy(compactReq.db, pDb->name, TSDB_DB_FNAME_LEN);
|
tstrncpy(compactReq.db, pDb->name, TSDB_DB_FNAME_LEN);
|
||||||
|
|
||||||
mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId);
|
mInfo("vgId:%d, build compact vnode config req", pVgroup->vgId);
|
||||||
|
@ -2239,13 +2242,13 @@ static void *mndBuildCompactVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgrou
|
||||||
return pReq;
|
return pReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup,
|
static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs,
|
||||||
int64_t compactTs) {
|
STimeWindow tw) {
|
||||||
STransAction action = {0};
|
STransAction action = {0};
|
||||||
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||||
|
|
||||||
int32_t contLen = 0;
|
int32_t contLen = 0;
|
||||||
void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs);
|
void *pReq = mndBuildCompactVnodeReq(pMnode, pDb, pVgroup, &contLen, compactTs, tw);
|
||||||
if (pReq == NULL) return -1;
|
if (pReq == NULL) return -1;
|
||||||
|
|
||||||
action.pCont = pReq;
|
action.pCont = pReq;
|
||||||
|
@ -2260,7 +2263,8 @@ static int32_t mndAddCompactVnodeAction(SMnode *pMnode, STrans *pTrans, SDbObj *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs) {
|
int32_t mndBuildCompactVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup, int64_t compactTs,
|
||||||
if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs) != 0) return -1;
|
STimeWindow tw) {
|
||||||
|
if (mndAddCompactVnodeAction(pMnode, pTrans, pDb, pVgroup, compactTs, tw) != 0) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
|
@ -32,13 +32,14 @@ TEST_F(MndTestProfile, 01_ConnectMsg) {
|
||||||
connectReq.pid = 1234;
|
connectReq.pid = 1234;
|
||||||
|
|
||||||
char passwd[] = "taosdata";
|
char passwd[] = "taosdata";
|
||||||
char secretEncrypt[TSDB_PASSWORD_LEN] = {0};
|
char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0};
|
||||||
taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt);
|
taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt);
|
||||||
|
|
||||||
strcpy(connectReq.app, "mnode_test_profile");
|
strcpy(connectReq.app, "mnode_test_profile");
|
||||||
strcpy(connectReq.db, "");
|
strcpy(connectReq.db, "");
|
||||||
strcpy(connectReq.user, "root");
|
strcpy(connectReq.user, "root");
|
||||||
strcpy(connectReq.passwd, secretEncrypt);
|
strcpy(connectReq.passwd, secretEncrypt);
|
||||||
|
strcpy(connectReq.sVer, version);
|
||||||
|
|
||||||
int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq);
|
int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
|
@ -66,7 +67,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) {
|
||||||
|
|
||||||
TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) {
|
TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) {
|
||||||
char passwd[] = "taosdata";
|
char passwd[] = "taosdata";
|
||||||
char secretEncrypt[TSDB_PASSWORD_LEN] = {0};
|
char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0};
|
||||||
taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt);
|
taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt);
|
||||||
|
|
||||||
SConnectReq connectReq = {0};
|
SConnectReq connectReq = {0};
|
||||||
|
@ -75,6 +76,7 @@ TEST_F(MndTestProfile, 02_ConnectMsg_InvalidDB) {
|
||||||
strcpy(connectReq.db, "invalid_db");
|
strcpy(connectReq.db, "invalid_db");
|
||||||
strcpy(connectReq.user, "root");
|
strcpy(connectReq.user, "root");
|
||||||
strcpy(connectReq.passwd, secretEncrypt);
|
strcpy(connectReq.passwd, secretEncrypt);
|
||||||
|
strcpy(connectReq.sVer, version);
|
||||||
|
|
||||||
int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq);
|
int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
|
|
|
@ -55,7 +55,7 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) {
|
||||||
|
|
||||||
TEST_F(MndTestShow, 03_ShowMsg_Conn) {
|
TEST_F(MndTestShow, 03_ShowMsg_Conn) {
|
||||||
char passwd[] = "taosdata";
|
char passwd[] = "taosdata";
|
||||||
char secretEncrypt[TSDB_PASSWORD_LEN] = {0};
|
char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0};
|
||||||
taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt);
|
taosEncryptPass_c((uint8_t*)passwd, strlen(passwd), secretEncrypt);
|
||||||
|
|
||||||
SConnectReq connectReq = {0};
|
SConnectReq connectReq = {0};
|
||||||
|
@ -64,6 +64,7 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) {
|
||||||
strcpy(connectReq.db, "");
|
strcpy(connectReq.db, "");
|
||||||
strcpy(connectReq.user, "root");
|
strcpy(connectReq.user, "root");
|
||||||
strcpy(connectReq.passwd, secretEncrypt);
|
strcpy(connectReq.passwd, secretEncrypt);
|
||||||
|
strcpy(connectReq.sVer, version);
|
||||||
|
|
||||||
int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq);
|
int32_t contLen = tSerializeSConnectReq(NULL, 0, &connectReq);
|
||||||
void* pReq = rpcMallocCont(contLen);
|
void* pReq = rpcMallocCont(contLen);
|
||||||
|
|
|
@ -780,6 +780,7 @@ typedef struct SCacheRowsReader {
|
||||||
SDataFReader *pDataFReader;
|
SDataFReader *pDataFReader;
|
||||||
SDataFReader *pDataFReaderLast;
|
SDataFReader *pDataFReaderLast;
|
||||||
const char *idstr;
|
const char *idstr;
|
||||||
|
int64_t lastTs;
|
||||||
} SCacheRowsReader;
|
} SCacheRowsReader;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -460,9 +460,10 @@ struct SCommitInfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SCompactInfo {
|
struct SCompactInfo {
|
||||||
SVnode* pVnode;
|
SVnode* pVnode;
|
||||||
int32_t flag;
|
int32_t flag;
|
||||||
int64_t commitID;
|
int64_t commitID;
|
||||||
|
STimeWindow tw;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -1032,11 +1032,15 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
|
||||||
pTask->tbSink.vnode = pTq->pVnode;
|
pTask->tbSink.vnode = pTq->pVnode;
|
||||||
pTask->tbSink.tbSinkFunc = tqSinkToTablePipeline2;
|
pTask->tbSink.tbSinkFunc = tqSinkToTablePipeline2;
|
||||||
|
|
||||||
/*A(pTask->tbSink.pSchemaWrapper);*/
|
int32_t version = 1;
|
||||||
/*A(pTask->tbSink.pSchemaWrapper->pSchema);*/
|
SMetaInfo info = {0};
|
||||||
|
int32_t code = metaGetInfo(pTq->pVnode->pMeta, pTask->tbSink.stbUid, &info, NULL);
|
||||||
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
|
version = info.skmVer;
|
||||||
|
}
|
||||||
|
|
||||||
pTask->tbSink.pTSchema =
|
pTask->tbSink.pTSchema =
|
||||||
tBuildTSchema(pTask->tbSink.pSchemaWrapper->pSchema, pTask->tbSink.pSchemaWrapper->nCols, 1);
|
tBuildTSchema(pTask->tbSink.pSchemaWrapper->pSchema, pTask->tbSink.pSchemaWrapper->nCols, version);
|
||||||
ASSERT(pTask->tbSink.pTSchema);
|
ASSERT(pTask->tbSink.pTSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,9 +257,6 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, TS
|
||||||
|
|
||||||
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
||||||
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
||||||
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
|
||||||
taosMemoryFree(pLastCol->colVal.value.pData);
|
|
||||||
|
|
||||||
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
||||||
if (lastCol.colVal.value.pData == NULL) {
|
if (lastCol.colVal.value.pData == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -378,9 +375,6 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, TSDBROW *row, STsdb
|
||||||
|
|
||||||
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
SLastCol lastCol = {.ts = keyTs, .colVal = colVal};
|
||||||
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
if (IS_VAR_DATA_TYPE(colVal.type) && colVal.value.nData > 0) {
|
||||||
SLastCol *pLastCol = (SLastCol *)taosArrayGet(pLast, iCol);
|
|
||||||
taosMemoryFree(pLastCol->colVal.value.pData);
|
|
||||||
|
|
||||||
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
lastCol.colVal.value.pData = taosMemoryMalloc(colVal.value.nData);
|
||||||
if (lastCol.colVal.value.pData == NULL) {
|
if (lastCol.colVal.value.pData == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
@ -512,6 +506,11 @@ static int32_t getTableDelData(STbData *pMem, STbData *pIMem, SDelFReader *pDelR
|
||||||
SArray *aDelData) {
|
SArray *aDelData) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
if (pDelIdx) {
|
||||||
|
code = getTableDelDataFromDelIdx(pDelReader, pDelIdx, aDelData);
|
||||||
|
if (code) goto _err;
|
||||||
|
}
|
||||||
|
|
||||||
if (pMem) {
|
if (pMem) {
|
||||||
code = getTableDelDataFromTbData(pMem, aDelData);
|
code = getTableDelDataFromTbData(pMem, aDelData);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
|
@ -522,11 +521,6 @@ static int32_t getTableDelData(STbData *pMem, STbData *pIMem, SDelFReader *pDelR
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDelIdx) {
|
|
||||||
code = getTableDelDataFromDelIdx(pDelReader, pDelIdx, aDelData);
|
|
||||||
if (code) goto _err;
|
|
||||||
}
|
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -599,9 +593,10 @@ typedef struct {
|
||||||
SMergeTree mergeTree;
|
SMergeTree mergeTree;
|
||||||
SMergeTree *pMergeTree;
|
SMergeTree *pMergeTree;
|
||||||
SSttBlockLoadInfo *pLoadInfo;
|
SSttBlockLoadInfo *pLoadInfo;
|
||||||
|
int64_t lastTs;
|
||||||
} SFSLastNextRowIter;
|
} SFSLastNextRowIter;
|
||||||
|
|
||||||
static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) {
|
static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlierTs) {
|
||||||
SFSLastNextRowIter *state = (SFSLastNextRowIter *)iter;
|
SFSLastNextRowIter *state = (SFSLastNextRowIter *)iter;
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
@ -647,15 +642,27 @@ static int32_t getNextRowFromFSLast(void *iter, TSDBROW **ppRow) {
|
||||||
}
|
}
|
||||||
state->state = SFSLASTNEXTROW_BLOCKROW;
|
state->state = SFSLASTNEXTROW_BLOCKROW;
|
||||||
}
|
}
|
||||||
case SFSLASTNEXTROW_BLOCKROW:
|
case SFSLASTNEXTROW_BLOCKROW: {
|
||||||
state->row = tMergeTreeGetRow(&state->mergeTree);
|
bool hasVal = false;
|
||||||
*ppRow = &state->row;
|
do {
|
||||||
bool hasVal = tMergeTreeNext(&state->mergeTree);
|
state->row = tMergeTreeGetRow(&state->mergeTree);
|
||||||
|
*ppRow = &state->row;
|
||||||
|
hasVal = tMergeTreeNext(&state->mergeTree);
|
||||||
|
} while (TSDBROW_TS(&state->row) <= state->lastTs && hasVal);
|
||||||
|
|
||||||
|
if (TSDBROW_TS(&state->row) <= state->lastTs) {
|
||||||
|
*pIgnoreEarlierTs = true;
|
||||||
|
state->state = SFSLASTNEXTROW_FILESET;
|
||||||
|
goto _next_fileset;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pIgnoreEarlierTs = false;
|
||||||
if (!hasVal) {
|
if (!hasVal) {
|
||||||
state->state = SFSLASTNEXTROW_FILESET;
|
state->state = SFSLASTNEXTROW_FILESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
break;
|
break;
|
||||||
|
@ -728,9 +735,10 @@ typedef struct SFSNextRowIter {
|
||||||
int32_t iRow;
|
int32_t iRow;
|
||||||
TSDBROW row;
|
TSDBROW row;
|
||||||
SSttBlockLoadInfo *pLoadInfo;
|
SSttBlockLoadInfo *pLoadInfo;
|
||||||
|
int64_t lastTs;
|
||||||
} SFSNextRowIter;
|
} SFSNextRowIter;
|
||||||
|
|
||||||
static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
|
static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlierTs) {
|
||||||
SFSNextRowIter *state = (SFSNextRowIter *)iter;
|
SFSNextRowIter *state = (SFSNextRowIter *)iter;
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
|
@ -822,12 +830,14 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
|
||||||
SDataBlk block = {0};
|
SDataBlk block = {0};
|
||||||
|
|
||||||
tDataBlkReset(&block);
|
tDataBlkReset(&block);
|
||||||
// tBlockDataReset(&state->blockData);
|
|
||||||
tBlockDataReset(state->pBlockData);
|
tBlockDataReset(state->pBlockData);
|
||||||
|
|
||||||
tMapDataGetItemByIdx(&state->blockMap, state->iBlock, &block, tGetDataBlk);
|
tMapDataGetItemByIdx(&state->blockMap, state->iBlock, &block, tGetDataBlk);
|
||||||
/* code = tsdbReadBlockData(state->pDataFReader, &state->blockIdx, &block, &state->blockData, NULL, NULL);
|
if (block.maxKey.ts <= state->lastTs) {
|
||||||
*/
|
*pIgnoreEarlierTs = true;
|
||||||
|
goto _next_fileset;
|
||||||
|
}
|
||||||
|
*pIgnoreEarlierTs = false;
|
||||||
tBlockDataReset(state->pBlockData);
|
tBlockDataReset(state->pBlockData);
|
||||||
TABLEID tid = {.suid = state->suid, .uid = state->uid};
|
TABLEID tid = {.suid = state->suid, .uid = state->uid};
|
||||||
code = tBlockDataInit(state->pBlockData, &tid, state->pTSchema, NULL, 0);
|
code = tBlockDataInit(state->pBlockData, &tid, state->pTSchema, NULL, 0);
|
||||||
|
@ -937,16 +947,23 @@ typedef struct SMemNextRowIter {
|
||||||
SMEMNEXTROWSTATES state;
|
SMEMNEXTROWSTATES state;
|
||||||
STbData *pMem; // [input]
|
STbData *pMem; // [input]
|
||||||
STbDataIter iter; // mem buffer skip list iterator
|
STbDataIter iter; // mem buffer skip list iterator
|
||||||
|
int64_t lastTs;
|
||||||
// bool iterOpened;
|
// bool iterOpened;
|
||||||
// TSDBROW *curRow;
|
// TSDBROW *curRow;
|
||||||
} SMemNextRowIter;
|
} SMemNextRowIter;
|
||||||
|
|
||||||
static int32_t getNextRowFromMem(void *iter, TSDBROW **ppRow) {
|
static int32_t getNextRowFromMem(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlierTs) {
|
||||||
SMemNextRowIter *state = (SMemNextRowIter *)iter;
|
SMemNextRowIter *state = (SMemNextRowIter *)iter;
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
*pIgnoreEarlierTs = false;
|
||||||
switch (state->state) {
|
switch (state->state) {
|
||||||
case SMEMNEXTROW_ENTER: {
|
case SMEMNEXTROW_ENTER: {
|
||||||
if (state->pMem != NULL) {
|
if (state->pMem != NULL) {
|
||||||
|
if (state->pMem->maxKey <= state->lastTs) {
|
||||||
|
*ppRow = NULL;
|
||||||
|
*pIgnoreEarlierTs = true;
|
||||||
|
return code;
|
||||||
|
}
|
||||||
tsdbTbDataIterOpen(state->pMem, NULL, 1, &state->iter);
|
tsdbTbDataIterOpen(state->pMem, NULL, 1, &state->iter);
|
||||||
|
|
||||||
TSDBROW *pMemRow = tsdbTbDataIterGet(&state->iter);
|
TSDBROW *pMemRow = tsdbTbDataIterGet(&state->iter);
|
||||||
|
@ -1047,13 +1064,14 @@ static bool tsdbKeyDeleted(TSDBKEY *key, SArray *pSkyline, int64_t *iSkyline) {
|
||||||
return deleted;
|
return deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef int32_t (*_next_row_fn_t)(void *iter, TSDBROW **ppRow);
|
typedef int32_t (*_next_row_fn_t)(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlierTs);
|
||||||
typedef int32_t (*_next_row_clear_fn_t)(void *iter);
|
typedef int32_t (*_next_row_clear_fn_t)(void *iter);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
TSDBROW *pRow;
|
TSDBROW *pRow;
|
||||||
bool stop;
|
bool stop;
|
||||||
bool next;
|
bool next;
|
||||||
|
bool ignoreEarlierTs;
|
||||||
void *iter;
|
void *iter;
|
||||||
_next_row_fn_t nextRowFn;
|
_next_row_fn_t nextRowFn;
|
||||||
_next_row_clear_fn_t nextRowClearFn;
|
_next_row_clear_fn_t nextRowClearFn;
|
||||||
|
@ -1076,7 +1094,7 @@ typedef struct {
|
||||||
|
|
||||||
static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTsdb, STSchema *pTSchema, tb_uid_t suid,
|
static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTsdb, STSchema *pTSchema, tb_uid_t suid,
|
||||||
SSttBlockLoadInfo *pLoadInfo, STsdbReadSnap *pReadSnap, SDataFReader **pDataFReader,
|
SSttBlockLoadInfo *pLoadInfo, STsdbReadSnap *pReadSnap, SDataFReader **pDataFReader,
|
||||||
SDataFReader **pDataFReaderLast) {
|
SDataFReader **pDataFReaderLast, int64_t lastTs) {
|
||||||
int code = 0;
|
int code = 0;
|
||||||
|
|
||||||
STbData *pMem = NULL;
|
STbData *pMem = NULL;
|
||||||
|
@ -1137,6 +1155,7 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs
|
||||||
pIter->fsLastState.uid = uid;
|
pIter->fsLastState.uid = uid;
|
||||||
pIter->fsLastState.pLoadInfo = pLoadInfo;
|
pIter->fsLastState.pLoadInfo = pLoadInfo;
|
||||||
pIter->fsLastState.pDataFReader = pDataFReaderLast;
|
pIter->fsLastState.pDataFReader = pDataFReaderLast;
|
||||||
|
pIter->fsLastState.lastTs = lastTs;
|
||||||
|
|
||||||
pIter->fsState.state = SFSNEXTROW_FS;
|
pIter->fsState.state = SFSNEXTROW_FS;
|
||||||
pIter->fsState.pTsdb = pTsdb;
|
pIter->fsState.pTsdb = pTsdb;
|
||||||
|
@ -1147,17 +1166,19 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs
|
||||||
pIter->fsState.uid = uid;
|
pIter->fsState.uid = uid;
|
||||||
pIter->fsState.pLoadInfo = pLoadInfo;
|
pIter->fsState.pLoadInfo = pLoadInfo;
|
||||||
pIter->fsState.pDataFReader = pDataFReader;
|
pIter->fsState.pDataFReader = pDataFReader;
|
||||||
|
pIter->fsState.lastTs = lastTs;
|
||||||
|
|
||||||
pIter->input[0] = (TsdbNextRowState){&pIter->memRow, true, false, &pIter->memState, getNextRowFromMem, NULL};
|
pIter->input[0] = (TsdbNextRowState){&pIter->memRow, true, false, false, &pIter->memState, getNextRowFromMem, NULL};
|
||||||
pIter->input[1] = (TsdbNextRowState){&pIter->imemRow, true, false, &pIter->imemState, getNextRowFromMem, NULL};
|
pIter->input[1] = (TsdbNextRowState){&pIter->imemRow, true, false, false, &pIter->imemState, getNextRowFromMem, NULL};
|
||||||
pIter->input[2] = (TsdbNextRowState){&pIter->fsLastRow, false, true, &pIter->fsLastState, getNextRowFromFSLast,
|
pIter->input[2] = (TsdbNextRowState){
|
||||||
clearNextRowFromFSLast};
|
&pIter->fsLastRow, false, true, false, &pIter->fsLastState, getNextRowFromFSLast, clearNextRowFromFSLast};
|
||||||
pIter->input[3] =
|
pIter->input[3] =
|
||||||
(TsdbNextRowState){&pIter->fsRow, false, true, &pIter->fsState, getNextRowFromFS, clearNextRowFromFS};
|
(TsdbNextRowState){&pIter->fsRow, false, true, false, &pIter->fsState, getNextRowFromFS, clearNextRowFromFS};
|
||||||
|
|
||||||
if (pMem) {
|
if (pMem) {
|
||||||
pIter->memState.pMem = pMem;
|
pIter->memState.pMem = pMem;
|
||||||
pIter->memState.state = SMEMNEXTROW_ENTER;
|
pIter->memState.state = SMEMNEXTROW_ENTER;
|
||||||
|
pIter->memState.lastTs = lastTs;
|
||||||
pIter->input[0].stop = false;
|
pIter->input[0].stop = false;
|
||||||
pIter->input[0].next = true;
|
pIter->input[0].next = true;
|
||||||
}
|
}
|
||||||
|
@ -1165,6 +1186,7 @@ static int32_t nextRowIterOpen(CacheNextRowIter *pIter, tb_uid_t uid, STsdb *pTs
|
||||||
if (pIMem) {
|
if (pIMem) {
|
||||||
pIter->imemState.pMem = pIMem;
|
pIter->imemState.pMem = pIMem;
|
||||||
pIter->imemState.state = SMEMNEXTROW_ENTER;
|
pIter->imemState.state = SMEMNEXTROW_ENTER;
|
||||||
|
pIter->imemState.lastTs = lastTs;
|
||||||
pIter->input[1].stop = false;
|
pIter->input[1].stop = false;
|
||||||
pIter->input[1].next = true;
|
pIter->input[1].next = true;
|
||||||
}
|
}
|
||||||
|
@ -1192,12 +1214,12 @@ _err:
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate next row non deleted backward ts, version (from high to low)
|
// iterate next row non deleted backward ts, version (from high to low)
|
||||||
static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow) {
|
static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow, bool *pIgnoreEarlierTs) {
|
||||||
int code = 0;
|
int code = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
if (pIter->input[i].next && !pIter->input[i].stop) {
|
if (pIter->input[i].next && !pIter->input[i].stop) {
|
||||||
code = pIter->input[i].nextRowFn(pIter->input[i].iter, &pIter->input[i].pRow);
|
code = pIter->input[i].nextRowFn(pIter->input[i].iter, &pIter->input[i].pRow, &pIter->input[i].ignoreEarlierTs);
|
||||||
if (code) goto _err;
|
if (code) goto _err;
|
||||||
|
|
||||||
if (pIter->input[i].pRow == NULL) {
|
if (pIter->input[i].pRow == NULL) {
|
||||||
|
@ -1209,6 +1231,8 @@ static int32_t nextRowIterGet(CacheNextRowIter *pIter, TSDBROW **ppRow) {
|
||||||
|
|
||||||
if (pIter->input[0].stop && pIter->input[1].stop && pIter->input[2].stop && pIter->input[3].stop) {
|
if (pIter->input[0].stop && pIter->input[1].stop && pIter->input[2].stop && pIter->input[3].stop) {
|
||||||
*ppRow = NULL;
|
*ppRow = NULL;
|
||||||
|
*pIgnoreEarlierTs = (pIter->input[0].ignoreEarlierTs || pIter->input[1].ignoreEarlierTs ||
|
||||||
|
pIter->input[2].ignoreEarlierTs || pIter->input[3].ignoreEarlierTs);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1265,31 +1289,82 @@ _err:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppColArray, SCacheRowsReader *pr) {
|
static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) {
|
||||||
int32_t code = 0;
|
SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol));
|
||||||
|
if (NULL == pColArray) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < pTSchema->numOfCols; ++i) {
|
||||||
|
SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[i].colId, pTSchema->columns[i].type)};
|
||||||
|
taosArrayPush(pColArray, &col);
|
||||||
|
}
|
||||||
|
*ppColArray = pColArray;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) {
|
||||||
|
int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols;
|
||||||
|
*ppDst = taosMemoryMalloc(len);
|
||||||
|
if (NULL == *ppDst) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
memcpy(*ppDst, pSrc, len);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t updateTSchema(int32_t sversion, SCacheRowsReader *pReader, uint64_t uid) {
|
||||||
|
if (NULL == pReader->pCurrSchema && sversion == pReader->pSchema->version) {
|
||||||
|
return cloneTSchema(pReader->pSchema, &pReader->pCurrSchema);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != pReader->pCurrSchema && sversion == pReader->pCurrSchema->version) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
taosMemoryFreeClear(pReader->pCurrSchema);
|
||||||
|
return metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pReader->pCurrSchema);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppColArray, SCacheRowsReader *pr) {
|
||||||
STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
|
STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
|
||||||
int16_t nCol = pTSchema->numOfCols;
|
int16_t nLastCol = pTSchema->numOfCols;
|
||||||
int16_t iCol = 0;
|
int16_t iCol = 0;
|
||||||
int16_t noneCol = 0;
|
int16_t noneCol = 0;
|
||||||
bool setNoneCol = false;
|
bool setNoneCol = false;
|
||||||
SArray *pColArray = taosArrayInit(nCol, sizeof(SLastCol));
|
bool hasRow = false;
|
||||||
|
bool ignoreEarlierTs = false;
|
||||||
|
SArray *pColArray = NULL;
|
||||||
SColVal *pColVal = &(SColVal){0};
|
SColVal *pColVal = &(SColVal){0};
|
||||||
|
|
||||||
|
int32_t code = initLastColArray(pTSchema, &pColArray);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
TSKEY lastRowTs = TSKEY_MAX;
|
TSKEY lastRowTs = TSKEY_MAX;
|
||||||
|
|
||||||
CacheNextRowIter iter = {0};
|
CacheNextRowIter iter = {0};
|
||||||
nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->suid, pr->pLoadInfo, pr->pReadSnap, &pr->pDataFReader,
|
nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->suid, pr->pLoadInfo, pr->pReadSnap, &pr->pDataFReader,
|
||||||
&pr->pDataFReaderLast);
|
&pr->pDataFReaderLast, pr->lastTs);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
TSDBROW *pRow = NULL;
|
TSDBROW *pRow = NULL;
|
||||||
nextRowIterGet(&iter, &pRow);
|
nextRowIterGet(&iter, &pRow, &ignoreEarlierTs);
|
||||||
|
|
||||||
if (!pRow) {
|
if (!pRow) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasRow = true;
|
||||||
|
|
||||||
|
code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
|
pTSchema = pr->pCurrSchema;
|
||||||
|
int16_t nCol = pTSchema->numOfCols;
|
||||||
|
|
||||||
TSKEY rowTs = TSDBROW_TS(pRow);
|
TSKEY rowTs = TSDBROW_TS(pRow);
|
||||||
|
|
||||||
if (lastRowTs == TSKEY_MAX) {
|
if (lastRowTs == TSKEY_MAX) {
|
||||||
|
@ -1297,29 +1372,27 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo
|
||||||
STColumn *pTColumn = &pTSchema->columns[0];
|
STColumn *pTColumn = &pTSchema->columns[0];
|
||||||
|
|
||||||
*pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs});
|
*pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs});
|
||||||
if (taosArrayPush(pColArray, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}) == NULL) {
|
taosArraySet(pColArray, 0, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal});
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
goto _err;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (iCol = 1; iCol < nCol; ++iCol) {
|
for (iCol = 1; iCol < nCol; ++iCol) {
|
||||||
|
if (iCol >= nLastCol) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SLastCol *pCol = taosArrayGet(pColArray, iCol);
|
||||||
|
if (pCol->colVal.cid != pTSchema->columns[iCol].colId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal);
|
tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal);
|
||||||
|
|
||||||
SLastCol lastCol = {.ts = lastRowTs, .colVal = *pColVal};
|
*pCol = (SLastCol){.ts = lastRowTs, .colVal = *pColVal};
|
||||||
if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) {
|
if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) {
|
||||||
lastCol.colVal.value.pData = taosMemoryMalloc(lastCol.colVal.value.nData);
|
pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData);
|
||||||
if (lastCol.colVal.value.pData == NULL) {
|
if (pCol->colVal.value.pData == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
memcpy(lastCol.colVal.value.pData, pColVal->value.pData, pColVal->value.nData);
|
memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData);
|
||||||
}
|
|
||||||
|
|
||||||
if (taosArrayPush(pColArray, &lastCol) == NULL) {
|
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
goto _err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (COL_VAL_IS_NONE(pColVal) && !setNoneCol) {
|
if (COL_VAL_IS_NONE(pColVal) && !setNoneCol) {
|
||||||
|
@ -1376,6 +1449,14 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo
|
||||||
//*ppColArray = NULL;
|
//*ppColArray = NULL;
|
||||||
// taosArrayDestroy(pColArray);
|
// taosArrayDestroy(pColArray);
|
||||||
//} else {
|
//} else {
|
||||||
|
if (!hasRow) {
|
||||||
|
if (ignoreEarlierTs) {
|
||||||
|
taosArrayDestroy(pColArray);
|
||||||
|
pColArray = NULL;
|
||||||
|
} else {
|
||||||
|
taosArrayClear(pColArray);
|
||||||
|
}
|
||||||
|
}
|
||||||
*ppColArray = pColArray;
|
*ppColArray = pColArray;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
@ -1390,49 +1471,13 @@ _err:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) {
|
|
||||||
int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols;
|
|
||||||
*ppDst = taosMemoryMalloc(len);
|
|
||||||
if (NULL == *ppDst) {
|
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
memcpy(*ppDst, pSrc, len);
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t updateTSchema(int32_t sversion, SCacheRowsReader *pReader, uint64_t uid) {
|
|
||||||
if (NULL == pReader->pCurrSchema && sversion == pReader->pSchema->version) {
|
|
||||||
return cloneTSchema(pReader->pSchema, &pReader->pCurrSchema);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL != pReader->pCurrSchema && sversion == pReader->pCurrSchema->version) {
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
taosMemoryFreeClear(pReader->pCurrSchema);
|
|
||||||
return metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pReader->pCurrSchema);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) {
|
|
||||||
SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol));
|
|
||||||
if (NULL == pColArray) {
|
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < pTSchema->numOfCols; ++i) {
|
|
||||||
SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[i].colId, pTSchema->columns[i].type)};
|
|
||||||
taosArrayPush(pColArray, &col);
|
|
||||||
}
|
|
||||||
*ppColArray = pColArray;
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) {
|
static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) {
|
||||||
STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
|
STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
|
||||||
int16_t nLastCol = pTSchema->numOfCols;
|
int16_t nLastCol = pTSchema->numOfCols;
|
||||||
int16_t noneCol = 0;
|
int16_t noneCol = 0;
|
||||||
bool setNoneCol = false;
|
bool setNoneCol = false;
|
||||||
bool hasRow = false;
|
bool hasRow = false;
|
||||||
|
bool ignoreEarlierTs = false;
|
||||||
SArray *pColArray = NULL;
|
SArray *pColArray = NULL;
|
||||||
SColVal *pColVal = &(SColVal){0};
|
SColVal *pColVal = &(SColVal){0};
|
||||||
|
|
||||||
|
@ -1445,11 +1490,11 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
|
||||||
|
|
||||||
CacheNextRowIter iter = {0};
|
CacheNextRowIter iter = {0};
|
||||||
nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->suid, pr->pLoadInfo, pr->pReadSnap, &pr->pDataFReader,
|
nextRowIterOpen(&iter, uid, pTsdb, pTSchema, pr->suid, pr->pLoadInfo, pr->pReadSnap, &pr->pDataFReader,
|
||||||
&pr->pDataFReaderLast);
|
&pr->pDataFReaderLast, pr->lastTs);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
TSDBROW *pRow = NULL;
|
TSDBROW *pRow = NULL;
|
||||||
nextRowIterGet(&iter, &pRow);
|
nextRowIterGet(&iter, &pRow, &ignoreEarlierTs);
|
||||||
|
|
||||||
if (!pRow) {
|
if (!pRow) {
|
||||||
break;
|
break;
|
||||||
|
@ -1549,7 +1594,12 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
|
||||||
// taosArrayDestroy(pColArray);
|
// taosArrayDestroy(pColArray);
|
||||||
//} else {
|
//} else {
|
||||||
if (!hasRow) {
|
if (!hasRow) {
|
||||||
taosArrayClear(pColArray);
|
if (ignoreEarlierTs) {
|
||||||
|
taosArrayDestroy(pColArray);
|
||||||
|
pColArray = NULL;
|
||||||
|
} else {
|
||||||
|
taosArrayClear(pColArray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*ppLastArray = pColArray;
|
*ppLastArray = pColArray;
|
||||||
//}
|
//}
|
||||||
|
@ -1583,8 +1633,8 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader *
|
||||||
SArray *pArray = NULL;
|
SArray *pArray = NULL;
|
||||||
bool dup = false; // which is always false for now
|
bool dup = false; // which is always false for now
|
||||||
code = mergeLastRow(uid, pTsdb, &dup, &pArray, pr);
|
code = mergeLastRow(uid, pTsdb, &dup, &pArray, pr);
|
||||||
// if table's empty or error, set handle NULL and return
|
// if table's empty or error or ignore ignore earlier ts, set handle NULL and return
|
||||||
if (code < 0 /* || pArray == NULL*/) {
|
if (code < 0 || pArray == NULL) {
|
||||||
if (!dup && pArray) {
|
if (!dup && pArray) {
|
||||||
taosArrayDestroy(pArray);
|
taosArrayDestroy(pArray);
|
||||||
}
|
}
|
||||||
|
@ -1627,8 +1677,8 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, SCacheRowsReader *pr,
|
||||||
if (!h) {
|
if (!h) {
|
||||||
SArray *pLastArray = NULL;
|
SArray *pLastArray = NULL;
|
||||||
code = mergeLast(uid, pTsdb, &pLastArray, pr);
|
code = mergeLast(uid, pTsdb, &pLastArray, pr);
|
||||||
// if table's empty or error, set handle NULL and return
|
// if table's empty or error or ignore ignore earlier ts, set handle NULL and return
|
||||||
if (code < 0 /* || pLastArray == NULL*/) {
|
if (code < 0 || pLastArray == NULL) {
|
||||||
taosThreadMutexUnlock(&pTsdb->lruMutex);
|
taosThreadMutexUnlock(&pTsdb->lruMutex);
|
||||||
|
|
||||||
*handle = NULL;
|
*handle = NULL;
|
||||||
|
|
|
@ -38,16 +38,17 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
||||||
*(int64_t*)p->buf = pColVal->ts;
|
*(int64_t*)p->buf = pColVal->ts;
|
||||||
allNullRow = false;
|
allNullRow = false;
|
||||||
} else {
|
} else {
|
||||||
int32_t slotId = slotIds[i];
|
int32_t slotId = slotIds[i];
|
||||||
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId);
|
|
||||||
|
|
||||||
// add check for null value, caused by the modification of table schema (new column added).
|
// add check for null value, caused by the modification of table schema (new column added).
|
||||||
if (pColVal == NULL) {
|
if (slotId >= taosArrayGetSize(pRow)) {
|
||||||
p->ts = 0;
|
p->ts = 0;
|
||||||
p->isNull = true;
|
p->isNull = true;
|
||||||
|
colDataSetNULL(pColInfoData, numOfRows);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId);
|
||||||
|
|
||||||
p->ts = pColVal->ts;
|
p->ts = pColVal->ts;
|
||||||
p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal);
|
p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal);
|
||||||
allNullRow = p->isNull & allNullRow;
|
allNullRow = p->isNull & allNullRow;
|
||||||
|
@ -79,7 +80,12 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
||||||
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, 0);
|
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, 0);
|
||||||
colDataSetVal(pColInfoData, numOfRows, (const char*)&pColVal->ts, false);
|
colDataSetVal(pColInfoData, numOfRows, (const char*)&pColVal->ts, false);
|
||||||
} else {
|
} else {
|
||||||
int32_t slotId = slotIds[i];
|
int32_t slotId = slotIds[i];
|
||||||
|
// add check for null value, caused by the modification of table schema (new column added).
|
||||||
|
if (slotId >= taosArrayGetSize(pRow)) {
|
||||||
|
colDataSetNULL(pColInfoData, numOfRows);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId);
|
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId);
|
||||||
SColVal* pVal = &pColVal->colVal;
|
SColVal* pVal = &pColVal->colVal;
|
||||||
|
|
||||||
|
@ -193,6 +199,8 @@ int32_t tsdbCacherowsReaderOpen(void* pVnode, int32_t type, void* pTableIdList,
|
||||||
p->idstr = taosStrdup(idstr);
|
p->idstr = taosStrdup(idstr);
|
||||||
taosThreadMutexInit(&p->readerMutex, NULL);
|
taosThreadMutexInit(&p->readerMutex, NULL);
|
||||||
|
|
||||||
|
p->lastTs = INT64_MIN;
|
||||||
|
|
||||||
*pReader = p;
|
*pReader = p;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -341,6 +349,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
bool hasNotNullRow = true;
|
||||||
|
int64_t minTs = INT64_MAX;
|
||||||
for (int32_t k = 0; k < pr->numOfCols; ++k) {
|
for (int32_t k = 0; k < pr->numOfCols; ++k) {
|
||||||
int32_t slotId = slotIds[k];
|
int32_t slotId = slotIds[k];
|
||||||
|
|
||||||
|
@ -351,6 +361,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
hasRes = true;
|
hasRes = true;
|
||||||
p->ts = pCol->ts;
|
p->ts = pCol->ts;
|
||||||
p->colVal = pCol->colVal;
|
p->colVal = pCol->colVal;
|
||||||
|
minTs = pCol->ts;
|
||||||
|
|
||||||
// only set value for last row query
|
// only set value for last row query
|
||||||
if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST_ROW)) {
|
if (HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST_ROW)) {
|
||||||
|
@ -367,11 +378,17 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
if (pColVal->ts > p->ts) {
|
if (pColVal->ts > p->ts) {
|
||||||
if (!COL_VAL_IS_VALUE(&pColVal->colVal) && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) {
|
if (!COL_VAL_IS_VALUE(&pColVal->colVal) && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) {
|
||||||
|
if (!COL_VAL_IS_VALUE(&p->colVal)) {
|
||||||
|
hasNotNullRow = false;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasRes = true;
|
hasRes = true;
|
||||||
p->ts = pColVal->ts;
|
p->ts = pColVal->ts;
|
||||||
|
if (pColVal->ts < minTs && HASTYPE(pr->type, CACHESCAN_RETRIEVE_LAST)) {
|
||||||
|
minTs = pColVal->ts;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IS_VAR_DATA_TYPE(pColVal->colVal.type)) {
|
if (!IS_VAR_DATA_TYPE(pColVal->colVal.type)) {
|
||||||
p->colVal = pColVal->colVal;
|
p->colVal = pColVal->colVal;
|
||||||
|
@ -388,6 +405,10 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasNotNullRow) {
|
||||||
|
pr->lastTs = minTs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbCacheRelease(lruCache, h);
|
tsdbCacheRelease(lruCache, h);
|
||||||
|
|
|
@ -198,7 +198,7 @@ static int32_t tsdbSnapCmprData(STsdbSnapReader* pReader, uint8_t** ppData) {
|
||||||
ASSERT(pReader->bData.nRow);
|
ASSERT(pReader->bData.nRow);
|
||||||
|
|
||||||
int32_t aBufN[5] = {0};
|
int32_t aBufN[5] = {0};
|
||||||
code = tCmprBlockData(&pReader->bData, TWO_STAGE_COMP, NULL, NULL, pReader->aBuf, aBufN);
|
code = tCmprBlockData(&pReader->bData, NO_COMPRESSION, NULL, NULL, pReader->aBuf, aBufN);
|
||||||
if (code) goto _exit;
|
if (code) goto _exit;
|
||||||
|
|
||||||
int32_t size = aBufN[0] + aBufN[1] + aBufN[2] + aBufN[3];
|
int32_t size = aBufN[0] + aBufN[1] + aBufN[2] + aBufN[3];
|
||||||
|
@ -276,7 +276,7 @@ static int32_t tsdbSnapReadTimeSeriesData(STsdbSnapReader* pReader, uint8_t** pp
|
||||||
code = tsdbSnapReadNextRow(pReader, &pRowInfo);
|
code = tsdbSnapReadNextRow(pReader, &pRowInfo);
|
||||||
TSDB_CHECK_CODE(code, lino, _exit);
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
|
||||||
if (pReader->bData.nRow >= 4096) break;
|
if (pReader->bData.nRow >= 81920) break;
|
||||||
} while (pRowInfo);
|
} while (pRowInfo);
|
||||||
|
|
||||||
ASSERT(pReader->bData.nRow > 0);
|
ASSERT(pReader->bData.nRow > 0);
|
||||||
|
|
|
@ -211,6 +211,11 @@ static int32_t vnodePreProcessSubmitMsg(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
|
|
||||||
SDecoder *pCoder = &(SDecoder){0};
|
SDecoder *pCoder = &(SDecoder){0};
|
||||||
|
|
||||||
|
if (taosHton64(((SSubmitReq2Msg *)pMsg->pCont)->version) != 1) {
|
||||||
|
code = TSDB_CODE_INVALID_MSG;
|
||||||
|
TSDB_CHECK_CODE(code, lino, _exit);
|
||||||
|
}
|
||||||
|
|
||||||
tDecoderInit(pCoder, (uint8_t *)pMsg->pCont + sizeof(SSubmitReq2Msg), pMsg->contLen - sizeof(SSubmitReq2Msg));
|
tDecoderInit(pCoder, (uint8_t *)pMsg->pCont + sizeof(SSubmitReq2Msg), pMsg->contLen - sizeof(SSubmitReq2Msg));
|
||||||
|
|
||||||
if (tStartDecode(pCoder) < 0) {
|
if (tStartDecode(pCoder) < 0) {
|
||||||
|
@ -1218,6 +1223,11 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
|
||||||
for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) {
|
for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) {
|
||||||
SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i);
|
SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i);
|
||||||
|
|
||||||
|
if (pSubmitTbData->pCreateTbReq && pSubmitTbData->pCreateTbReq->uid == 0) {
|
||||||
|
code = TSDB_CODE_INVALID_MSG;
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
||||||
if (TARRAY_SIZE(pSubmitTbData->aCol) <= 0) {
|
if (TARRAY_SIZE(pSubmitTbData->aCol) <= 0) {
|
||||||
code = TSDB_CODE_INVALID_MSG;
|
code = TSDB_CODE_INVALID_MSG;
|
||||||
|
@ -1531,6 +1541,14 @@ static int32_t vnodeProcessAlterConfigReq(SVnode *pVnode, int64_t version, void
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.sttTrigger != -1 && req.sttTrigger != pVnode->config.sttTrigger) {
|
||||||
|
pVnode->config.sttTrigger = req.sttTrigger;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req.minRows != -1 && req.minRows != pVnode->config.tsdbCfg.minRows) {
|
||||||
|
pVnode->config.tsdbCfg.minRows = req.minRows;
|
||||||
|
}
|
||||||
|
|
||||||
if (walChanged) {
|
if (walChanged) {
|
||||||
walAlter(pVnode->pWal, &pVnode->config.walCfg);
|
walAlter(pVnode->pWal, &pVnode->config.walCfg);
|
||||||
}
|
}
|
||||||
|
@ -1646,7 +1664,7 @@ _err:
|
||||||
}
|
}
|
||||||
static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) {
|
static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) {
|
||||||
SDropIndexReq req = {0};
|
SDropIndexReq req = {0};
|
||||||
pRsp->msgType = TDMT_VND_CREATE_INDEX_RSP;
|
pRsp->msgType = TDMT_VND_DROP_INDEX_RSP;
|
||||||
pRsp->code = TSDB_CODE_SUCCESS;
|
pRsp->code = TSDB_CODE_SUCCESS;
|
||||||
pRsp->pCont = NULL;
|
pRsp->pCont = NULL;
|
||||||
pRsp->contLen = 0;
|
pRsp->contLen = 0;
|
||||||
|
@ -1655,6 +1673,7 @@ static int32_t vnodeProcessDropIndexReq(SVnode *pVnode, int64_t version, void *p
|
||||||
terrno = TSDB_CODE_INVALID_MSG;
|
terrno = TSDB_CODE_INVALID_MSG;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (metaDropIndexFromSTable(pVnode->pMeta, version, &req) < 0) {
|
if (metaDropIndexFromSTable(pVnode->pMeta, version, &req) < 0) {
|
||||||
pRsp->code = terrno;
|
pRsp->code = terrno;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -121,7 +121,8 @@ enum {
|
||||||
STREAM_RECOVER_STEP__NONE = 0,
|
STREAM_RECOVER_STEP__NONE = 0,
|
||||||
STREAM_RECOVER_STEP__PREPARE1,
|
STREAM_RECOVER_STEP__PREPARE1,
|
||||||
STREAM_RECOVER_STEP__PREPARE2,
|
STREAM_RECOVER_STEP__PREPARE2,
|
||||||
STREAM_RECOVER_STEP__SCAN,
|
STREAM_RECOVER_STEP__SCAN1,
|
||||||
|
STREAM_RECOVER_STEP__SCAN2,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -957,9 +957,7 @@ static int32_t doFilterByTagCond(STableListInfo* pListInfo, SArray* pUidList, SN
|
||||||
STUidTagInfo* pInfo = taosArrayGet(pUidTagList, i);
|
STUidTagInfo* pInfo = taosArrayGet(pUidTagList, i);
|
||||||
taosArrayPush(pUidList, &pInfo->uid);
|
taosArrayPush(pUidList, &pInfo->uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
terrno = 0;
|
terrno = 0;
|
||||||
goto end;
|
|
||||||
} else {
|
} else {
|
||||||
if ((condType == FILTER_NO_LOGIC || condType == FILTER_AND) && status != SFLT_NOT_INDEX) {
|
if ((condType == FILTER_NO_LOGIC || condType == FILTER_AND) && status != SFLT_NOT_INDEX) {
|
||||||
code = metaGetTableTagsByUids(metaHandle, pListInfo->suid, pUidTagList);
|
code = metaGetTableTagsByUids(metaHandle, pListInfo->suid, pUidTagList);
|
||||||
|
|
|
@ -104,6 +104,12 @@ static void clearStreamBlock(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetTaskInfo(qTaskInfo_t tinfo) {
|
||||||
|
SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo;
|
||||||
|
pTaskInfo->code = 0;
|
||||||
|
clearStreamBlock(pTaskInfo->pRoot);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) {
|
static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) {
|
||||||
if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) {
|
||||||
if (pOperator->numOfDownstream == 0) {
|
if (pOperator->numOfDownstream == 0) {
|
||||||
|
@ -618,7 +624,7 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
|
||||||
pTaskInfo->cost.start = taosGetTimestampUs();
|
pTaskInfo->cost.start = taosGetTimestampUs();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTaskKilled(pTaskInfo) && pTaskInfo->code != TSDB_CODE_QRY_IN_EXEC) {
|
if (isTaskKilled(pTaskInfo)) {
|
||||||
clearStreamBlock(pTaskInfo->pRoot);
|
clearStreamBlock(pTaskInfo->pRoot);
|
||||||
atomic_store_64(&pTaskInfo->owner, 0);
|
atomic_store_64(&pTaskInfo->owner, 0);
|
||||||
qDebug("%s already killed, abort", GET_TASKID(pTaskInfo));
|
qDebug("%s already killed, abort", GET_TASKID(pTaskInfo));
|
||||||
|
@ -1102,11 +1108,8 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
|
||||||
STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info;
|
STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info;
|
||||||
int32_t numOfTables = tableListGetSize(pTaskInfo->pTableInfoList);
|
int32_t numOfTables = tableListGetSize(pTaskInfo->pTableInfoList);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
qDebug("switch to next table %" PRId64 " ts %" PRId64 "% "PRId64 " rows returned", uid, ts, pInfo->pTableScanOp->resultInfo.totalRows);
|
||||||
qDebug("switch to next table %" PRId64 " (cursor %d), %" PRId64 " rows returned", uid,
|
|
||||||
pTableScanInfo->currentTable, pInfo->pTableScanOp->resultInfo.totalRows);
|
|
||||||
pInfo->pTableScanOp->resultInfo.totalRows = 0;
|
pInfo->pTableScanOp->resultInfo.totalRows = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int32_t i = 0; i < numOfTables; i++) {
|
for (int32_t i = 0; i < numOfTables; i++) {
|
||||||
|
|
|
@ -946,6 +946,7 @@ SOperatorInfo* createTableSeqScanOperatorInfo(void* pReadHandle, SExecTaskInfo*
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) {
|
FORCE_INLINE void doClearBufferedBlocks(SStreamScanInfo* pInfo) {
|
||||||
|
qDebug("clear buff blocks:%d", (int32_t)taosArrayGetSize(pInfo->pBlockLists));
|
||||||
taosArrayClear(pInfo->pBlockLists);
|
taosArrayClear(pInfo->pBlockLists);
|
||||||
pInfo->validBlockIndex = 0;
|
pInfo->validBlockIndex = 0;
|
||||||
}
|
}
|
||||||
|
@ -1609,8 +1610,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
|
||||||
if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
if (pTaskInfo->streamInfo.prepareStatus.type == TMQ_OFFSET__SNAPSHOT_DATA) {
|
||||||
SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp);
|
SSDataBlock* pResult = doTableScan(pInfo->pTableScanOp);
|
||||||
if (pResult && pResult->info.rows > 0) {
|
if (pResult && pResult->info.rows > 0) {
|
||||||
qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64, pResult->info.rows,
|
|
||||||
pResult->info.window.skey, pResult->info.window.ekey);
|
|
||||||
qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64, pResult->info.rows,
|
qDebug("queue scan tsdb return %d rows min:%" PRId64 " max:%" PRId64 " wal curVersion:%" PRId64, pResult->info.rows,
|
||||||
pResult->info.window.skey, pResult->info.window.ekey, pInfo->tqReader->pWalReader->curVersion);
|
pResult->info.window.skey, pResult->info.window.ekey, pInfo->tqReader->pWalReader->curVersion);
|
||||||
pTaskInfo->streamInfo.returned = 1;
|
pTaskInfo->streamInfo.returned = 1;
|
||||||
|
@ -1726,9 +1725,9 @@ static void setBlockGroupIdByUid(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doCheckUpdate(SStreamScanInfo* pInfo, TSKEY endKey) {
|
static void doCheckUpdate(SStreamScanInfo* pInfo, TSKEY endKey, SSDataBlock* pBlock) {
|
||||||
if (pInfo->pUpdateInfo) {
|
if (pInfo->pUpdateInfo) {
|
||||||
checkUpdateData(pInfo, true, pInfo->pRes, true);
|
checkUpdateData(pInfo, true, pBlock, true);
|
||||||
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, endKey);
|
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, endKey);
|
||||||
if (pInfo->pUpdateDataRes->info.rows > 0) {
|
if (pInfo->pUpdateDataRes->info.rows > 0) {
|
||||||
pInfo->updateResIndex = 0;
|
pInfo->updateResIndex = 0;
|
||||||
|
@ -1760,11 +1759,13 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
|
||||||
pTSInfo->base.cond.endVersion = pTaskInfo->streamInfo.fillHistoryVer1;
|
pTSInfo->base.cond.endVersion = pTaskInfo->streamInfo.fillHistoryVer1;
|
||||||
qDebug("stream recover step 1, from %" PRId64 " to %" PRId64, pTSInfo->base.cond.startVersion,
|
qDebug("stream recover step 1, from %" PRId64 " to %" PRId64, pTSInfo->base.cond.startVersion,
|
||||||
pTSInfo->base.cond.endVersion);
|
pTSInfo->base.cond.endVersion);
|
||||||
|
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN1;
|
||||||
} else {
|
} else {
|
||||||
pTSInfo->base.cond.startVersion = pTaskInfo->streamInfo.fillHistoryVer1 + 1;
|
pTSInfo->base.cond.startVersion = pTaskInfo->streamInfo.fillHistoryVer1 + 1;
|
||||||
pTSInfo->base.cond.endVersion = pTaskInfo->streamInfo.fillHistoryVer2;
|
pTSInfo->base.cond.endVersion = pTaskInfo->streamInfo.fillHistoryVer2;
|
||||||
qDebug("stream recover step 2, from %" PRId64 " to %" PRId64, pTSInfo->base.cond.startVersion,
|
qDebug("stream recover step 2, from %" PRId64 " to %" PRId64, pTSInfo->base.cond.startVersion,
|
||||||
pTSInfo->base.cond.endVersion);
|
pTSInfo->base.cond.endVersion);
|
||||||
|
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*resetTableScanInfo(pTSInfo, pWin);*/
|
/*resetTableScanInfo(pTSInfo, pWin);*/
|
||||||
|
@ -1776,11 +1777,11 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
pTSInfo->scanTimes = 0;
|
pTSInfo->scanTimes = 0;
|
||||||
pTSInfo->currentGroupId = -1;
|
pTSInfo->currentGroupId = -1;
|
||||||
pTaskInfo->streamInfo.recoverStep = STREAM_RECOVER_STEP__SCAN;
|
|
||||||
pTaskInfo->streamInfo.recoverScanFinished = false;
|
pTaskInfo->streamInfo.recoverScanFinished = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN) {
|
if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN1 ||
|
||||||
|
pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN2) {
|
||||||
if (pInfo->blockRecoverContiCnt > 100) {
|
if (pInfo->blockRecoverContiCnt > 100) {
|
||||||
pInfo->blockRecoverTotCnt += pInfo->blockRecoverContiCnt;
|
pInfo->blockRecoverTotCnt += pInfo->blockRecoverContiCnt;
|
||||||
pInfo->blockRecoverContiCnt = 0;
|
pInfo->blockRecoverContiCnt = 0;
|
||||||
|
@ -1793,6 +1794,27 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
|
||||||
printDataBlock(pInfo->pRecoverRes, "scan recover");
|
printDataBlock(pInfo->pRecoverRes, "scan recover");
|
||||||
return pInfo->pRecoverRes;
|
return pInfo->pRecoverRes;
|
||||||
} break;
|
} break;
|
||||||
|
case STREAM_SCAN_FROM_UPDATERES: {
|
||||||
|
generateScanRange(pInfo, pInfo->pUpdateDataRes, pInfo->pUpdateRes);
|
||||||
|
prepareRangeScan(pInfo, pInfo->pUpdateRes, &pInfo->updateResIndex);
|
||||||
|
pInfo->scanMode = STREAM_SCAN_FROM_DATAREADER_RANGE;
|
||||||
|
return pInfo->pUpdateRes;
|
||||||
|
} break;
|
||||||
|
case STREAM_SCAN_FROM_DATAREADER_RANGE: {
|
||||||
|
SSDataBlock* pSDB = doRangeScan(pInfo, pInfo->pUpdateRes, pInfo->primaryTsIndex, &pInfo->updateResIndex);
|
||||||
|
if (pSDB) {
|
||||||
|
STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info;
|
||||||
|
uint64_t version = getReaderMaxVersion(pTableScanInfo->base.dataReader);
|
||||||
|
updateInfoSetScanRange(pInfo->pUpdateInfo, &pTableScanInfo->base.cond.twindows, pInfo->groupId, version);
|
||||||
|
pSDB->info.type = pInfo->scanMode == STREAM_SCAN_FROM_DATAREADER_RANGE ? STREAM_NORMAL : STREAM_PULL_DATA;
|
||||||
|
checkUpdateData(pInfo, true, pSDB, false);
|
||||||
|
// printDataBlock(pSDB, "stream scan update");
|
||||||
|
calBlockTbName(pInfo, pSDB);
|
||||||
|
return pSDB;
|
||||||
|
}
|
||||||
|
blockDataCleanup(pInfo->pUpdateDataRes);
|
||||||
|
pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE;
|
||||||
|
} break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1802,8 +1824,12 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
|
||||||
pInfo->blockRecoverContiCnt++;
|
pInfo->blockRecoverContiCnt++;
|
||||||
calBlockTbName(pInfo, pInfo->pRecoverRes);
|
calBlockTbName(pInfo, pInfo->pRecoverRes);
|
||||||
if (pInfo->pUpdateInfo) {
|
if (pInfo->pUpdateInfo) {
|
||||||
TSKEY maxTs = updateInfoFillBlockData(pInfo->pUpdateInfo, pInfo->pRecoverRes, pInfo->primaryTsIndex);
|
if (pTaskInfo->streamInfo.recoverStep == STREAM_RECOVER_STEP__SCAN1) {
|
||||||
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs);
|
TSKEY maxTs = updateInfoFillBlockData(pInfo->pUpdateInfo, pInfo->pRecoverRes, pInfo->primaryTsIndex);
|
||||||
|
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs);
|
||||||
|
} else {
|
||||||
|
doCheckUpdate(pInfo, pInfo->pRecoverRes->info.window.ekey, pInfo->pRecoverRes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pInfo->pCreateTbRes->info.rows > 0) {
|
if (pInfo->pCreateTbRes->info.rows > 0) {
|
||||||
pInfo->scanMode = STREAM_SCAN_FROM_RES;
|
pInfo->scanMode = STREAM_SCAN_FROM_RES;
|
||||||
|
@ -1916,7 +1942,7 @@ FETCH_NEXT_BLOCK:
|
||||||
switch (pInfo->scanMode) {
|
switch (pInfo->scanMode) {
|
||||||
case STREAM_SCAN_FROM_RES: {
|
case STREAM_SCAN_FROM_RES: {
|
||||||
pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE;
|
pInfo->scanMode = STREAM_SCAN_FROM_READERHANDLE;
|
||||||
doCheckUpdate(pInfo, pInfo->pRes->info.window.ekey);
|
doCheckUpdate(pInfo, pInfo->pRes->info.window.ekey, pInfo->pRes);
|
||||||
doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
|
doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
|
||||||
pInfo->pRes->info.dataLoad = 1;
|
pInfo->pRes->info.dataLoad = 1;
|
||||||
blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex);
|
blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex);
|
||||||
|
@ -2017,7 +2043,7 @@ FETCH_NEXT_BLOCK:
|
||||||
return pInfo->pCreateTbRes;
|
return pInfo->pCreateTbRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCheckUpdate(pInfo, pBlockInfo->window.ekey);
|
doCheckUpdate(pInfo, pBlockInfo->window.ekey, pInfo->pRes);
|
||||||
doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
|
doFilter(pInfo->pRes, pOperator->exprSupp.pFilterInfo, NULL);
|
||||||
pInfo->pRes->info.dataLoad = 1;
|
pInfo->pRes->info.dataLoad = 1;
|
||||||
blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex);
|
blockDataUpdateTsWindow(pInfo->pRes, pInfo->primaryTsIndex);
|
||||||
|
|
|
@ -4805,10 +4805,9 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
setInverFunction(pSup->pCtx, pOperator->exprSupp.numOfExprs, pBlock->info.type);
|
setInverFunction(pSup->pCtx, pOperator->exprSupp.numOfExprs, pBlock->info.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap);
|
||||||
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey);
|
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, pBlock->info.window.ekey);
|
||||||
pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey);
|
pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, pBlock->info.window.skey);
|
||||||
|
|
||||||
doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pInfo->pUpdatedMap);
|
|
||||||
}
|
}
|
||||||
pOperator->status = OP_RES_TO_RETURN;
|
pOperator->status = OP_RES_TO_RETURN;
|
||||||
removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins);
|
removeDeleteResults(pInfo->pUpdatedMap, pInfo->pDelWins);
|
||||||
|
|
|
@ -2462,6 +2462,9 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer
|
||||||
int32_t numOfElems = 0;
|
int32_t numOfElems = 0;
|
||||||
|
|
||||||
for (int32_t i = start; i < start + pInput->numOfRows; ++i) {
|
for (int32_t i = start; i < start + pInput->numOfRows; ++i) {
|
||||||
|
if (colDataIsNull_s(pCol, i)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
char* data = colDataGetData(pCol, i);
|
char* data = colDataGetData(pCol, i);
|
||||||
SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data);
|
SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data);
|
||||||
int32_t code = firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i);
|
int32_t code = firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i);
|
||||||
|
|
|
@ -1462,7 +1462,7 @@ SListCell* nodesListErase(SNodeList* pList, SListCell* pCell) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc) {
|
void nodesListInsertList(SNodeList* pTarget, SListCell* pPos, SNodeList* pSrc) {
|
||||||
if (NULL == pTarget || NULL == pPos || NULL == pSrc) {
|
if (NULL == pTarget || NULL == pPos || NULL == pSrc || NULL == pSrc->pHead) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, STo
|
||||||
SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions);
|
SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions);
|
||||||
SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
SNode* createFlushDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
||||||
SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed);
|
SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t maxSpeed);
|
||||||
SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName);
|
SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd);
|
||||||
SNode* createDefaultTableOptions(SAstCreateContext* pCxt);
|
SNode* createDefaultTableOptions(SAstCreateContext* pCxt);
|
||||||
SNode* createAlterTableOptions(SAstCreateContext* pCxt);
|
SNode* createAlterTableOptions(SAstCreateContext* pCxt);
|
||||||
SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal);
|
SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, void* pVal);
|
||||||
|
|
|
@ -167,7 +167,7 @@ cmd ::= USE db_name(A).
|
||||||
cmd ::= ALTER DATABASE db_name(A) alter_db_options(B). { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &A, B); }
|
cmd ::= ALTER DATABASE db_name(A) alter_db_options(B). { pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &A, B); }
|
||||||
cmd ::= FLUSH DATABASE db_name(A). { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &A); }
|
cmd ::= FLUSH DATABASE db_name(A). { pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &A); }
|
||||||
cmd ::= TRIM DATABASE db_name(A) speed_opt(B). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A, B); }
|
cmd ::= TRIM DATABASE db_name(A) speed_opt(B). { pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &A, B); }
|
||||||
cmd ::= COMPACT DATABASE db_name(A). { pCxt->pRootNode = createCompactStmt(pCxt, &A); }
|
cmd ::= COMPACT DATABASE db_name(A) start_opt(B) end_opt(C). { pCxt->pRootNode = createCompactStmt(pCxt, &A, B, C); }
|
||||||
|
|
||||||
%type not_exists_opt { bool }
|
%type not_exists_opt { bool }
|
||||||
%destructor not_exists_opt { }
|
%destructor not_exists_opt { }
|
||||||
|
@ -236,6 +236,7 @@ alter_db_option(A) ::= REPLICA NK_INTEGER(B).
|
||||||
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
|
//alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; }
|
||||||
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
|
alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; }
|
||||||
alter_db_option(A) ::= STT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_STT_TRIGGER; A.val = B; }
|
alter_db_option(A) ::= STT_TRIGGER NK_INTEGER(B). { A.type = DB_OPTION_STT_TRIGGER; A.val = B; }
|
||||||
|
alter_db_option(A) ::= MINROWS NK_INTEGER(B). { A.type = DB_OPTION_MINROWS; A.val = B; }
|
||||||
|
|
||||||
%type integer_list { SNodeList* }
|
%type integer_list { SNodeList* }
|
||||||
%destructor integer_list { nodesDestroyList($$); }
|
%destructor integer_list { nodesDestroyList($$); }
|
||||||
|
@ -259,6 +260,16 @@ retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C).
|
||||||
speed_opt(A) ::= . { A = 0; }
|
speed_opt(A) ::= . { A = 0; }
|
||||||
speed_opt(A) ::= MAX_SPEED NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); }
|
speed_opt(A) ::= MAX_SPEED NK_INTEGER(B). { A = taosStr2Int32(B.z, NULL, 10); }
|
||||||
|
|
||||||
|
start_opt(A) ::= . { A = NULL; }
|
||||||
|
start_opt(A) ::= START WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); }
|
||||||
|
start_opt(A) ::= START WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); }
|
||||||
|
start_opt(A) ::= START WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); }
|
||||||
|
|
||||||
|
end_opt(A) ::= . { A = NULL; }
|
||||||
|
end_opt(A) ::= END WITH NK_INTEGER(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); }
|
||||||
|
end_opt(A) ::= END WITH NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); }
|
||||||
|
end_opt(A) ::= END WITH TIMESTAMP NK_STRING(B). { A = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &B); }
|
||||||
|
|
||||||
/************************************************ create/drop table/stable ********************************************/
|
/************************************************ create/drop table/stable ********************************************/
|
||||||
cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B)
|
cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B)
|
||||||
NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); }
|
NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); }
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ SNode* createTrimDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, int32_t
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) {
|
SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pStart, SNode* pEnd) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
if (!checkDbName(pCxt, pDbName, false)) {
|
if (!checkDbName(pCxt, pDbName, false)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1113,6 +1113,8 @@ SNode* createCompactStmt(SAstCreateContext* pCxt, SToken* pDbName) {
|
||||||
SCompactDatabaseStmt* pStmt = (SCompactDatabaseStmt*)nodesMakeNode(QUERY_NODE_COMPACT_DATABASE_STMT);
|
SCompactDatabaseStmt* pStmt = (SCompactDatabaseStmt*)nodesMakeNode(QUERY_NODE_COMPACT_DATABASE_STMT);
|
||||||
CHECK_OUT_OF_MEM(pStmt);
|
CHECK_OUT_OF_MEM(pStmt);
|
||||||
COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName);
|
COPY_STRING_FORM_ID_TOKEN(pStmt->dbName, pDbName);
|
||||||
|
pStmt->pStart = pStart;
|
||||||
|
pStmt->pEnd = pEnd;
|
||||||
return (SNode*)pStmt;
|
return (SNode*)pStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,8 @@ static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, const c
|
||||||
code = reserveDnodeRequiredInCache(pCxt->pMetaCache);
|
code = reserveDnodeRequiredInCache(pCxt->pMetaCache);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code &&
|
if (TSDB_CODE_SUCCESS == code &&
|
||||||
(0 == strcmp(pTable, TSDB_INS_TABLE_TAGS) || 0 == strcmp(pTable, TSDB_INS_TABLE_TABLES) || 0 == strcmp(pTable, TSDB_INS_TABLE_COLS)) &&
|
(0 == strcmp(pTable, TSDB_INS_TABLE_TAGS) || 0 == strcmp(pTable, TSDB_INS_TABLE_TABLES) ||
|
||||||
|
0 == strcmp(pTable, TSDB_INS_TABLE_COLS)) &&
|
||||||
QUERY_NODE_SELECT_STMT == nodeType(pCxt->pStmt)) {
|
QUERY_NODE_SELECT_STMT == nodeType(pCxt->pStmt)) {
|
||||||
code = collectMetaKeyFromInsTags(pCxt);
|
code = collectMetaKeyFromInsTags(pCxt);
|
||||||
}
|
}
|
||||||
|
@ -605,6 +606,10 @@ static int32_t collectMetaKeyFromShowSubscriptions(SCollectMetaKeyCxt* pCxt, SSh
|
||||||
pCxt->pMetaCache);
|
pCxt->pMetaCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t collectMetaKeyFromCompactDatabase(SCollectMetaKeyCxt* pCxt, SCompactDatabaseStmt* pStmt) {
|
||||||
|
return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
pCxt->pStmt = pStmt;
|
pCxt->pStmt = pStmt;
|
||||||
switch (nodeType(pStmt)) {
|
switch (nodeType(pStmt)) {
|
||||||
|
@ -636,6 +641,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
|
||||||
return collectMetaKeyFromExplain(pCxt, (SExplainStmt*)pStmt);
|
return collectMetaKeyFromExplain(pCxt, (SExplainStmt*)pStmt);
|
||||||
case QUERY_NODE_DESCRIBE_STMT:
|
case QUERY_NODE_DESCRIBE_STMT:
|
||||||
return collectMetaKeyFromDescribe(pCxt, (SDescribeStmt*)pStmt);
|
return collectMetaKeyFromDescribe(pCxt, (SDescribeStmt*)pStmt);
|
||||||
|
case QUERY_NODE_COMPACT_DATABASE_STMT:
|
||||||
|
return collectMetaKeyFromCompactDatabase(pCxt, (SCompactDatabaseStmt*)pStmt);
|
||||||
case QUERY_NODE_CREATE_STREAM_STMT:
|
case QUERY_NODE_CREATE_STREAM_STMT:
|
||||||
return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt);
|
return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt);
|
||||||
case QUERY_NODE_SHOW_DNODES_STMT:
|
case QUERY_NODE_SHOW_DNODES_STMT:
|
||||||
|
|
|
@ -201,6 +201,7 @@ int32_t smlBuildCol(STableDataCxt* pTableCxt, SSchema* schema, void* data, int32
|
||||||
SSmlKv* kv = (SSmlKv*)data;
|
SSmlKv* kv = (SSmlKv*)data;
|
||||||
if(kv->keyLen != strlen(pColSchema->name) || memcmp(kv->key, pColSchema->name, kv->keyLen) != 0 || kv->type != pColSchema->type){
|
if(kv->keyLen != strlen(pColSchema->name) || memcmp(kv->key, pColSchema->name, kv->keyLen) != 0 || kv->type != pColSchema->type){
|
||||||
ret = TSDB_CODE_SML_INVALID_DATA;
|
ret = TSDB_CODE_SML_INVALID_DATA;
|
||||||
|
uError("SML smlBuildCol error col not same %s", pColSchema->name);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (kv->type == TSDB_DATA_TYPE_NCHAR) {
|
if (kv->type == TSDB_DATA_TYPE_NCHAR) {
|
||||||
|
|
|
@ -2500,6 +2500,11 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) {
|
||||||
STempTableNode* pTempTable = (STempTableNode*)pTable;
|
STempTableNode* pTempTable = (STempTableNode*)pTable;
|
||||||
code = translateSubquery(pCxt, pTempTable->pSubquery);
|
code = translateSubquery(pCxt, pTempTable->pSubquery);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
if (QUERY_NODE_SELECT_STMT == nodeType(pTempTable->pSubquery) &&
|
||||||
|
((SSelectStmt*)pTempTable->pSubquery)->isEmptyResult && isSelectStmt(pCxt->pCurrStmt)) {
|
||||||
|
((SSelectStmt*)pCxt->pCurrStmt)->isEmptyResult = true;
|
||||||
|
}
|
||||||
|
|
||||||
pTempTable->table.precision = getStmtPrecision(pTempTable->pSubquery);
|
pTempTable->table.precision = getStmtPrecision(pTempTable->pSubquery);
|
||||||
pTempTable->table.singleTable = stmtIsSingleTable(pTempTable->pSubquery);
|
pTempTable->table.singleTable = stmtIsSingleTable(pTempTable->pSubquery);
|
||||||
code = addNamespace(pCxt, pTempTable);
|
code = addNamespace(pCxt, pTempTable);
|
||||||
|
@ -2929,6 +2934,9 @@ static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = translateFillValues(pCxt, pSelect);
|
code = translateFillValues(pCxt, pSelect);
|
||||||
}
|
}
|
||||||
|
if (NULL == pSelect->pProjectionList || 0 >= pSelect->pProjectionList->length) {
|
||||||
|
code = TSDB_CODE_PAR_INVALID_SELECTED_EXPR;
|
||||||
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4245,6 +4253,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt,
|
||||||
pReq->cacheLastSize = pStmt->pOptions->cacheLastSize;
|
pReq->cacheLastSize = pStmt->pOptions->cacheLastSize;
|
||||||
pReq->replications = pStmt->pOptions->replica;
|
pReq->replications = pStmt->pOptions->replica;
|
||||||
pReq->sstTrigger = pStmt->pOptions->sstTrigger;
|
pReq->sstTrigger = pStmt->pOptions->sstTrigger;
|
||||||
|
pReq->minRows = pStmt->pOptions->minRowsPerBlock;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5564,7 +5573,8 @@ static int32_t checkCreateTopic(STranslateContext* pCxt, SCreateTopicStmt* pStmt
|
||||||
|
|
||||||
if (QUERY_NODE_SELECT_STMT == nodeType(pStmt->pQuery)) {
|
if (QUERY_NODE_SELECT_STMT == nodeType(pStmt->pQuery)) {
|
||||||
SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
|
SSelectStmt* pSelect = (SSelectStmt*)pStmt->pQuery;
|
||||||
if (!pSelect->isDistinct && QUERY_NODE_REAL_TABLE == nodeType(pSelect->pFromTable) &&
|
if (!pSelect->isDistinct &&
|
||||||
|
(NULL != pSelect->pFromTable && QUERY_NODE_REAL_TABLE == nodeType(pSelect->pFromTable)) &&
|
||||||
NULL == pSelect->pGroupByList && NULL == pSelect->pLimit && NULL == pSelect->pSlimit &&
|
NULL == pSelect->pGroupByList && NULL == pSelect->pLimit && NULL == pSelect->pSlimit &&
|
||||||
NULL == pSelect->pOrderByList && NULL == pSelect->pPartitionByList) {
|
NULL == pSelect->pOrderByList && NULL == pSelect->pPartitionByList) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -5626,12 +5636,36 @@ static int32_t translateDescribe(STranslateContext* pCxt, SDescribeStmt* pStmt)
|
||||||
return refreshGetTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta);
|
return refreshGetTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pStmt->pMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t translateCompactRange(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt, SCompactDbReq* pReq) {
|
||||||
|
SDbCfgInfo dbCfg = {0};
|
||||||
|
int32_t code = getDBCfg(pCxt, pStmt->dbName, &dbCfg);
|
||||||
|
if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pStart) {
|
||||||
|
((SValueNode*)pStmt->pStart)->node.resType.precision = dbCfg.precision;
|
||||||
|
((SValueNode*)pStmt->pStart)->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||||
|
code = doTranslateValue(pCxt, (SValueNode*)pStmt->pStart);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code && NULL != pStmt->pEnd) {
|
||||||
|
((SValueNode*)pStmt->pEnd)->node.resType.precision = dbCfg.precision;
|
||||||
|
((SValueNode*)pStmt->pEnd)->node.resType.type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||||
|
code = doTranslateValue(pCxt, (SValueNode*)pStmt->pEnd);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
pReq->timeRange.skey = NULL != pStmt->pStart ? ((SValueNode*)pStmt->pStart)->datum.i : INT64_MIN;
|
||||||
|
pReq->timeRange.ekey = NULL != pStmt->pEnd ? ((SValueNode*)pStmt->pEnd)->datum.i : INT64_MAX;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t translateCompact(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt) {
|
static int32_t translateCompact(STranslateContext* pCxt, SCompactDatabaseStmt* pStmt) {
|
||||||
SCompactDbReq compactReq = {0};
|
SCompactDbReq compactReq = {0};
|
||||||
SName name;
|
SName name;
|
||||||
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
||||||
tNameGetFullDbName(&name, compactReq.db);
|
tNameGetFullDbName(&name, compactReq.db);
|
||||||
return buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq);
|
int32_t code = translateCompactRange(pCxt, pStmt, &compactReq);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = buildCmdMsg(pCxt, TDMT_MND_COMPACT_DB, (FSerializeFunc)tSerializeSCompactDbReq, &compactReq);
|
||||||
|
}
|
||||||
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateKillConnection(STranslateContext* pCxt, SKillStmt* pStmt) {
|
static int32_t translateKillConnection(STranslateContext* pCxt, SKillStmt* pStmt) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -226,6 +226,7 @@ void generateDatabases(MockCatalogService* mcs) {
|
||||||
generateTestTables(g_mockCatalogService.get(), "cache_db");
|
generateTestTables(g_mockCatalogService.get(), "cache_db");
|
||||||
generateTestStables(g_mockCatalogService.get(), "cache_db");
|
generateTestStables(g_mockCatalogService.get(), "cache_db");
|
||||||
mcs->createDatabase("rollup_db", true);
|
mcs->createDatabase("rollup_db", true);
|
||||||
|
mcs->createDatabase("testus", false, 0, TSDB_TIME_PRECISION_NANO);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -252,7 +253,8 @@ int32_t __catalogGetCachedTableHashVgroup(SCatalog* pCtg, const SName* pTableNam
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup, STableMeta** pTableMeta) {
|
int32_t __catalogGetCachedTableVgMeta(SCatalog* pCtg, const SName* pTableName, SVgroupInfo* pVgroup,
|
||||||
|
STableMeta** pTableMeta) {
|
||||||
int32_t code = g_mockCatalogService->catalogGetTableMeta(pTableName, pTableMeta, true);
|
int32_t code = g_mockCatalogService->catalogGetTableMeta(pTableName, pTableMeta, true);
|
||||||
if (code) return code;
|
if (code) return code;
|
||||||
code = g_mockCatalogService->catalogGetTableHashVgroup(pTableName, pVgroup, true);
|
code = g_mockCatalogService->catalogGetTableHashVgroup(pTableName, pVgroup, true);
|
||||||
|
|
|
@ -346,12 +346,13 @@ class MockCatalogServiceImpl {
|
||||||
dnode_.insert(std::make_pair(dnodeId, epSet));
|
dnode_.insert(std::make_pair(dnodeId, epSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
void createDatabase(const string& db, bool rollup, int8_t cacheLast) {
|
void createDatabase(const string& db, bool rollup, int8_t cacheLast, int8_t precision) {
|
||||||
SDbCfgInfo cfg = {0};
|
SDbCfgInfo cfg = {0};
|
||||||
if (rollup) {
|
if (rollup) {
|
||||||
cfg.pRetensions = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SRetention));
|
cfg.pRetensions = taosArrayInit(TARRAY_MIN_SIZE, sizeof(SRetention));
|
||||||
}
|
}
|
||||||
cfg.cacheLast = cacheLast;
|
cfg.cacheLast = cacheLast;
|
||||||
|
cfg.precision = precision;
|
||||||
dbCfg_.insert(std::make_pair(db, cfg));
|
dbCfg_.insert(std::make_pair(db, cfg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,8 +682,8 @@ void MockCatalogService::createDnode(int32_t dnodeId, const string& host, int16_
|
||||||
impl_->createDnode(dnodeId, host, port);
|
impl_->createDnode(dnodeId, host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MockCatalogService::createDatabase(const string& db, bool rollup, int8_t cacheLast) {
|
void MockCatalogService::createDatabase(const string& db, bool rollup, int8_t cacheLast, int8_t precision) {
|
||||||
impl_->createDatabase(db, rollup, cacheLast);
|
impl_->createDatabase(db, rollup, cacheLast, precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta,
|
int32_t MockCatalogService::catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta,
|
||||||
|
|
|
@ -65,7 +65,8 @@ class MockCatalogService {
|
||||||
void createFunction(const std::string& func, int8_t funcType, int8_t outputType, int32_t outputLen, int32_t bufSize);
|
void createFunction(const std::string& func, int8_t funcType, int8_t outputType, int32_t outputLen, int32_t bufSize);
|
||||||
void createSmaIndex(const SMCreateSmaReq* pReq);
|
void createSmaIndex(const SMCreateSmaReq* pReq);
|
||||||
void createDnode(int32_t dnodeId, const std::string& host, int16_t port);
|
void createDnode(int32_t dnodeId, const std::string& host, int16_t port);
|
||||||
void createDatabase(const std::string& db, bool rollup = false, int8_t cacheLast = 0);
|
void createDatabase(const std::string& db, bool rollup = false, int8_t cacheLast = 0,
|
||||||
|
int8_t precision = TSDB_TIME_PRECISION_MILLI);
|
||||||
|
|
||||||
int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta, bool onlyCache = false) const;
|
int32_t catalogGetTableMeta(const SName* pTableName, STableMeta** pTableMeta, bool onlyCache = false) const;
|
||||||
int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo, bool onlyCache = false) const;
|
int32_t catalogGetTableHashVgroup(const SName* pTableName, SVgroupInfo* vgInfo, bool onlyCache = false) const;
|
||||||
|
|
|
@ -108,6 +108,7 @@ TEST_F(ParserInitialATest, alterDnode) {
|
||||||
* | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica
|
* | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica
|
||||||
* | WAL_LEVEL int_value -- enum 1, 2, default 1
|
* | WAL_LEVEL int_value -- enum 1, 2, default 1
|
||||||
* | STT_TRIGGER int_value -- rang [1, 16], default 8
|
* | STT_TRIGGER int_value -- rang [1, 16], default 8
|
||||||
|
* | MINROWS int_value -- rang [10, 1000], default 100
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
TEST_F(ParserInitialATest, alterDatabase) {
|
TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
|
@ -133,6 +134,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
expect.cacheLastSize = -1;
|
expect.cacheLastSize = -1;
|
||||||
expect.replications = -1;
|
expect.replications = -1;
|
||||||
expect.sstTrigger = -1;
|
expect.sstTrigger = -1;
|
||||||
|
expect.minRows = -1;
|
||||||
};
|
};
|
||||||
auto setAlterDbBuffer = [&](int32_t buffer) { expect.buffer = buffer; };
|
auto setAlterDbBuffer = [&](int32_t buffer) { expect.buffer = buffer; };
|
||||||
auto setAlterDbPageSize = [&](int32_t pageSize) { expect.pageSize = pageSize; };
|
auto setAlterDbPageSize = [&](int32_t pageSize) { expect.pageSize = pageSize; };
|
||||||
|
@ -150,6 +152,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
auto setAlterDbCacheModel = [&](int8_t cacheModel) { expect.cacheLast = cacheModel; };
|
auto setAlterDbCacheModel = [&](int8_t cacheModel) { expect.cacheLast = cacheModel; };
|
||||||
auto setAlterDbReplica = [&](int8_t replications) { expect.replications = replications; };
|
auto setAlterDbReplica = [&](int8_t replications) { expect.replications = replications; };
|
||||||
auto setAlterDbSttTrigger = [&](int8_t sstTrigger) { expect.sstTrigger = sstTrigger; };
|
auto setAlterDbSttTrigger = [&](int8_t sstTrigger) { expect.sstTrigger = sstTrigger; };
|
||||||
|
auto setAlterDbMinRows = [&](int32_t minRows) { expect.minRows = minRows; };
|
||||||
|
|
||||||
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
||||||
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DATABASE_STMT);
|
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_ALTER_DATABASE_STMT);
|
||||||
|
@ -170,6 +173,7 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
ASSERT_EQ(req.cacheLast, expect.cacheLast);
|
ASSERT_EQ(req.cacheLast, expect.cacheLast);
|
||||||
ASSERT_EQ(req.replications, expect.replications);
|
ASSERT_EQ(req.replications, expect.replications);
|
||||||
ASSERT_EQ(req.sstTrigger, expect.sstTrigger);
|
ASSERT_EQ(req.sstTrigger, expect.sstTrigger);
|
||||||
|
ASSERT_EQ(req.minRows, expect.minRows);
|
||||||
});
|
});
|
||||||
|
|
||||||
const int32_t MINUTE_PER_DAY = MILLISECOND_PER_DAY / MILLISECOND_PER_MINUTE;
|
const int32_t MINUTE_PER_DAY = MILLISECOND_PER_DAY / MILLISECOND_PER_MINUTE;
|
||||||
|
@ -277,6 +281,15 @@ TEST_F(ParserInitialATest, alterDatabase) {
|
||||||
setAlterDbSttTrigger(16);
|
setAlterDbSttTrigger(16);
|
||||||
run("ALTER DATABASE test STT_TRIGGER 16");
|
run("ALTER DATABASE test STT_TRIGGER 16");
|
||||||
clearAlterDbReq();
|
clearAlterDbReq();
|
||||||
|
|
||||||
|
initAlterDb("test");
|
||||||
|
setAlterDbMinRows(10);
|
||||||
|
run("ALTER DATABASE test MINROWS 10");
|
||||||
|
setAlterDbMinRows(50);
|
||||||
|
run("ALTER DATABASE test MINROWS 50");
|
||||||
|
setAlterDbMinRows(1000);
|
||||||
|
run("ALTER DATABASE test MINROWS 1000");
|
||||||
|
clearAlterDbReq();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) {
|
TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) {
|
||||||
|
|
|
@ -22,12 +22,16 @@ namespace ParserTest {
|
||||||
class ParserInitialCTest : public ParserDdlTest {};
|
class ParserInitialCTest : public ParserDdlTest {};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* COMPACT DATABASE db_name
|
* COMPACT DATABASE db_name [START WITH start_time] [END WITH END_time]
|
||||||
*/
|
*/
|
||||||
TEST_F(ParserInitialCTest, compact) {
|
TEST_F(ParserInitialCTest, compact) {
|
||||||
SCompactDbReq expect = {0};
|
SCompactDbReq expect = {0};
|
||||||
|
|
||||||
auto setCompactDbReq = [&](const char* pDb) { snprintf(expect.db, sizeof(expect.db), "0.%s", pDb); };
|
auto setCompactDbReq = [&](const char* pDb, int64_t start = INT64_MIN, int64_t end = INT64_MAX) {
|
||||||
|
snprintf(expect.db, sizeof(expect.db), "0.%s", pDb);
|
||||||
|
expect.timeRange.skey = start;
|
||||||
|
expect.timeRange.ekey = end;
|
||||||
|
};
|
||||||
|
|
||||||
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) {
|
||||||
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_COMPACT_DATABASE_STMT);
|
ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_COMPACT_DATABASE_STMT);
|
||||||
|
@ -35,10 +39,21 @@ TEST_F(ParserInitialCTest, compact) {
|
||||||
SCompactDbReq req = {0};
|
SCompactDbReq req = {0};
|
||||||
ASSERT_EQ(tDeserializeSCompactDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS);
|
ASSERT_EQ(tDeserializeSCompactDbReq(pQuery->pCmdMsg->pMsg, pQuery->pCmdMsg->msgLen, &req), TSDB_CODE_SUCCESS);
|
||||||
ASSERT_EQ(std::string(req.db), std::string(expect.db));
|
ASSERT_EQ(std::string(req.db), std::string(expect.db));
|
||||||
|
ASSERT_EQ(req.timeRange.skey, expect.timeRange.skey);
|
||||||
|
ASSERT_EQ(req.timeRange.ekey, expect.timeRange.ekey);
|
||||||
});
|
});
|
||||||
|
|
||||||
setCompactDbReq("wxy_db");
|
setCompactDbReq("test");
|
||||||
run("COMPACT DATABASE wxy_db");
|
run("COMPACT DATABASE test");
|
||||||
|
|
||||||
|
setCompactDbReq("test", 1678168883000, 1678255283000);
|
||||||
|
run("COMPACT DATABASE test START WITH '2023-03-07 14:01:23' END WITH '2023-03-08 14:01:23'");
|
||||||
|
|
||||||
|
setCompactDbReq("testus", 1673071283000000000);
|
||||||
|
run("COMPACT DATABASE testus START WITH TIMESTAMP '2023-01-07 14:01:23'");
|
||||||
|
|
||||||
|
setCompactDbReq("testus", INT64_MIN, 1675749683000000000);
|
||||||
|
run("COMPACT DATABASE testus END WITH 1675749683000000000");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -65,15 +65,16 @@ int32_t getLogLevel() { return g_logLevel; }
|
||||||
|
|
||||||
class ParserTestBaseImpl {
|
class ParserTestBaseImpl {
|
||||||
public:
|
public:
|
||||||
ParserTestBaseImpl(ParserTestBase* pBase) : pBase_(pBase), sqlNo_(0), sqlNum_(0) {}
|
ParserTestBaseImpl(ParserTestBase* pBase) : pBase_(pBase), sqlNo_(0), sqlNum_(0) {
|
||||||
|
caseEnv_.numOfSkipSql_ = g_skipSql;
|
||||||
|
caseEnv_.numOfLimitSql_ = g_limitSql;
|
||||||
|
}
|
||||||
|
|
||||||
void login(const std::string& user) { caseEnv_.user_ = user; }
|
void login(const std::string& user) { caseEnv_.user_ = user; }
|
||||||
|
|
||||||
void useDb(const string& acctId, const string& db) {
|
void useDb(const string& acctId, const string& db) {
|
||||||
caseEnv_.acctId_ = acctId;
|
caseEnv_.acctId_ = acctId;
|
||||||
caseEnv_.db_ = db;
|
caseEnv_.db_ = db;
|
||||||
caseEnv_.numOfSkipSql_ = g_skipSql;
|
|
||||||
caseEnv_.numOfLimitSql_ = g_limitSql;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void run(const string& sql, int32_t expect, ParserStage checkStage) {
|
void run(const string& sql, int32_t expect, ParserStage checkStage) {
|
||||||
|
|
|
@ -59,6 +59,8 @@ int32_t sclCreateColumnInfoData(SDataType *pType, int32_t numOfRows, SScalarPara
|
||||||
|
|
||||||
pParam->columnData = pColumnData;
|
pParam->columnData = pColumnData;
|
||||||
pParam->colAlloced = true;
|
pParam->colAlloced = true;
|
||||||
|
pParam->numOfRows = numOfRows;
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -740,6 +742,10 @@ int32_t sclExecFunction(SFunctionNode *node, SScalarCtx *ctx, SScalarParam *outp
|
||||||
SCL_ERR_JRET(code);
|
SCL_ERR_JRET(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rowNum == 0) {
|
||||||
|
goto _return;
|
||||||
|
}
|
||||||
|
|
||||||
code = (*ffpSet.process)(params, paramNum, output);
|
code = (*ffpSet.process)(params, paramNum, output);
|
||||||
if (code) {
|
if (code) {
|
||||||
sclError("scalar function exec failed, funcId:%d, code:%s", node->funcId, tstrerror(code));
|
sclError("scalar function exec failed, funcId:%d, code:%s", node->funcId, tstrerror(code));
|
||||||
|
|
|
@ -1055,9 +1055,9 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
|
||||||
if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) {
|
if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) {
|
||||||
timeVal = timeVal / 1000;
|
timeVal = timeVal / 1000;
|
||||||
} else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) {
|
} else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) {
|
||||||
timeVal = timeVal / (1000 * 1000);
|
timeVal = timeVal / ((int64_t)(1000 * 1000));
|
||||||
} else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) {
|
} else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) {
|
||||||
timeVal = timeVal / (1000 * 1000 * 1000);
|
timeVal = timeVal / ((int64_t)(1000 * 1000 * 1000));
|
||||||
} else {
|
} else {
|
||||||
colDataSetNULL(pOutput->columnData, i);
|
colDataSetNULL(pOutput->columnData, i);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1317,19 +1317,19 @@ int32_t timeTruncateFunction(SScalarParam *pInput, int32_t inputNum, SScalarPara
|
||||||
case 86400000: { /* 1d */
|
case 86400000: { /* 1d */
|
||||||
if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) {
|
if (tsDigits == TSDB_TIME_PRECISION_MILLI_DIGITS) {
|
||||||
if (ignoreTz) {
|
if (ignoreTz) {
|
||||||
timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000)) % (86400L * 1000);
|
timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000)) % (((int64_t)86400) * 1000);
|
||||||
} else {
|
} else {
|
||||||
timeVal = timeVal / 1000 / 86400 * 86400 * 1000;
|
timeVal = timeVal / 1000 / 86400 * 86400 * 1000;
|
||||||
}
|
}
|
||||||
} else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) {
|
} else if (tsDigits == TSDB_TIME_PRECISION_MICRO_DIGITS) {
|
||||||
if (ignoreTz) {
|
if (ignoreTz) {
|
||||||
timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000)) % (86400L * 1000000);
|
timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000)) % (((int64_t)86400) * 1000000);
|
||||||
} else {
|
} else {
|
||||||
timeVal = timeVal / 1000000 / 86400 * 86400 * 1000000;
|
timeVal = timeVal / 1000000 / 86400 * 86400 * 1000000;
|
||||||
}
|
}
|
||||||
} else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) {
|
} else if (tsDigits == TSDB_TIME_PRECISION_NANO_DIGITS) {
|
||||||
if (ignoreTz) {
|
if (ignoreTz) {
|
||||||
timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000000)) % (86400L * 1000000000);
|
timeVal = timeVal - (timeVal + offsetFromTz(timezone, 1000000000)) % (((int64_t)86400) * 1000000000);
|
||||||
} else {
|
} else {
|
||||||
timeVal = timeVal / 1000000000 / 86400 * 86400 * 1000000000;
|
timeVal = timeVal / 1000000000 / 86400 * 86400 * 1000000000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* pRes) {
|
static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray* pRes) {
|
||||||
int32_t code;
|
int32_t code;
|
||||||
void* exec = pTask->exec.executor;
|
void* exec = pTask->exec.executor;
|
||||||
|
while(atomic_load_8(&pTask->taskStatus) != TASK_STATUS__NORMAL) {
|
||||||
|
qError("stream task wait for the end of fill history");
|
||||||
|
taosMsleep(2);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// set input
|
// set input
|
||||||
const SStreamQueueItem* pItem = (const SStreamQueueItem*)data;
|
const SStreamQueueItem* pItem = (const SStreamQueueItem*)data;
|
||||||
|
@ -58,6 +63,9 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, const void* data, SArray*
|
||||||
SSDataBlock* output = NULL;
|
SSDataBlock* output = NULL;
|
||||||
uint64_t ts = 0;
|
uint64_t ts = 0;
|
||||||
if ((code = qExecTask(exec, &output, &ts)) < 0) {
|
if ((code = qExecTask(exec, &output, &ts)) < 0) {
|
||||||
|
if (code == TSDB_CODE_QRY_IN_EXEC) {
|
||||||
|
resetTaskInfo(exec);
|
||||||
|
}
|
||||||
/*ASSERT(false);*/
|
/*ASSERT(false);*/
|
||||||
qError("unexpected stream execution, stream %" PRId64 " task: %d, since %s", pTask->streamId, pTask->taskId,
|
qError("unexpected stream execution, stream %" PRId64 " task: %d, since %s", pTask->streamId, pTask->taskId,
|
||||||
terrstr());
|
terrstr());
|
||||||
|
@ -121,8 +129,7 @@ int32_t streamScanExec(SStreamTask* pTask, int32_t batchSz) {
|
||||||
SSDataBlock* output = NULL;
|
SSDataBlock* output = NULL;
|
||||||
uint64_t ts = 0;
|
uint64_t ts = 0;
|
||||||
if (qExecTask(exec, &output, &ts) < 0) {
|
if (qExecTask(exec, &output, &ts) < 0) {
|
||||||
taosArrayDestroy(pRes);
|
continue;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
if (qStreamRecoverScanFinished(exec)) {
|
if (qStreamRecoverScanFinished(exec)) {
|
||||||
|
|
|
@ -168,7 +168,7 @@ int32_t streamRestoreParam(SStreamTask* pTask) {
|
||||||
return qStreamRestoreParam(exec);
|
return qStreamRestoreParam(exec);
|
||||||
}
|
}
|
||||||
int32_t streamSetStatusNormal(SStreamTask* pTask) {
|
int32_t streamSetStatusNormal(SStreamTask* pTask) {
|
||||||
pTask->taskStatus = TASK_STATUS__NORMAL;
|
atomic_store_8(&pTask->taskStatus, TASK_STATUS__NORMAL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ int32_t syncNodeHeartbeatPeers(SSyncNode* pSyncNode);
|
||||||
int32_t syncNodeSendHeartbeat(SSyncNode* pSyncNode, const SRaftId* pDestId, SRpcMsg* pMsg);
|
int32_t syncNodeSendHeartbeat(SSyncNode* pSyncNode, const SRaftId* pDestId, SRpcMsg* pMsg);
|
||||||
|
|
||||||
int32_t syncNodeReplicate(SSyncNode* pSyncNode);
|
int32_t syncNodeReplicate(SSyncNode* pSyncNode);
|
||||||
int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapshot);
|
int32_t syncNodeReplicateReset(SSyncNode* pSyncNode, SRaftId* pDestId);
|
||||||
int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode);
|
int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode);
|
||||||
|
|
||||||
int32_t syncNodeSendAppendEntries(SSyncNode* pNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg);
|
int32_t syncNodeSendAppendEntries(SSyncNode* pNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg);
|
||||||
|
|
|
@ -301,7 +301,7 @@ int32_t syncBeginSnapshot(int64_t rid, int64_t lastApplyIndex) {
|
||||||
syncNodeRelease(pSyncNode);
|
syncNodeRelease(pSyncNode);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
logRetention = TMAX(logRetention, lastApplyIndex - pSyncNode->minMatchIndex);
|
logRetention = TMAX(logRetention, lastApplyIndex - pSyncNode->minMatchIndex + logRetention);
|
||||||
}
|
}
|
||||||
|
|
||||||
_DEL_WAL:
|
_DEL_WAL:
|
||||||
|
@ -1082,21 +1082,15 @@ void syncNodePreClose(SSyncNode* pSyncNode) {
|
||||||
ASSERT(pSyncNode->pFsm != NULL);
|
ASSERT(pSyncNode->pFsm != NULL);
|
||||||
ASSERT(pSyncNode->pFsm->FpApplyQueueItems != NULL);
|
ASSERT(pSyncNode->pFsm->FpApplyQueueItems != NULL);
|
||||||
|
|
||||||
while (1) {
|
|
||||||
int32_t aqItems = pSyncNode->pFsm->FpApplyQueueItems(pSyncNode->pFsm);
|
|
||||||
sTrace("vgId:%d, pre close, %d items in apply queue", pSyncNode->vgId, aqItems);
|
|
||||||
if (aqItems == 0 || aqItems == -1) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
taosMsleep(20);
|
|
||||||
}
|
|
||||||
|
|
||||||
// stop elect timer
|
// stop elect timer
|
||||||
syncNodeStopElectTimer(pSyncNode);
|
syncNodeStopElectTimer(pSyncNode);
|
||||||
|
|
||||||
// stop heartbeat timer
|
// stop heartbeat timer
|
||||||
syncNodeStopHeartbeatTimer(pSyncNode);
|
syncNodeStopHeartbeatTimer(pSyncNode);
|
||||||
|
|
||||||
|
// stop ping timer
|
||||||
|
syncNodeStopPingTimer(pSyncNode);
|
||||||
|
|
||||||
// clean rsp
|
// clean rsp
|
||||||
syncRespCleanRsp(pSyncNode->pSyncRespMgr);
|
syncRespCleanRsp(pSyncNode->pSyncRespMgr);
|
||||||
}
|
}
|
||||||
|
@ -1120,10 +1114,11 @@ void syncNodeClose(SSyncNode* pSyncNode) {
|
||||||
if (pSyncNode == NULL) return;
|
if (pSyncNode == NULL) return;
|
||||||
sNInfo(pSyncNode, "sync close, node:%p", pSyncNode);
|
sNInfo(pSyncNode, "sync close, node:%p", pSyncNode);
|
||||||
|
|
||||||
|
syncRespCleanRsp(pSyncNode->pSyncRespMgr);
|
||||||
|
|
||||||
syncNodeStopPingTimer(pSyncNode);
|
syncNodeStopPingTimer(pSyncNode);
|
||||||
syncNodeStopElectTimer(pSyncNode);
|
syncNodeStopElectTimer(pSyncNode);
|
||||||
syncNodeStopHeartbeatTimer(pSyncNode);
|
syncNodeStopHeartbeatTimer(pSyncNode);
|
||||||
|
|
||||||
syncNodeLogReplMgrDestroy(pSyncNode);
|
syncNodeLogReplMgrDestroy(pSyncNode);
|
||||||
|
|
||||||
syncRespMgrDestroy(pSyncNode->pSyncRespMgr);
|
syncRespMgrDestroy(pSyncNode->pSyncRespMgr);
|
||||||
|
|
|
@ -742,7 +742,8 @@ int32_t syncLogReplMgrProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* p
|
||||||
|
|
||||||
if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) {
|
if (pMsg->matchIndex < pNode->pLogBuf->matchIndex) {
|
||||||
term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1);
|
term = syncLogReplMgrGetPrevLogTerm(pMgr, pNode, index + 1);
|
||||||
if (term < 0 || (term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) {
|
if ((index + 1 < firstVer) || (term < 0) ||
|
||||||
|
(term != pMsg->lastMatchTerm && (index + 1 == firstVer || index == firstVer))) {
|
||||||
ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST);
|
ASSERT(term >= 0 || terrno == TSDB_CODE_WAL_LOG_NOT_EXIST);
|
||||||
if (syncNodeStartSnapshot(pNode, &destId) < 0) {
|
if (syncNodeStartSnapshot(pNode, &destId) < 0) {
|
||||||
sError("vgId:%d, failed to start snapshot for peer dnode:%d", pNode->vgId, DID(&destId));
|
sError("vgId:%d, failed to start snapshot for peer dnode:%d", pNode->vgId, DID(&destId));
|
||||||
|
|
|
@ -139,7 +139,7 @@ int32_t raftStoreWriteFile(SSyncNode *pNode) {
|
||||||
if (taosRenameFile(file, realfile) != 0) goto _OVER;
|
if (taosRenameFile(file, realfile) != 0) goto _OVER;
|
||||||
|
|
||||||
code = 0;
|
code = 0;
|
||||||
sInfo("vgId:%d, succeed to write raft store file:%s, len:%d", pNode->vgId, realfile, len);
|
sInfo("vgId:%d, succeed to write raft store file:%s, term:%" PRId64, pNode->vgId, realfile, pStore->currentTerm);
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
if (pJson != NULL) tjsonDelete(pJson);
|
if (pJson != NULL) tjsonDelete(pJson);
|
||||||
|
|
|
@ -48,6 +48,15 @@
|
||||||
|
|
||||||
int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg);
|
int32_t syncNodeMaybeSendAppendEntries(SSyncNode* pSyncNode, const SRaftId* destRaftId, SRpcMsg* pRpcMsg);
|
||||||
|
|
||||||
|
int32_t syncNodeReplicateReset(SSyncNode* pNode, SRaftId* pDestId) {
|
||||||
|
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||||
|
taosThreadMutexLock(&pBuf->mutex);
|
||||||
|
SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId);
|
||||||
|
syncLogReplMgrReset(pMgr);
|
||||||
|
taosThreadMutexUnlock(&pBuf->mutex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t syncNodeReplicate(SSyncNode* pNode) {
|
int32_t syncNodeReplicate(SSyncNode* pNode) {
|
||||||
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
SSyncLogBuffer* pBuf = pNode->pLogBuf;
|
||||||
taosThreadMutexLock(&pBuf->mutex);
|
taosThreadMutexLock(&pBuf->mutex);
|
||||||
|
|
|
@ -992,8 +992,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
|
||||||
if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) {
|
if (pMsg->ack == SYNC_SNAPSHOT_SEQ_END) {
|
||||||
syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end");
|
syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "process seq end");
|
||||||
snapshotSenderStop(pSender, true);
|
snapshotSenderStop(pSender, true);
|
||||||
SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId);
|
syncNodeReplicateReset(pSyncNode, &pMsg->srcId);
|
||||||
syncLogReplMgrReset(pMgr);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,8 +1017,7 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
|
||||||
syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack");
|
syncLogRecvSyncSnapshotRsp(pSyncNode, pMsg, "receive error ack");
|
||||||
sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq);
|
sSError(pSender, "snapshot sender receive error ack:%d, my seq:%d", pMsg->ack, pSender->seq);
|
||||||
snapshotSenderStop(pSender, true);
|
snapshotSenderStop(pSender, true);
|
||||||
SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId);
|
syncNodeReplicateReset(pSyncNode, &pMsg->srcId);
|
||||||
syncLogReplMgrReset(pMgr);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,8 +1025,6 @@ int32_t syncNodeOnSnapshotRsp(SSyncNode *pSyncNode, const SRpcMsg *pRpcMsg) {
|
||||||
|
|
||||||
_ERROR:
|
_ERROR:
|
||||||
snapshotSenderStop(pSender, true);
|
snapshotSenderStop(pSender, true);
|
||||||
SSyncLogReplMgr *pMgr = syncNodeGetLogReplMgr(pSyncNode, &pMsg->srcId);
|
syncNodeReplicateReset(pSyncNode, &pMsg->srcId);
|
||||||
syncLogReplMgrReset(pMgr);
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,21 +425,6 @@ void cliHandleResp(SCliConn* conn) {
|
||||||
tDebug("%s conn %p ref by app", CONN_GET_INST_LABEL(conn), conn);
|
tDebug("%s conn %p ref by app", CONN_GET_INST_LABEL(conn), conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (TMSG_INFO(pHead->msgType - 1) != 0) {
|
|
||||||
// char buf[128] = {0};
|
|
||||||
// sprintf(buf, "%s", TMSG_INFO(pHead->msgType - 1));
|
|
||||||
// int* count = taosHashGet(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)));
|
|
||||||
// if (NULL == 0) {
|
|
||||||
// int localCount = 1;
|
|
||||||
// taosHashPut(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)), &localCount,
|
|
||||||
// sizeof(localCount));
|
|
||||||
// } else {
|
|
||||||
// int localCount = *count - 1;
|
|
||||||
// taosHashPut(pThrd->msgCount, TMSG_INFO(pHead->msgType - 1), strlen(TMSG_INFO(pHead->msgType - 1)), &localCount,
|
|
||||||
// sizeof(localCount));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
STraceId* trace = &transMsg.info.traceId;
|
STraceId* trace = &transMsg.info.traceId;
|
||||||
tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, code str:%s", CONN_GET_INST_LABEL(conn), conn,
|
tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, code str:%s", CONN_GET_INST_LABEL(conn), conn,
|
||||||
TMSG_INFO(pHead->msgType), conn->dst, conn->src, pHead->msgLen, tstrerror(transMsg.code));
|
TMSG_INFO(pHead->msgType), conn->dst, conn->src, pHead->msgLen, tstrerror(transMsg.code));
|
||||||
|
@ -1118,19 +1103,6 @@ void cliSend(SCliConn* pConn) {
|
||||||
msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen));
|
msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen));
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (tmsgIsValid(pHead->msgType)) {
|
|
||||||
// char buf[128] = {0};
|
|
||||||
// sprintf(buf, "%s", TMSG_INFO(pHead->msgType));
|
|
||||||
// int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf));
|
|
||||||
// if (NULL == 0) {
|
|
||||||
// int localCount = 1;
|
|
||||||
// taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
|
||||||
// } else {
|
|
||||||
// int localCount = *count + 1;
|
|
||||||
// taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn,
|
tGDebug("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn,
|
||||||
TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen);
|
TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, msgLen);
|
||||||
|
|
||||||
|
@ -1525,16 +1497,19 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
|
||||||
destroyCmsg(pMsg);
|
destroyCmsg(pMsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tmsgIsValid(pMsg->msg.msgType)) {
|
|
||||||
char buf[128] = {0};
|
if (rpcDebugFlag & DEBUG_TRACE) {
|
||||||
sprintf(buf, "%s", TMSG_INFO(pMsg->msg.msgType));
|
if (tmsgIsValid(pMsg->msg.msgType)) {
|
||||||
int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf));
|
char buf[128] = {0};
|
||||||
if (NULL == 0) {
|
sprintf(buf, "%s", TMSG_INFO(pMsg->msg.msgType));
|
||||||
int localCount = 1;
|
int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf));
|
||||||
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
if (NULL == 0) {
|
||||||
} else {
|
int localCount = 1;
|
||||||
int localCount = *count + 1;
|
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
||||||
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
} else {
|
||||||
|
int localCount = *count + 1;
|
||||||
|
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1782,18 +1757,20 @@ static void cliAsyncCb(uv_async_t* handle) {
|
||||||
QUEUE_MOVE(&item->qmsg, &wq);
|
QUEUE_MOVE(&item->qmsg, &wq);
|
||||||
taosThreadMutexUnlock(&item->mtx);
|
taosThreadMutexUnlock(&item->mtx);
|
||||||
|
|
||||||
void* pIter = taosHashIterate(pThrd->msgCount, NULL);
|
if (rpcDebugFlag & DEBUG_TRACE) {
|
||||||
while (pIter != NULL) {
|
void* pIter = taosHashIterate(pThrd->msgCount, NULL);
|
||||||
int* count = pIter;
|
while (pIter != NULL) {
|
||||||
size_t len = 0;
|
int* count = pIter;
|
||||||
char* key = taosHashGetKey(pIter, &len);
|
size_t len = 0;
|
||||||
if (*count != 0) {
|
char* key = taosHashGetKey(pIter, &len);
|
||||||
tDebug("key: %s count: %d", key, *count);
|
if (*count != 0) {
|
||||||
}
|
tDebug("key: %s count: %d", key, *count);
|
||||||
|
}
|
||||||
|
|
||||||
pIter = taosHashIterate(pThrd->msgCount, pIter);
|
pIter = taosHashIterate(pThrd->msgCount, pIter);
|
||||||
|
}
|
||||||
|
tDebug("all conn count: %d", pThrd->newConnCount);
|
||||||
}
|
}
|
||||||
tDebug("all conn count: %d", pThrd->newConnCount);
|
|
||||||
|
|
||||||
int8_t supportBatch = pTransInst->supportBatch;
|
int8_t supportBatch = pTransInst->supportBatch;
|
||||||
if (supportBatch == 0) {
|
if (supportBatch == 0) {
|
||||||
|
@ -2379,17 +2356,18 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
|
||||||
tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn);
|
tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (rpcDebugFlag & DEBUG_TRACE) {
|
||||||
if (tmsgIsValid(pResp->msgType - 1)) {
|
if (tmsgIsValid(pResp->msgType - 1)) {
|
||||||
char buf[128] = {0};
|
char buf[128] = {0};
|
||||||
sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1));
|
sprintf(buf, "%s", TMSG_INFO(pResp->msgType - 1));
|
||||||
int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf));
|
int* count = taosHashGet(pThrd->msgCount, buf, sizeof(buf));
|
||||||
if (NULL == 0) {
|
if (NULL == 0) {
|
||||||
int localCount = 0;
|
int localCount = 0;
|
||||||
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
||||||
} else {
|
} else {
|
||||||
int localCount = *count - 1;
|
int localCount = *count - 1;
|
||||||
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
taosHashPut(pThrd->msgCount, buf, sizeof(buf), &localCount, sizeof(localCount));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pCtx->pSem != NULL) {
|
if (pCtx->pSem != NULL) {
|
||||||
|
|
|
@ -328,8 +328,8 @@ int32_t walEndSnapshot(SWal *pWal) {
|
||||||
"), new tot size %" PRId64,
|
"), new tot size %" PRId64,
|
||||||
pWal->cfg.vgId, iter->firstVer, iter->fileSize, iter->closeTs, newTotSize);
|
pWal->cfg.vgId, iter->firstVer, iter->fileSize, iter->closeTs, newTotSize);
|
||||||
if (((pWal->cfg.retentionSize == 0) || (pWal->cfg.retentionSize != -1 && newTotSize > pWal->cfg.retentionSize)) ||
|
if (((pWal->cfg.retentionSize == 0) || (pWal->cfg.retentionSize != -1 && newTotSize > pWal->cfg.retentionSize)) ||
|
||||||
((pWal->cfg.retentionPeriod == 0) ||
|
((pWal->cfg.retentionPeriod == 0) || (pWal->cfg.retentionPeriod != -1 && iter->closeTs != -1 &&
|
||||||
(pWal->cfg.retentionPeriod != -1 && iter->closeTs + pWal->cfg.retentionPeriod > ts))) {
|
iter->closeTs + pWal->cfg.retentionPeriod < ts))) {
|
||||||
// delete according to file size or close time
|
// delete according to file size or close time
|
||||||
wDebug("vgId:%d, check pass", pWal->cfg.vgId);
|
wDebug("vgId:%d, check pass", pWal->cfg.vgId);
|
||||||
deleteCnt++;
|
deleteCnt++;
|
||||||
|
|
|
@ -25,7 +25,15 @@
|
||||||
|
|
||||||
void taosSeedRand(uint32_t seed) { return srand(seed); }
|
void taosSeedRand(uint32_t seed) { return srand(seed); }
|
||||||
|
|
||||||
uint32_t taosRand(void) { return rand(); }
|
uint32_t taosRand(void) {
|
||||||
|
#ifdef WINDOWS
|
||||||
|
unsigned int pSeed;
|
||||||
|
rand_s(&pSeed);
|
||||||
|
return pSeed;
|
||||||
|
#else
|
||||||
|
return rand();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t taosRandR(uint32_t* pSeed) {
|
uint32_t taosRandR(uint32_t* pSeed) {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|
|
@ -184,6 +184,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_ACCTS, "Too many accounts")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_ALREADY_EXIST, "User already exists")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_ALREADY_EXIST, "User already exists")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_NOT_EXIST, "Invalid user")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_NOT_EXIST, "Invalid user")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_USER_FORMAT, "Invalid user format")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_USER_FORMAT, "Invalid user format")
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_USER_NOT_AVAILABLE, "User not available")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_PASS_FORMAT, "Invalid password format")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_PASS_FORMAT, "Invalid password format")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from conn")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from conn")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_USERS, "Too many users")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_USERS, "Too many users")
|
||||||
|
@ -211,8 +212,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_BUFSIZE, "Invalid func bufSize"
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_COMMENT, "Invalid func comment")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_COMMENT, "Invalid func comment")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retrieve msg")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retrieve msg")
|
||||||
|
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST, "Tag index already exists")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST, "index already exists")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_INDEX_NOT_EXIST, "Tag index not exists")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TAG_INDEX_NOT_EXIST, "index not exist")
|
||||||
|
|
||||||
|
|
||||||
// mnode-db
|
// mnode-db
|
||||||
|
@ -301,9 +302,9 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_STREAMS, "Too many streams")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TARGET_TABLE, "Cannot write the same stable as other stream")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TARGET_TABLE, "Cannot write the same stable as other stream")
|
||||||
|
|
||||||
// mnode-sma
|
// mnode-sma
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_ALREADY_EXIST, "SMA already exists")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_ALREADY_EXIST, "index already exists")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "SMA does not exist")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "index not exist")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma option")
|
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SMA_OPTION, "Invalid sma index option")
|
||||||
|
|
||||||
// dnode
|
// dnode
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_OFFLINE, "Dnode is offline")
|
TAOS_DEFINE_ERROR(TSDB_CODE_DNODE_OFFLINE, "Dnode is offline")
|
||||||
|
|
|
@ -89,3 +89,20 @@ int32_t taosCheckVersionCompatible(int32_t clientVer, int32_t serverVer, int32_t
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t taosCheckVersionCompatibleFromStr(const char *pClientVersion, const char *pServerVersion,
|
||||||
|
int32_t comparedSegments) {
|
||||||
|
int32_t clientVersion = 0;
|
||||||
|
int32_t serverVersion = 0;
|
||||||
|
int32_t code = taosVersionStrToInt(pClientVersion, &clientVersion);
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = taosVersionStrToInt(pServerVersion, &serverVersion);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
code = taosCheckVersionCompatible(clientVersion, serverVersion, comparedSegments);
|
||||||
|
}
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
code = terrno;
|
||||||
|
}
|
||||||
|
return code;
|
||||||
|
}
|
|
@ -108,49 +108,49 @@ class TDTestCase:
|
||||||
tdLog.info("%s" % cmd)
|
tdLog.info("%s" % cmd)
|
||||||
os.system("%s" % cmd)
|
os.system("%s" % cmd)
|
||||||
tdSql.execute("reset query cache")
|
tdSql.execute("reset query cache")
|
||||||
tdSql.query("select count(*) from (select distinct(tbname) from db.stb2)")
|
tdSql.query("select count(*) from (select distinct(tbname) from stmt_db.stb2)")
|
||||||
tdSql.checkData(0, 0, 8)
|
tdSql.checkData(0, 0, 8)
|
||||||
tdSql.query("select count(*) from db.stb2")
|
tdSql.query("select count(*) from stmt_db.stb2")
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
tdSql.query("select * from information_schema.ins_databases")
|
tdSql.query("select * from information_schema.ins_databases where name='stmt_db'")
|
||||||
tdSql.checkData(2, 14, "us")
|
tdSql.checkData(0, 14, "us")
|
||||||
|
|
||||||
tdSql.execute("reset query cache")
|
tdSql.execute("reset query cache")
|
||||||
tdSql.query("select count(*) from (select distinct(tbname) from db.`stb2-2`)")
|
tdSql.query("select count(*) from (select distinct(tbname) from stmt_db.`stb2-2`)")
|
||||||
tdSql.checkData(0, 0, 8)
|
tdSql.checkData(0, 0, 8)
|
||||||
tdSql.query("select count(*) from db.`stb2-2`")
|
tdSql.query("select count(*) from stmt_db.`stb2-2`")
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
|
|
||||||
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/rest_auto_create_table.json" %binPath
|
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/rest_auto_create_table.json" %binPath
|
||||||
tdLog.info("%s" % cmd)
|
tdLog.info("%s" % cmd)
|
||||||
os.system("%s" % cmd)
|
os.system("%s" % cmd)
|
||||||
tdSql.execute("reset query cache")
|
tdSql.execute("reset query cache")
|
||||||
tdSql.query("select count(*) from (select distinct(tbname) from db.stb3)")
|
tdSql.query("select count(*) from (select distinct(tbname) from rest_db.stb3)")
|
||||||
tdSql.checkData(0, 0, 8)
|
tdSql.checkData(0, 0, 8)
|
||||||
tdSql.query("select count(*) from db.stb3")
|
tdSql.query("select count(*) from rest_db.stb3")
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
tdSql.query("select * from information_schema.ins_databases")
|
tdSql.query("select * from information_schema.ins_databases where name='rest_db'")
|
||||||
tdSql.checkData(2, 14, "ns")
|
tdSql.checkData(0, 14, "ns")
|
||||||
|
|
||||||
tdSql.execute("reset query cache")
|
tdSql.execute("reset query cache")
|
||||||
tdSql.query("select count(*) from (select distinct(tbname) from db.`stb3-2`)")
|
tdSql.query("select count(*) from (select distinct(tbname) from rest_db.`stb3-2`)")
|
||||||
tdSql.checkData(0, 0, 8)
|
tdSql.checkData(0, 0, 8)
|
||||||
tdSql.query("select count(*) from db.`stb3-2`")
|
tdSql.query("select count(*) from rest_db.`stb3-2`")
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
|
|
||||||
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_auto_create_table.json" %binPath
|
cmd = "%s -f ./5-taos-tools/taosbenchmark/json/sml_auto_create_table.json" %binPath
|
||||||
tdLog.info("%s" % cmd)
|
tdLog.info("%s" % cmd)
|
||||||
os.system("%s" % cmd)
|
os.system("%s" % cmd)
|
||||||
tdSql.execute("reset query cache")
|
tdSql.execute("reset query cache")
|
||||||
tdSql.query("select count(*) from (select distinct(tbname) from db.stb4)")
|
tdSql.query("select count(*) from (select distinct(tbname) from sml_db.stb4)")
|
||||||
tdSql.checkData(0, 0, 8)
|
tdSql.checkData(0, 0, 8)
|
||||||
tdSql.query("select count(*) from db.stb4")
|
tdSql.query("select count(*) from sml_db.stb4")
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
|
|
||||||
tdSql.execute("reset query cache")
|
tdSql.execute("reset query cache")
|
||||||
tdSql.query("select count(*) from (select distinct(tbname) from db.`stb4-2`)")
|
tdSql.query("select count(*) from (select distinct(tbname) from sml_db.`stb4-2`)")
|
||||||
tdSql.checkData(0, 0, 8)
|
tdSql.checkData(0, 0, 8)
|
||||||
tdSql.query("select count(*) from db.`stb4-2`")
|
tdSql.query("select count(*) from sml_db.`stb4-2`")
|
||||||
tdSql.checkData(0, 0, 160)
|
tdSql.checkData(0, 0, 160)
|
||||||
|
|
||||||
tAdapter.stop()
|
tAdapter.stop()
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"num_of_records_per_req": 10,
|
"num_of_records_per_req": 10,
|
||||||
"databases": [{
|
"databases": [{
|
||||||
"dbinfo": {
|
"dbinfo": {
|
||||||
"name": "db",
|
"name": "rest_db",
|
||||||
"drop": "yes",
|
"drop": "yes",
|
||||||
"replica": 1,
|
"replica": 1,
|
||||||
"precision": "ns",
|
"precision": "ns",
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"num_of_records_per_req": 10,
|
"num_of_records_per_req": 10,
|
||||||
"databases": [{
|
"databases": [{
|
||||||
"dbinfo": {
|
"dbinfo": {
|
||||||
"name": "db",
|
"name": "sml_db",
|
||||||
"drop": "yes",
|
"drop": "yes",
|
||||||
"replica": 1,
|
"replica": 1,
|
||||||
"precision": "ms",
|
"precision": "ms",
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"num_of_records_per_req": 10,
|
"num_of_records_per_req": 10,
|
||||||
"databases": [{
|
"databases": [{
|
||||||
"dbinfo": {
|
"dbinfo": {
|
||||||
"name": "db",
|
"name": "stmt_db",
|
||||||
"drop": "yes",
|
"drop": "yes",
|
||||||
"replica": 1,
|
"replica": 1,
|
||||||
"precision": "us",
|
"precision": "us",
|
||||||
|
|
|
@ -69,12 +69,19 @@ ulimit -c unlimited
|
||||||
|
|
||||||
md5sum /usr/lib/libtaos.so.1
|
md5sum /usr/lib/libtaos.so.1
|
||||||
md5sum /home/TDinternal/debug/build/lib/libtaos.so
|
md5sum /home/TDinternal/debug/build/lib/libtaos.so
|
||||||
|
|
||||||
|
#define taospy 2.7.6
|
||||||
|
pip3 list|grep taospy
|
||||||
|
pip3 uninstall taospy -y
|
||||||
|
pip3 install taospy==2.7.6
|
||||||
|
|
||||||
$TIMEOUT_CMD $cmd
|
$TIMEOUT_CMD $cmd
|
||||||
RET=$?
|
RET=$?
|
||||||
echo "cmd exit code: $RET"
|
echo "cmd exit code: $RET"
|
||||||
md5sum /usr/lib/libtaos.so.1
|
md5sum /usr/lib/libtaos.so.1
|
||||||
md5sum /home/TDinternal/debug/build/lib/libtaos.so
|
md5sum /home/TDinternal/debug/build/lib/libtaos.so
|
||||||
|
|
||||||
|
|
||||||
if [ $RET -ne 0 ]; then
|
if [ $RET -ne 0 ]; then
|
||||||
pwd
|
pwd
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -130,8 +130,6 @@ docker run \
|
||||||
-v ${SOURCEDIR}:/usr/local/src/ \
|
-v ${SOURCEDIR}:/usr/local/src/ \
|
||||||
-v "$TMP_DIR/thread_volume/$thread_no/sim:${SIM_DIR}" \
|
-v "$TMP_DIR/thread_volume/$thread_no/sim:${SIM_DIR}" \
|
||||||
-v ${TMP_DIR}/thread_volume/$thread_no/coredump:$coredump_dir \
|
-v ${TMP_DIR}/thread_volume/$thread_no/coredump:$coredump_dir \
|
||||||
-v $WORKDIR/taos-connector-python/taos:/usr/local/lib/python3.8/site-packages/taos:ro \
|
|
||||||
-v $WORKDIR/taos-connector-python/taosrest:/usr/local/lib/python3.8/site-packages/taosrest:ro \
|
|
||||||
--rm --ulimit core=-1 taos_test:v1.0 $CONTAINER_TESTDIR/tests/parallel_test/run_case.sh -d "$exec_dir" -c "$cmd" $extra_param
|
--rm --ulimit core=-1 taos_test:v1.0 $CONTAINER_TESTDIR/tests/parallel_test/run_case.sh -d "$exec_dir" -c "$cmd" $extra_param
|
||||||
ret=$?
|
ret=$?
|
||||||
exit $ret
|
exit $ret
|
||||||
|
|
|
@ -285,8 +285,6 @@ sql_error alter database db keep -1
|
||||||
|
|
||||||
print ============== modify minrows
|
print ============== modify minrows
|
||||||
sql_error alter database db minrows 8
|
sql_error alter database db minrows 8
|
||||||
sql_error alter database db minrows 200
|
|
||||||
sql_error alter database db minrows 11
|
|
||||||
sql_error alter database db minrows 8000
|
sql_error alter database db minrows 8000
|
||||||
sql_error alter database db minrows 8001
|
sql_error alter database db minrows 8001
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ sql connect
|
||||||
sql create dnode $hostname port 7200
|
sql create dnode $hostname port 7200
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
sql select * from information_schema.ins_dnodes
|
||||||
print dnode1 off: $data(1)[6]
|
print dnode1 off: $data(1)[7]
|
||||||
print dnode2 off: $data(2)[6]
|
print dnode2 off: $data(2)[7]
|
||||||
|
|
||||||
if $data(2)[6] != @status not received@ then
|
if $data(2)[7] != @status not received@ then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -50,9 +50,9 @@ step3:
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
sql select * from information_schema.ins_dnodes
|
sql select * from information_schema.ins_dnodes
|
||||||
print dnode1 off: $data(1)[6]
|
print dnode1 off: $data(1)[7]
|
||||||
print dnode2 off: $data(2)[6]
|
print dnode2 off: $data(2)[7]
|
||||||
if $data(2)[6] != @status msg timeout@ then
|
if $data(2)[7] != @status msg timeout@ then
|
||||||
goto step3
|
goto step3
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ step5:
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
sql select * from information_schema.ins_dnodes
|
||||||
print dnode1 off: $data(1)[6]
|
print dnode1 off: $data(1)[7]
|
||||||
print dnode2 off: $data(3)[6]
|
print dnode2 off: $data(3)[7]
|
||||||
if $data(3)[6] != @dnodeId not match@ then
|
if $data(3)[7] != @dnodeId not match@ then
|
||||||
goto step5
|
goto step5
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -98,10 +98,10 @@ step6:
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
sql select * from information_schema.ins_dnodes
|
||||||
print dnode1 off: $data(1)[6]
|
print dnode1 off: $data(1)[7]
|
||||||
print dnode2 off: $data(3)[6]
|
print dnode2 off: $data(3)[7]
|
||||||
print dnode3 off: $data(4)[6]
|
print dnode3 off: $data(4)[67
|
||||||
if $data(4)[6] != @interval not match@ then
|
if $data(4)[7] != @interval not match@ then
|
||||||
goto step6
|
goto step6
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -120,11 +120,11 @@ step7:
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
sql select * from information_schema.ins_dnodes
|
||||||
print dnode1 off: $data(1)[6]
|
print dnode1 off: $data(1)[7]
|
||||||
print dnode3 off: $data(3)[6]
|
print dnode3 off: $data(3)[7]
|
||||||
print dnode4 off: $data(4)[6]
|
print dnode4 off: $data(4)[7]
|
||||||
print dnode5 off: $data(5)[6]
|
print dnode5 off: $data(5)[7]
|
||||||
if $data(5)[6] != @locale not match@ then
|
if $data(5)[7] != @locale not match@ then
|
||||||
goto step7
|
goto step7
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
@ -143,12 +143,12 @@ step8:
|
||||||
endi
|
endi
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
sql select * from information_schema.ins_dnodes
|
||||||
print dnode1 off: $data(1)[6]
|
print dnode1 off: $data(1)[7]
|
||||||
print dnode3 off: $data(3)[6]
|
print dnode3 off: $data(3)[7]
|
||||||
print dnode4 off: $data(4)[6]
|
print dnode4 off: $data(4)[7]
|
||||||
print dnode5 off: $data(5)[6]
|
print dnode5 off: $data(5)[7]
|
||||||
print dnode6 off: $data(6)[6]
|
print dnode6 off: $data(6)[7]
|
||||||
if $data(6)[6] != @charset not match@ then
|
if $data(6)[7] != @charset not match@ then
|
||||||
goto step8
|
goto step8
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
|
||||||
|
print ===== step1
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
sleep 50
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print ===== step2
|
||||||
|
|
||||||
|
sql create database test vgroups 4;
|
||||||
|
sql use test;
|
||||||
|
sql create stable st(ts timestamp,a int,b int,c int) tags(ta int,tb int,tc int);
|
||||||
|
sql create table t1 using st tags(1,1,1);
|
||||||
|
sql create table t2 using st tags(2,2,2);
|
||||||
|
sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2 from st interval(1s) ;
|
||||||
|
sql insert into t1 values(1648791211000,1,2,3);
|
||||||
|
sql insert into t1 values(1648791212000,2,2,3);
|
||||||
|
|
||||||
|
$loop_count = 0
|
||||||
|
loop0:
|
||||||
|
|
||||||
|
sleep 300
|
||||||
|
|
||||||
|
$loop_count = $loop_count + 1
|
||||||
|
if $loop_count == 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print 1 select * from streamt1;
|
||||||
|
sql select * from streamt1;
|
||||||
|
|
||||||
|
if $rows != 2 then
|
||||||
|
print rows=$rows
|
||||||
|
goto loop0
|
||||||
|
endi
|
||||||
|
|
||||||
|
print drop stream streams1
|
||||||
|
sql drop stream streams1;
|
||||||
|
|
||||||
|
print alter table streamt1 add column c3 double
|
||||||
|
sql alter table streamt1 add column c3 double;
|
||||||
|
|
||||||
|
print create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2, avg(b) c3 from st interval(1s) ;
|
||||||
|
sql create stream streams1 trigger at_once into streamt1 as select _wstart, count(*) c1, count(a) c2, avg(b) c3 from st interval(1s) ;
|
||||||
|
|
||||||
|
sql insert into t2 values(1648791213000,1,2,3);
|
||||||
|
sql insert into t1 values(1648791214000,1,2,3);
|
||||||
|
|
||||||
|
$loop_count = 0
|
||||||
|
loop1:
|
||||||
|
|
||||||
|
sleep 300
|
||||||
|
|
||||||
|
$loop_count = $loop_count + 1
|
||||||
|
if $loop_count == 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print 2 select * from streamt1;
|
||||||
|
sql select * from streamt1;
|
||||||
|
|
||||||
|
if $rows != 4 then
|
||||||
|
print rows=$rows
|
||||||
|
goto loop1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ======over
|
||||||
|
|
||||||
|
system sh/stop_dnodes.sh
|
|
@ -99,4 +99,14 @@ if $rows != 7 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
sql select * from st1 where tbname in('tb1') and tbname in ('tb2');
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql select * from st1 where tbname in ('tb1') and tbname != 'tb1';
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||||
|
|
|
@ -3,6 +3,8 @@ import taos
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import inspect
|
||||||
|
from taos.tmq import Consumer
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from util.log import *
|
from util.log import *
|
||||||
|
@ -99,6 +101,7 @@ class TDTestCase:
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
scriptsPath = os.path.dirname(os.path.realpath(__file__))
|
||||||
distro_id = distro.id()
|
distro_id = distro.id()
|
||||||
if distro_id == "alpine":
|
if distro_id == "alpine":
|
||||||
tdLog.info(f"alpine skip compatibility test")
|
tdLog.info(f"alpine skip compatibility test")
|
||||||
|
@ -128,19 +131,18 @@ class TDTestCase:
|
||||||
tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{BASEVERSION}")
|
tdLog.printNoPrefix(f"==========step1:prepare and check data in old version-{BASEVERSION}")
|
||||||
tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
|
tdLog.info(f" LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
|
||||||
os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
|
os.system(f"LD_LIBRARY_PATH=/usr/lib taosBenchmark -t {tableNumbers} -n {recordNumbers1} -y ")
|
||||||
sleep(3)
|
os.system(f"LD_LIBRARY_PATH=/usr/lib taos -s 'use test;create stream current_stream into current_stream_output_stb as select _wstart as `start`, _wend as wend, max(current) as max_current from meters where voltage <= 220 interval (5s);' ")
|
||||||
|
os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;create stream power_stream into power_stream_output_stb as select ts, concat_ws(\\".\\", location, tbname) as meter_location, current*voltage*cos(phase) as active_power, current*voltage*sin(phase) as reactive_power from meters partition by tbname;" ')
|
||||||
|
os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show streams;" ')
|
||||||
|
os.system(f"sed -i 's/\/etc\/taos/{cPath}/' 0-others/tmqBasic.json ")
|
||||||
|
# os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/tmqBasic.json -y ")
|
||||||
|
os.system('LD_LIBRARY_PATH=/usr/lib taos -s "create topic if not exists tmq_test_topic as select current,voltage,phase from test.meters where voltage <= 106 and current <= 5;" ')
|
||||||
|
os.system('LD_LIBRARY_PATH=/usr/lib taos -s "use test;show topics;" ')
|
||||||
|
|
||||||
# tdsqlF.query(f"select count(*) from {stb}")
|
|
||||||
# tdsqlF.checkData(0,0,tableNumbers*recordNumbers1)
|
|
||||||
os.system("pkill taosd")
|
|
||||||
self.checkProcessPid("taosd")
|
|
||||||
|
|
||||||
print(f"start taosd: nohup taosd -c {cPath} & ")
|
|
||||||
os.system(f" nohup taosd -c {cPath} & " )
|
|
||||||
sleep(10)
|
|
||||||
tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ")
|
tdLog.info(" LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y ")
|
||||||
os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y")
|
os.system("LD_LIBRARY_PATH=/usr/lib taosBenchmark -f 0-others/compa4096.json -y")
|
||||||
os.system("pkill taosd") # make sure all the data are saved in disk.
|
os.system("LD_LIBRARY_PATH=/usr/lib taos -s 'flush database db4096 '")
|
||||||
|
os.system("pkill taosd") # make sure all the data are saved in disk.
|
||||||
self.checkProcessPid("taosd")
|
self.checkProcessPid("taosd")
|
||||||
|
|
||||||
|
|
||||||
|
@ -161,10 +163,12 @@ class TDTestCase:
|
||||||
|
|
||||||
tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}")
|
tdLog.printNoPrefix(f"==========step3:prepare and check data in new version-{nowServerVersion}")
|
||||||
tdsql.query(f"select count(*) from {stb}")
|
tdsql.query(f"select count(*) from {stb}")
|
||||||
tdsql.checkData(0,0,tableNumbers*recordNumbers1)
|
tdsql.checkData(0,0,tableNumbers*recordNumbers1)
|
||||||
os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ")
|
# tdsql.query("show streams;")
|
||||||
tdsql.query(f"select count(*) from {stb}")
|
# os.system(f"taosBenchmark -t {tableNumbers} -n {recordNumbers2} -y ")
|
||||||
tdsql.checkData(0,0,tableNumbers*recordNumbers2)
|
# tdsql.query("show streams;")
|
||||||
|
# tdsql.query(f"select count(*) from {stb}")
|
||||||
|
# tdsql.checkData(0,0,tableNumbers*recordNumbers2)
|
||||||
tdsql.query(f"select count(*) from db4096.stb0")
|
tdsql.query(f"select count(*) from db4096.stb0")
|
||||||
tdsql.checkData(0,0,50000)
|
tdsql.checkData(0,0,50000)
|
||||||
|
|
||||||
|
@ -183,13 +187,58 @@ class TDTestCase:
|
||||||
tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);")
|
tdsql.execute("insert into db.`ct4` using db.stb1 TAGS(4) values(now(),14);")
|
||||||
tdsql.query("select * from db.ct4")
|
tdsql.query("select * from db.ct4")
|
||||||
tdsql.checkData(0,1,14)
|
tdsql.checkData(0,1,14)
|
||||||
|
print(1)
|
||||||
|
tdsql=tdCom.newTdSql()
|
||||||
tdsql.query("describe information_schema.ins_databases;")
|
tdsql.query("describe information_schema.ins_databases;")
|
||||||
qRows=tdsql.queryRows
|
qRows=tdsql.queryRows
|
||||||
for i in range(qRows) :
|
comFlag=True
|
||||||
if tdsql.queryResult[i][0]=="retentions" :
|
j=0
|
||||||
return True
|
while comFlag:
|
||||||
else:
|
for i in range(qRows) :
|
||||||
return False
|
if tdsql.queryResult[i][0] == "retentions" :
|
||||||
|
print("parameters include retentions")
|
||||||
|
comFlag=False
|
||||||
|
break
|
||||||
|
else :
|
||||||
|
comFlag=True
|
||||||
|
j=j+1
|
||||||
|
if j == qRows:
|
||||||
|
print("parameters don't include retentions")
|
||||||
|
caller = inspect.getframeinfo(inspect.stack()[0][0])
|
||||||
|
args = (caller.filename, caller.lineno)
|
||||||
|
tdLog.exit("%s(%d) failed" % args)
|
||||||
|
tdsql.query("show streams;")
|
||||||
|
tdsql.checkRows(2)
|
||||||
|
tdsql.execute("insert into test.d80 values (now+1s, 11, 103, 0.21);")
|
||||||
|
tdsql.execute("insert into test.d9 values (now+5s, 4.3, 104, 0.4);")
|
||||||
|
|
||||||
|
conn = taos.connect()
|
||||||
|
|
||||||
|
consumer = Consumer(
|
||||||
|
{
|
||||||
|
"group.id": "tg75",
|
||||||
|
"client.id": "124",
|
||||||
|
"td.connect.user": "root",
|
||||||
|
"td.connect.pass": "taosdata",
|
||||||
|
"enable.auto.commit": "true",
|
||||||
|
"experimental.snapshot.enable": "true",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
consumer.subscribe(["tmq_test_topic"])
|
||||||
|
|
||||||
|
while True:
|
||||||
|
res = consumer.poll(10)
|
||||||
|
if not res:
|
||||||
|
break
|
||||||
|
err = res.error()
|
||||||
|
if err is not None:
|
||||||
|
raise err
|
||||||
|
val = res.value()
|
||||||
|
|
||||||
|
for block in val:
|
||||||
|
print(block.fetchall())
|
||||||
|
tdsql.query("show topics;")
|
||||||
|
tdsql.checkRows(1)
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success(f"{__file__} successfully executed")
|
tdLog.success(f"{__file__} successfully executed")
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
from taos.tmq import Consumer
|
||||||
|
import taos
|
||||||
|
import taosrest
|
||||||
|
import socket
|
||||||
|
|
||||||
|
|
||||||
|
def init_tmq_env(db, topic):
|
||||||
|
conn = taos.connect()
|
||||||
|
# conn.execute("create dnode test209")
|
||||||
|
# conn.execute("create dnode test216")
|
||||||
|
# conn.execute("create mnode on dnode 2")
|
||||||
|
# conn.execute("create mnode on dnode 3")
|
||||||
|
|
||||||
|
conn.execute("drop topic if exists {}".format(topic))
|
||||||
|
conn.execute("drop database if exists {}".format(db))
|
||||||
|
conn.execute("create database if not exists {} replica 1 ".format(db))
|
||||||
|
conn.select_db(db)
|
||||||
|
conn.execute(
|
||||||
|
"create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))")
|
||||||
|
conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')")
|
||||||
|
conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')")
|
||||||
|
conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')")
|
||||||
|
conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic))
|
||||||
|
conn.execute("insert into tb1 values (now+10s, 1, 1.0, 'tmq test')")
|
||||||
|
conn.execute("insert into tb2 values (now+100s, 2, 2.0, 'tmq test')")
|
||||||
|
conn.execute("insert into tb3 values (now+20s, 3, 3.0, 'tmq test')")
|
||||||
|
conn.execute("insert into tb3 values (now+30s, 4, 4.0, 'tmq test4')")
|
||||||
|
|
||||||
|
def init_tmq_rest_env(db, topic):
|
||||||
|
host = socket.gethostname()
|
||||||
|
conn = taosrest.connect(url=f"http://{host}:6041")
|
||||||
|
|
||||||
|
# conn.execute("create dnode test209")
|
||||||
|
# conn.execute("create dnode test216")
|
||||||
|
# conn.execute("create mnode on dnode 2")
|
||||||
|
# conn.execute("create mnode on dnode 3")
|
||||||
|
|
||||||
|
conn.execute("drop topic if exists {}".format(topic))
|
||||||
|
conn.execute("drop database if exists {}".format(db))
|
||||||
|
conn.execute("create database if not exists {} replica 3 ".format(db))
|
||||||
|
conn.select_db(db)
|
||||||
|
conn.execute(
|
||||||
|
"create stable if not exists stb1 (ts timestamp, c1 int, c2 float, c3 varchar(16)) tags(t1 int, t3 varchar(16))")
|
||||||
|
conn.execute("create table if not exists tb1 using stb1 tags(1, 't1')")
|
||||||
|
conn.execute("create table if not exists tb2 using stb1 tags(2, 't2')")
|
||||||
|
conn.execute("create table if not exists tb3 using stb1 tags(3, 't3')")
|
||||||
|
conn.execute("create topic if not exists {} as select ts, c1, c2, c3 from stb1".format(topic))
|
||||||
|
conn.execute("insert into tb1 values (now+10s, 1, 1.0, 'tmq test')")
|
||||||
|
conn.execute("insert into tb2 values (now+100s, 2, 2.0, 'tmq test')")
|
||||||
|
conn.execute("insert into tb3 values (now+20s, 3, 3.0, 'tmq test')")
|
||||||
|
conn.execute("insert into tb3 values (now+30s, 4, 4.0, 'tmq test4')")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
conn = taos.connect()
|
||||||
|
|
||||||
|
init_tmq_env("tmq_test", "tmq_test_topic") # init env
|
||||||
|
# init_tmq_rest_env("tmq_test", "tmq_test_topic")
|
||||||
|
consumer = Consumer(
|
||||||
|
{
|
||||||
|
"group.id": "tg75",
|
||||||
|
"client.id": "124",
|
||||||
|
"td.connect.user": "root",
|
||||||
|
"td.connect.pass": "taosdata",
|
||||||
|
"enable.auto.commit": "true",
|
||||||
|
"experimental.snapshot.enable": "true",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
consumer.subscribe(["tmq_test_topic"])
|
||||||
|
|
||||||
|
while True:
|
||||||
|
res = consumer.poll(10)
|
||||||
|
if not res:
|
||||||
|
break
|
||||||
|
err = res.error()
|
||||||
|
if err is not None:
|
||||||
|
raise err
|
||||||
|
val = res.value()
|
||||||
|
|
||||||
|
for block in val:
|
||||||
|
print(block.fetchall())
|
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"filetype": "subscribe",
|
||||||
|
"cfgdir": "/etc/taos",
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 6030,
|
||||||
|
"user": "root",
|
||||||
|
"password": "taosdata",
|
||||||
|
"confirm_parameter_prompt": "no",
|
||||||
|
"tmq_info": {
|
||||||
|
"concurrent": 1,
|
||||||
|
"poll_delay": 10000,
|
||||||
|
"group.id": "grpId_0",
|
||||||
|
"client.id": "clientId",
|
||||||
|
"auto.offset.reset": "earliest",
|
||||||
|
"enable.auto.commit": "true",
|
||||||
|
"auto.commit.interval.ms": 1000,
|
||||||
|
"enable.heartbeat.background": "true",
|
||||||
|
"experimental.snapshot.enable": "true",
|
||||||
|
"msg.with.table.name": "false",
|
||||||
|
"topic_list": [
|
||||||
|
{"name": "tmq_topic_1", "sql": "select current,voltage,phase from test.meters where voltage <= 106 ;"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -716,8 +716,6 @@ class TDTestCase:
|
||||||
tdSql.checkRows(2)
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
# partition by col
|
# partition by col
|
||||||
tdSql.query(f"select c1 , mavg(c1,3) from {dbname}.stb1 partition by c1")
|
|
||||||
tdSql.checkRows(0)
|
|
||||||
tdSql.query(f"select c1 , mavg(c1,1) from {dbname}.stb1 partition by c1")
|
tdSql.query(f"select c1 , mavg(c1,1) from {dbname}.stb1 partition by c1")
|
||||||
tdSql.checkRows(40)
|
tdSql.checkRows(40)
|
||||||
tdSql.query(f"select c1, c2, c3, c4, mavg(c1,3) from {dbname}.stb1 partition by tbname ")
|
tdSql.query(f"select c1, c2, c3, c4, mavg(c1,3) from {dbname}.stb1 partition by tbname ")
|
||||||
|
|
|
@ -22,7 +22,7 @@ class TDTestCase:
|
||||||
tdSql.execute("insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)")
|
tdSql.execute("insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)")
|
||||||
|
|
||||||
tdSql.query("select count(*) from information_schema.ins_columns")
|
tdSql.query("select count(*) from information_schema.ins_columns")
|
||||||
tdSql.checkData(0, 0, 269)
|
tdSql.checkData(0, 0, 271)
|
||||||
|
|
||||||
tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'")
|
tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'")
|
||||||
tdSql.checkRows(14)
|
tdSql.checkRows(14)
|
||||||
|
|
|
@ -86,7 +86,7 @@ class TDTestCase:
|
||||||
self.ctbNums=ctbNums
|
self.ctbNums=ctbNums
|
||||||
rowNUms=5000
|
rowNUms=5000
|
||||||
ts=1451606400000
|
ts=1451606400000
|
||||||
tdSql.execute(f"create database {dbname};")
|
tdSql.execute(f"create database {dbname} cachemodel 'both';")
|
||||||
tdSql.execute(f"use {dbname} ")
|
tdSql.execute(f"use {dbname} ")
|
||||||
tdSql.execute(f'''
|
tdSql.execute(f'''
|
||||||
create table {stabname1} (ts timestamp,latitude double,longitude double,elevation double,velocity double,heading double,grade double,fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30),load_capacity double,fuel_capacity double,nominal_fuel_consumption double);
|
create table {stabname1} (ts timestamp,latitude double,longitude double,elevation double,velocity double,heading double,grade double,fuel_consumption double) tags (name binary(30),fleet binary(30),driver binary(30),model binary(30),device_version binary(30),load_capacity double,fuel_capacity double,nominal_fuel_consumption double);
|
||||||
|
|
|
@ -18,8 +18,8 @@ from tmqCommon import *
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.vgroups = 4
|
self.vgroups = 4
|
||||||
self.ctbNum = 3000
|
self.ctbNum = 1000
|
||||||
self.rowsPerTbl = 70
|
self.rowsPerTbl = 100
|
||||||
|
|
||||||
def init(self, conn, logSql, replicaVar=1):
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
self.replicaVar = int(replicaVar)
|
self.replicaVar = int(replicaVar)
|
||||||
|
@ -112,15 +112,15 @@ class TDTestCase:
|
||||||
# init consume info, and start tmq_sim, then check consume result
|
# init consume info, and start tmq_sim, then check consume result
|
||||||
tdLog.info("insert consume info to consume processor")
|
tdLog.info("insert consume info to consume processor")
|
||||||
consumerId = 3
|
consumerId = 3
|
||||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3)
|
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"])
|
||||||
topicList = topicNameList[0]
|
topicList = topicNameList[0]
|
||||||
ifcheckdata = 1
|
ifcheckdata = 1
|
||||||
ifManualCommit = 1
|
ifManualCommit = 1
|
||||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest'
|
keyList = 'group.id:cgrp3, enable.auto.commit:true, auto.commit.interval.ms:100, auto.offset.reset:earliest'
|
||||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
consumerId = 4
|
consumerId = 4
|
||||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3)
|
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"])
|
||||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
tdLog.info("start consume processor 0")
|
tdLog.info("start consume processor 0")
|
||||||
|
@ -131,8 +131,8 @@ class TDTestCase:
|
||||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||||
actConsumeTotalRows = resultList[0] + resultList[1]
|
actConsumeTotalRows = resultList[0] + resultList[1]
|
||||||
|
|
||||||
if not (totalRowsInserted == actConsumeTotalRows):
|
tdLog.info("sum of two consume rows: %d should be greater than or equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
||||||
tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
if not (totalRowsInserted <= actConsumeTotalRows):
|
||||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
@ -188,7 +188,7 @@ class TDTestCase:
|
||||||
topicList = topicNameList[0]
|
topicList = topicNameList[0]
|
||||||
ifcheckdata = 1
|
ifcheckdata = 1
|
||||||
ifManualCommit = 1
|
ifManualCommit = 1
|
||||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest'
|
keyList = 'group.id:cgrp4, enable.auto.commit:true, auto.commit.interval.ms:100, auto.offset.reset:earliest'
|
||||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
tdLog.info("start consume processor 0")
|
tdLog.info("start consume processor 0")
|
||||||
|
@ -216,9 +216,9 @@ class TDTestCase:
|
||||||
|
|
||||||
actConsumeTotalRows = resultList[0]
|
actConsumeTotalRows = resultList[0]
|
||||||
|
|
||||||
if not (actConsumeTotalRows > 0 and actConsumeTotalRows < totalRowsInserted):
|
tdLog.info("act consume rows: %d"%(actConsumeTotalRows))
|
||||||
tdLog.info("act consume rows: %d"%(actConsumeTotalRows))
|
tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted))
|
||||||
tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted))
|
if not (actConsumeTotalRows > 0 and actConsumeTotalRows <= totalRowsInserted):
|
||||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
|
@ -18,7 +18,7 @@ from tmqCommon import *
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.vgroups = 4
|
self.vgroups = 4
|
||||||
self.ctbNum = 10
|
self.ctbNum = 4
|
||||||
self.rowsPerTbl = 10000
|
self.rowsPerTbl = 10000
|
||||||
|
|
||||||
def init(self, conn, logSql, replicaVar=1):
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
@ -41,7 +41,7 @@ class TDTestCase:
|
||||||
'ctbStartIdx': 0,
|
'ctbStartIdx': 0,
|
||||||
'ctbNum': 10,
|
'ctbNum': 10,
|
||||||
'rowsPerTbl': 10000,
|
'rowsPerTbl': 10000,
|
||||||
'batchNum': 10,
|
'batchNum': 1000,
|
||||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||||
'pollDelay': 3,
|
'pollDelay': 3,
|
||||||
'showMsg': 1,
|
'showMsg': 1,
|
||||||
|
@ -112,15 +112,15 @@ class TDTestCase:
|
||||||
# init consume info, and start tmq_sim, then check consume result
|
# init consume info, and start tmq_sim, then check consume result
|
||||||
tdLog.info("insert consume info to consume processor")
|
tdLog.info("insert consume info to consume processor")
|
||||||
consumerId = 3
|
consumerId = 3
|
||||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3)
|
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"])
|
||||||
topicList = topicNameList[0]
|
topicList = topicNameList[0]
|
||||||
ifcheckdata = 1
|
ifcheckdata = 1
|
||||||
ifManualCommit = 1
|
ifManualCommit = 1
|
||||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
|
keyList = 'group.id:cgrp3, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
|
||||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
consumerId = 4
|
consumerId = 4
|
||||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3)
|
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"])
|
||||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
tdLog.info("start consume processor 0")
|
tdLog.info("start consume processor 0")
|
||||||
|
@ -130,9 +130,9 @@ class TDTestCase:
|
||||||
expectRows = 2
|
expectRows = 2
|
||||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||||
actConsumeTotalRows = resultList[0] + resultList[1]
|
actConsumeTotalRows = resultList[0] + resultList[1]
|
||||||
|
|
||||||
if not (totalRowsInserted == actConsumeTotalRows):
|
tdLog.info("sum of two consume rows: %d should be greater than or equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
||||||
tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
if not (totalRowsInserted <= actConsumeTotalRows):
|
||||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
@ -188,7 +188,7 @@ class TDTestCase:
|
||||||
topicList = topicNameList[0]
|
topicList = topicNameList[0]
|
||||||
ifcheckdata = 1
|
ifcheckdata = 1
|
||||||
ifManualCommit = 1
|
ifManualCommit = 1
|
||||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
|
keyList = 'group.id:cgrp4, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
|
||||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
tdLog.info("start consume processor 0")
|
tdLog.info("start consume processor 0")
|
||||||
|
@ -216,7 +216,7 @@ class TDTestCase:
|
||||||
|
|
||||||
actConsumeTotalRows = resultList[0]
|
actConsumeTotalRows = resultList[0]
|
||||||
|
|
||||||
if not (actConsumeTotalRows > 0 and actConsumeTotalRows < totalRowsInserted):
|
if not (actConsumeTotalRows > 0 and actConsumeTotalRows <= totalRowsInserted):
|
||||||
tdLog.info("act consume rows: %d"%(actConsumeTotalRows))
|
tdLog.info("act consume rows: %d"%(actConsumeTotalRows))
|
||||||
tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted))
|
tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted))
|
||||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||||
|
|
|
@ -41,7 +41,7 @@ class TDTestCase:
|
||||||
'ctbStartIdx': 0,
|
'ctbStartIdx': 0,
|
||||||
'ctbNum': 10,
|
'ctbNum': 10,
|
||||||
'rowsPerTbl': 10000,
|
'rowsPerTbl': 10000,
|
||||||
'batchNum': 10,
|
'batchNum': 100,
|
||||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||||
'pollDelay': 3,
|
'pollDelay': 3,
|
||||||
'showMsg': 1,
|
'showMsg': 1,
|
||||||
|
@ -87,7 +87,7 @@ class TDTestCase:
|
||||||
'rowsPerTbl': 10000,
|
'rowsPerTbl': 10000,
|
||||||
'batchNum': 10,
|
'batchNum': 10,
|
||||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||||
'pollDelay': 25,
|
'pollDelay': 10,
|
||||||
'showMsg': 1,
|
'showMsg': 1,
|
||||||
'showRow': 1,
|
'showRow': 1,
|
||||||
'snapshot': 1}
|
'snapshot': 1}
|
||||||
|
@ -116,7 +116,7 @@ class TDTestCase:
|
||||||
topicList = topicNameList[0]
|
topicList = topicNameList[0]
|
||||||
ifcheckdata = 1
|
ifcheckdata = 1
|
||||||
ifManualCommit = 1
|
ifManualCommit = 1
|
||||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
|
keyList = 'group.id:cgrp3, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
|
||||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
consumerId = 4
|
consumerId = 4
|
||||||
|
@ -131,8 +131,8 @@ class TDTestCase:
|
||||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||||
actConsumeTotalRows = resultList[0] + resultList[1]
|
actConsumeTotalRows = resultList[0] + resultList[1]
|
||||||
|
|
||||||
|
tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
||||||
if not (totalRowsInserted == actConsumeTotalRows):
|
if not (totalRowsInserted == actConsumeTotalRows):
|
||||||
tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
|
||||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
@ -188,7 +188,7 @@ class TDTestCase:
|
||||||
topicList = topicNameList[0]
|
topicList = topicNameList[0]
|
||||||
ifcheckdata = 1
|
ifcheckdata = 1
|
||||||
ifManualCommit = 1
|
ifManualCommit = 1
|
||||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
|
keyList = 'group.id:cgrp4, enable.auto.commit:true, auto.commit.interval.ms:200, auto.offset.reset:earliest'
|
||||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||||
|
|
||||||
tdLog.info("start consume processor 0")
|
tdLog.info("start consume processor 0")
|
||||||
|
@ -213,12 +213,11 @@ class TDTestCase:
|
||||||
|
|
||||||
expectRows = 1
|
expectRows = 1
|
||||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||||
|
|
||||||
actConsumeTotalRows = resultList[0]
|
actConsumeTotalRows = resultList[0]
|
||||||
|
|
||||||
if not (actConsumeTotalRows > 0 and actConsumeTotalRows < totalRowsInserted):
|
tdLog.info("act consume rows: %d"%(actConsumeTotalRows))
|
||||||
tdLog.info("act consume rows: %d"%(actConsumeTotalRows))
|
tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted))
|
||||||
tdLog.info("and second consume rows should be between 0 and %d"%(totalRowsInserted))
|
if not ((actConsumeTotalRows > 0) and (actConsumeTotalRows <= totalRowsInserted)):
|
||||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||||
|
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
|
@ -83,7 +83,7 @@ typedef struct {
|
||||||
const char *clientVersion;
|
const char *clientVersion;
|
||||||
char cusName[32];
|
char cusName[32];
|
||||||
char promptHeader[32];
|
char promptHeader[32];
|
||||||
const char* promptContinue;
|
char promptContinue[32];
|
||||||
const char* osname;
|
const char* osname;
|
||||||
int32_t promptSize;
|
int32_t promptSize;
|
||||||
char programVersion[256];
|
char programVersion[256];
|
||||||
|
|
|
@ -411,7 +411,9 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
|
||||||
"Copyright (c) 2022 by %s, all rights reserved.\r\n\r\n";
|
"Copyright (c) 2022 by %s, all rights reserved.\r\n\r\n";
|
||||||
strcpy(shell.info.cusName, cusName);
|
strcpy(shell.info.cusName, cusName);
|
||||||
sprintf(shell.info.promptHeader, "%s> ", cusPrompt);
|
sprintf(shell.info.promptHeader, "%s> ", cusPrompt);
|
||||||
shell.info.promptContinue = TAOS_CONSOLE_PROMPT_CONTINUE;
|
char promptContinueFormat[32] = {0};
|
||||||
|
sprintf(promptContinueFormat, "%%%zus> ", strlen(cusPrompt));
|
||||||
|
sprintf(shell.info.promptContinue, promptContinueFormat, " ");
|
||||||
shell.info.promptSize = strlen(shell.info.promptHeader);
|
shell.info.promptSize = strlen(shell.info.promptHeader);
|
||||||
snprintf(shell.info.programVersion, sizeof(shell.info.programVersion),
|
snprintf(shell.info.programVersion, sizeof(shell.info.programVersion),
|
||||||
"version: %s compatible_version: %s\ngitinfo: %s\nbuildInfo: %s", version, compatible_version, gitinfo,
|
"version: %s compatible_version: %s\ngitinfo: %s\nbuildInfo: %s", version, compatible_version, gitinfo,
|
||||||
|
|
Loading…
Reference in New Issue