Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ab8b8875
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ab8b8875
编写于
1月 11, 2022
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
(query):return invalid version when taosd meet lower table schema version/tag version
上级
b77c5870
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
17 addition
and
57 deletion
+17
-57
src/client/src/tscServer.c
src/client/src/tscServer.c
+4
-33
src/inc/query.h
src/inc/query.h
+1
-2
src/inc/taoserror.h
src/inc/taoserror.h
+1
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-0
src/query/src/queryMain.c
src/query/src/queryMain.c
+8
-4
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+1
-18
未找到文件。
src/client/src/tscServer.c
浏览文件 @
ab8b8875
...
...
@@ -418,7 +418,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
// single table query error need to be handled here.
if
((
cmd
==
TSDB_SQL_SELECT
||
cmd
==
TSDB_SQL_UPDATE_TAGS_VAL
)
&&
(((
rpcMsg
->
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
rpcMsg
->
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
))
||
rpcMsg
->
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
rpcMsg
->
code
==
TSDB_CODE_APP_NOT_READY
))
{
(
rpcMsg
->
code
==
TSDB_CODE_QRY_INVALID_SCHEMA_VERSION
)
||
rpcMsg
->
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
rpcMsg
->
code
==
TSDB_CODE_APP_NOT_READY
))
{
// 1. super table subquery
// 2. nest queries are all not updated the tablemeta and retry parse the sql after cleanup local tablemeta/vgroup id buffer
...
...
@@ -508,18 +509,6 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
if
(
pRes
->
code
==
TSDB_CODE_SUCCESS
&&
pCmd
->
command
<
TSDB_SQL_MAX
&&
tscProcessMsgRsp
[
pCmd
->
command
])
{
rpcMsg
->
code
=
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
if
(
rpcMsg
->
code
==
TSDB_CODE_TSC_INVALID_SCHEMA_VERSION
)
{
pSql
->
res
.
code
=
rpcMsg
->
code
;
tscWarn
(
"0x%"
PRIx64
" it shall renew table meta, code:%s, retry:%d"
,
pSql
->
self
,
tstrerror
(
rpcMsg
->
code
),
pSql
->
retry
);
++
pSql
->
retry
;
if
(
pSql
->
retry
>
pSql
->
maxRetry
)
{
tscError
(
"0x%"
PRIx64
" max retry %d reached, give up"
,
pSql
->
self
,
pSql
->
maxRetry
);
}
else
{
pSql
->
retryReason
=
rpcMsg
->
code
;
rpcMsg
->
code
=
tscRenewTableMeta
(
pSql
);
}
}
}
bool
shouldFree
=
tscShouldBeFreed
(
pSql
);
...
...
@@ -976,6 +965,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pQueryMsg
->
queryType
=
htonl
(
pQueryInfo
->
type
);
pQueryMsg
->
prevResultLen
=
htonl
(
pQueryInfo
->
bufLen
);
pQueryMsg
->
schemaVersion
=
htons
(
pTableMeta
->
sversion
);
pQueryMsg
->
tagVersion
=
htons
(
pTableMeta
->
tversion
);
// set column list ids
size_t
numOfCols
=
taosArrayGetSize
(
pQueryInfo
->
colList
);
char
*
pMsg
=
(
char
*
)(
pQueryMsg
->
tableCols
)
+
numOfCols
*
sizeof
(
SColumnInfo
);
...
...
@@ -2705,26 +2696,6 @@ int tscProcessQueryRsp(SSqlObj *pSql) {
tscResetForNextRetrieve
(
pRes
);
int32_t
sVersion
=
-
1
;
int32_t
tVersion
=
-
1
;
if
(
pQueryAttr
->
extend
==
1
)
{
STLV
*
tlv
=
(
STLV
*
)(
pRes
->
pRsp
+
sizeof
(
SQueryTableRsp
));
while
(
tlv
->
type
!=
TLV_TYPE_END_MARK
)
{
switch
(
ntohs
(
tlv
->
type
))
{
case
TLV_TYPE_META_VERSION
:
sVersion
=
ntohl
(
*
(
int32_t
*
)
tlv
->
value
);
tVersion
=
ntohl
(
*
(
int32_t
*
)(
tlv
->
value
+
sizeof
(
int32_t
)));
break
;
}
tlv
=
(
STLV
*
)
((
char
*
)
tlv
+
sizeof
(
STLV
)
+
ntohl
(
tlv
->
len
));
}
}
STableMetaInfo
*
tableMetaInfo
=
tscGetTableMetaInfoFromCmd
(
&
pSql
->
cmd
,
0
);
if
(
tableMetaInfo
->
pTableMeta
->
sversion
<
sVersion
||
tableMetaInfo
->
pTableMeta
->
tversion
<
tVersion
)
{
return
TSDB_CODE_TSC_INVALID_SCHEMA_VERSION
;
}
tscDebug
(
"0x%"
PRIx64
" query rsp received, qId:0x%"
PRIx64
,
pSql
->
self
,
pRes
->
qId
);
return
0
;
...
...
src/inc/query.h
浏览文件 @
ab8b8875
...
...
@@ -28,8 +28,7 @@ typedef void* qinfo_t;
* @param qinfo
* @return
*/
int32_t
qCreateQueryInfo
(
void
*
tsdb
,
int32_t
vgId
,
SQueryTableMsg
*
pQueryTableMsg
,
qinfo_t
*
qinfo
,
uint64_t
qId
,
int32_t
*
schemaVersion
,
int32_t
*
tagVersion
);
int32_t
qCreateQueryInfo
(
void
*
tsdb
,
int32_t
vgId
,
SQueryTableMsg
*
pQueryTableMsg
,
qinfo_t
*
qinfo
,
uint64_t
qId
);
/**
...
...
src/inc/taoserror.h
浏览文件 @
ab8b8875
...
...
@@ -292,6 +292,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_QRY_INCONSISTAN TAOS_DEF_ERROR_CODE(0, 0x070C) //"File inconsistency in replica")
#define TSDB_CODE_QRY_SYS_ERROR TAOS_DEF_ERROR_CODE(0, 0x070D) //"System error")
#define TSDB_CODE_QRY_INVALID_TIME_CONDITION TAOS_DEF_ERROR_CODE(0, 0x070E) //"invalid time condition")
#define TSDB_CODE_QRY_INVALID_SCHEMA_VERSION TAOS_DEF_ERROR_CODE(0, 0x0710) //"invalid schema version")
// grant
#define TSDB_CODE_GRANT_EXPIRED TAOS_DEF_ERROR_CODE(0, 0x0800) //"License expired"
...
...
src/inc/taosmsg.h
浏览文件 @
ab8b8875
...
...
@@ -523,6 +523,8 @@ typedef struct {
int32_t
udfNum
;
// number of udf function
int32_t
udfContentOffset
;
int32_t
udfContentLen
;
int16_t
schemaVersion
;
int16_t
tagVersion
;
SColumnInfo
tableCols
[];
}
SQueryTableMsg
;
...
...
src/query/src/queryMain.c
浏览文件 @
ab8b8875
...
...
@@ -67,8 +67,7 @@ void freeParam(SQueryParam *param) {
tfree
(
param
->
prevResult
);
}
int32_t
qCreateQueryInfo
(
void
*
tsdb
,
int32_t
vgId
,
SQueryTableMsg
*
pQueryMsg
,
qinfo_t
*
pQInfo
,
uint64_t
qId
,
int32_t
*
schemaVersion
,
int32_t
*
tagVersion
)
{
int32_t
qCreateQueryInfo
(
void
*
tsdb
,
int32_t
vgId
,
SQueryTableMsg
*
pQueryMsg
,
qinfo_t
*
pQInfo
,
uint64_t
qId
)
{
assert
(
pQueryMsg
!=
NULL
&&
tsdb
!=
NULL
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
...
@@ -163,6 +162,13 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
assert
(
0
);
}
int16_t
queryTagVersion
=
ntohs
(
pQueryMsg
->
tagVersion
);
int16_t
querySchemaVersion
=
ntohs
(
pQueryMsg
->
schemaVersion
);
if
(
queryTagVersion
<
tableGroupInfo
.
tVersion
||
querySchemaVersion
<
tableGroupInfo
.
sVersion
)
{
code
=
TSDB_CODE_QRY_INVALID_SCHEMA_VERSION
;
goto
_over
;
}
code
=
checkForQueryBuf
(
tableGroupInfo
.
numOfTables
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// not enough query buffer, abort
goto
_over
;
...
...
@@ -187,8 +193,6 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
code
=
initQInfo
(
&
pQueryMsg
->
tsBuf
,
tsdb
,
NULL
,
*
pQInfo
,
&
param
,
(
char
*
)
pQueryMsg
,
pQueryMsg
->
prevResultLen
,
NULL
);
*
schemaVersion
=
tableGroupInfo
.
sVersion
;
*
tagVersion
=
tableGroupInfo
.
tVersion
;
_over:
if
(
param
.
pGroupbyExpr
!=
NULL
)
{
taosArrayDestroy
(
&
(
param
.
pGroupbyExpr
->
columnInfo
));
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
ab8b8875
...
...
@@ -239,30 +239,13 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if
(
contLen
!=
0
)
{
qinfo_t
pQInfo
=
NULL
;
uint64_t
qId
=
genQueryId
();
int32_t
schemaVersion
=
-
1
;
int32_t
tagVersion
=
-
1
;
code
=
qCreateQueryInfo
(
pVnode
->
tsdb
,
pVnode
->
vgId
,
pQueryTableMsg
,
&
pQInfo
,
qId
,
&
schemaVersion
,
&
tagVersion
);
code
=
qCreateQueryInfo
(
pVnode
->
tsdb
,
pVnode
->
vgId
,
pQueryTableMsg
,
&
pQInfo
,
qId
);
size_t
rspLen
=
sizeof
(
SQueryTableRsp
);
rspLen
+=
(
sizeof
(
STLV
)
+
sizeof
(
int32_t
)
+
sizeof
(
int32_t
));
rspLen
+=
sizeof
(
STLV
);
SQueryTableRsp
*
pRsp
=
(
SQueryTableRsp
*
)
rpcMallocCont
(
rspLen
);
pRsp
->
code
=
code
;
pRsp
->
qId
=
0
;
pRsp
->
extend
=
1
;
STLV
*
tlv
=
(
STLV
*
)((
char
*
)(
pRsp
)
+
sizeof
(
SQueryTableRsp
));
tlv
->
type
=
htons
(
TLV_TYPE_META_VERSION
);
tlv
->
len
=
htonl
(
sizeof
(
int32_t
)
+
sizeof
(
int32_t
));
int32_t
sVersion
=
htonl
(
schemaVersion
);
int32_t
tVersion
=
htonl
(
tagVersion
);
memcpy
(
tlv
->
value
,
&
sVersion
,
sizeof
(
int32_t
));
memcpy
(
tlv
->
value
+
sizeof
(
int32_t
),
&
tVersion
,
sizeof
(
int32_t
));
STLV
*
tlvEnd
=
(
STLV
*
)((
char
*
)
tlv
+
sizeof
(
STLV
)
+
ntohl
(
tlv
->
len
));
tlvEnd
->
type
=
htons
(
TLV_TYPE_END_MARK
);
tlvEnd
->
len
=
0
;
pRet
->
len
=
rspLen
;
pRet
->
rsp
=
pRsp
;
int32_t
vgId
=
pVnode
->
vgId
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录