Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dad4ceb6
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看板
提交
dad4ceb6
编写于
12月 18, 2021
作者:
haoranc
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of github.com:taosdata/TDengine into dev/chr
上级
f3c70621
55655b22
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
110 addition
and
57 deletion
+110
-57
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+33
-20
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+5
-0
src/kit/taos-tools
src/kit/taos-tools
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+0
-3
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+1
-1
src/plugins/taosadapter
src/plugins/taosadapter
+1
-1
src/util/src/tutil.c
src/util/src/tutil.c
+21
-25
src/util/tests/stringTest.cpp
src/util/tests/stringTest.cpp
+38
-0
tests/develop-test/0-management/3-tag/json_tag.py
tests/develop-test/0-management/3-tag/json_tag.py
+4
-0
tests/examples/JDBC/connectionPools/pom.xml
tests/examples/JDBC/connectionPools/pom.xml
+1
-1
tests/script/general/parser/select_with_tags.sim
tests/script/general/parser/select_with_tags.sim
+3
-3
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
dad4ceb6
...
...
@@ -440,7 +440,7 @@ int tsParseSql(SSqlObj *pSql, bool initial);
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpcEpSet
*
pEpSet
);
int
tscBuildAndSendRequest
(
SSqlObj
*
pSql
,
SQueryInfo
*
pQueryInfo
);
int
tscRenewTableMeta
(
SSqlObj
*
pSql
,
int32_t
tableIndex
);
int
tscRenewTableMeta
(
SSqlObj
*
pSql
);
void
tscAsyncResultOnError
(
SSqlObj
*
pSql
);
void
tscQueueAsyncError
(
void
(
*
fp
),
void
*
param
,
int32_t
code
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
dad4ceb6
...
...
@@ -9508,7 +9508,7 @@ static int32_t doLoadAllTableMeta(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNod
char
buf
[
TSDB_TABLE_FNAME_LEN
];
SStrToken
sTblToken
;
sTblToken
.
z
=
buf
;
if
(
validateTableName
(
oriName
->
z
,
oriName
->
n
,
&
sTblToken
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
src/client/src/tscServer.c
浏览文件 @
dad4ceb6
...
...
@@ -444,7 +444,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
}
pSql
->
retryReason
=
rpcMsg
->
code
;
rpcMsg
->
code
=
tscRenewTableMeta
(
pSql
,
0
);
rpcMsg
->
code
=
tscRenewTableMeta
(
pSql
);
// if there is an error occurring, proceed to the following error handling procedure.
if
(
rpcMsg
->
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
taosReleaseRef
(
tscObjRef
,
handle
);
...
...
@@ -3074,28 +3074,46 @@ static void freeElem(void* p) {
/**
* retrieve table meta from mnode, and then update the local table meta hashmap.
* @param pSql sql object
* @param tableIndex table index
* @return status code
*/
int
tscRenewTableMeta
(
SSqlObj
*
pSql
,
int32_t
tableIndex
)
{
int
tscRenewTableMeta
(
SSqlObj
*
pSql
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
tableIndex
);
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
int32_t
code
=
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"0x%"
PRIx64
" failed to generate the table full name"
,
pSql
->
self
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
SArray
*
pNameList
=
taosArrayInit
(
1
,
POINTER_BYTES
);
SArray
*
vgroupList
=
taosArrayInit
(
1
,
POINTER_BYTES
);
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
pTableMeta
)
{
tscDebug
(
"0x%"
PRIx64
" update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%"
PRIu64
,
pSql
->
self
,
name
,
tscGetNumOfTags
(
pTableMeta
),
tscGetNumOfColumns
(
pTableMeta
),
pTableMeta
->
id
.
uid
);
SHashObj
*
nameTable
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_NO_LOCK
);
while
(
pQueryInfo
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
char
name
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
code
=
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
name
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"0x%"
PRIx64
" failed to generate the table full name"
,
pSql
->
self
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
//do not add duplicate names
if
(
!
taosHashGet
(
nameTable
,
name
,
strlen
(
name
)))
{
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
pTableMeta
)
{
tscDebug
(
"0x%"
PRIx64
" update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%"
PRIu64
,
pSql
->
self
,
name
,
tscGetNumOfTags
(
pTableMeta
),
tscGetNumOfColumns
(
pTableMeta
),
pTableMeta
->
id
.
uid
);
}
char
*
n
=
strdup
(
name
);
taosArrayPush
(
pNameList
,
&
n
);
uint8_t
dummy_val
=
0
;
taosHashPut
(
nameTable
,
name
,
strlen
(
name
),
&
dummy_val
,
sizeof
(
uint8_t
));
}
pQueryInfo
=
pQueryInfo
->
sibling
;
}
taosHashCleanup
(
nameTable
);
// remove stored tableMeta info in hash table
tscResetSqlCmd
(
pCmd
,
true
,
pSql
->
self
);
...
...
@@ -3103,18 +3121,13 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
SSqlCmd
*
pCmd2
=
&
pSql
->
rootObj
->
cmd
;
pCmd2
->
pTableMetaMap
=
tscCleanupTableMetaMap
(
pCmd2
->
pTableMetaMap
);
pCmd2
->
pTableMetaMap
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_NO_LOCK
);
pSql
->
rootObj
->
retryReason
=
pSql
->
retryReason
;
SSqlObj
*
tmpSql
=
pSql
->
rootObj
;
tscFreeSubobj
(
pSql
->
rootObj
);
tfree
(
tmpSql
->
pSubs
);
SArray
*
pNameList
=
taosArrayInit
(
1
,
POINTER_BYTES
);
SArray
*
vgroupList
=
taosArrayInit
(
1
,
POINTER_BYTES
);
char
*
n
=
strdup
(
name
);
taosArrayPush
(
pNameList
,
&
n
);
code
=
getMultiTableMetaFromMnode
(
tmpSql
,
pNameList
,
vgroupList
,
NULL
,
tscTableMetaCallBack
,
true
);
taosArrayDestroyEx
(
pNameList
,
freeElem
);
taosArrayDestroyEx
(
vgroupList
,
freeElem
);
...
...
src/client/src/tscUtil.c
浏览文件 @
dad4ceb6
...
...
@@ -5522,6 +5522,11 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in
varDataSetLen
(
tagData
,
outLen
);
tdAddColToKVRow
(
kvRowBuilder
,
jsonIndex
++
,
TSDB_DATA_TYPE_NCHAR
,
tagVal
,
true
);
}
else
if
(
item
->
type
==
cJSON_Number
){
if
(
!
isfinite
(
item
->
valuedouble
)){
tscError
(
"json value is invalidate"
);
retCode
=
tscSQLSyntaxErrMsg
(
errMsg
,
"json value number is illegal"
,
NULL
);
goto
end
;
}
char
tagVal
[
LONG_BYTES
+
CHAR_BYTES
]
=
{
0
};
*
tagVal
=
jsonType2DbType
(
item
->
valuedouble
,
item
->
type
);
// type
char
*
tagData
=
POINTER_SHIFT
(
tagVal
,
CHAR_BYTES
);
...
...
taos-tools
@
dca4059d
比较
7eae58a0
...
dca4059d
Subproject commit
7eae58a0fbf7c7321dd1bdc96e375d4c832cf373
Subproject commit
dca4059d87c3f5c678a5e946978d40daec204e27
src/mnode/src/mnodeDb.c
浏览文件 @
dad4ceb6
...
...
@@ -1003,7 +1003,6 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
newCfg
.
daysToKeep0
=
daysToKeep0
;
}
#ifdef _STORAGE
if
(
daysToKeep1
>
0
&&
(
daysToKeep1
!=
pDb
->
cfg
.
daysToKeep1
||
newCfg
.
daysToKeep1
!=
pDb
->
cfg
.
daysToKeep1
))
{
mDebug
(
"db:%s, daysToKeep1:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
daysToKeep1
,
daysToKeep1
);
newCfg
.
daysToKeep1
=
daysToKeep1
;
...
...
@@ -1013,7 +1012,6 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
mDebug
(
"db:%s, daysToKeep2:%d change to %d"
,
pDb
->
name
,
pDb
->
cfg
.
daysToKeep2
,
daysToKeep2
);
newCfg
.
daysToKeep2
=
daysToKeep2
;
}
#endif
if
(
minRows
>
0
&&
minRows
!=
pDb
->
cfg
.
minRowsPerFileBlock
)
{
mError
(
"db:%s, can't alter minRows option"
,
pDb
->
name
);
...
...
@@ -1102,7 +1100,6 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SAlterDbMsg *pAlter) {
// community version can only change daysToKeep
// but enterprise version can change all daysToKeep options
#ifndef _STORAGE
newCfg
.
daysToKeep1
=
newCfg
.
daysToKeep0
;
newCfg
.
daysToKeep2
=
newCfg
.
daysToKeep0
;
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
dad4ceb6
...
...
@@ -298,7 +298,7 @@ void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t o
if
(
have
)
continue
;
if
(
pVgroup
->
status
==
TAOS_VG_STATUS_CREATING
||
pVgroup
->
status
==
TAOS_VG_STATUS_DROPPING
)
{
if
(
/*pVgroup->status == TAOS_VG_STATUS_CREATING ||*/
pVgroup
->
status
==
TAOS_VG_STATUS_DROPPING
)
{
mDebug
(
"vgId:%d, not exist in dnode:%d and status is %s, do nothing"
,
pVgroup
->
vgId
,
pDnode
->
dnodeId
,
vgroupStatus
[
pVgroup
->
status
]);
}
else
{
...
...
taosadapter
@
826f3d3b
比较
88346a2e
...
826f3d3b
Subproject commit 8
8346a2e4e2e9282d2ec8b8c5264ca1ec23698a1
Subproject commit 8
26f3d3b7820a5c007d301854d56db003b424d0a
src/util/src/tutil.c
浏览文件 @
dad4ceb6
...
...
@@ -57,36 +57,32 @@ int32_t strdequote(char *z) {
return
j
+
1
;
// only one quote, do nothing
}
// delete escape character: \\, \', \"
int32_t
strRmquote
(
char
*
z
,
int32_t
len
){
// delete escape character: \\, \', \"
char
delim
=
z
[
0
];
if
(
delim
!=
'\''
&&
delim
!=
'\"'
)
{
return
len
;
char
delim
=
0
;
int32_t
cnt
=
0
;
int32_t
j
=
0
;
for
(
size_t
k
=
0
;
k
<
len
;
++
k
)
{
if
(
!
delim
&&
(
z
[
k
]
==
'\''
||
z
[
k
]
==
'"'
)){
// find the start ' or "
delim
=
z
[
k
];
}
int32_t
cnt
=
0
;
int32_t
j
=
0
;
for
(
uint32_t
k
=
1
;
k
<
len
-
1
;
++
k
)
{
if
(
z
[
k
]
==
'\\'
||
(
z
[
k
]
==
delim
&&
z
[
k
+
1
]
==
delim
))
{
if
((
z
[
k
]
==
'\\'
&&
z
[
k
+
1
]
==
'_'
)
||
(
z
[
k
]
==
'\\'
&&
z
[
k
+
1
]
==
'%'
))
{
//match '_' self
}
else
{
z
[
j
]
=
z
[
k
+
1
];
cnt
++
;
j
++
;
k
++
;
continue
;
}
}
z
[
j
]
=
z
[
k
];
if
((
z
[
k
]
==
'\\'
&&
z
[
k
+
1
]
==
'_'
)
||
(
z
[
k
]
==
'\\'
&&
z
[
k
+
1
]
==
'%'
))
{
//match '_' '%' self
}
else
if
(
z
[
k
]
==
'\\'
){
z
[
j
]
=
z
[
k
+
1
];
cnt
++
;
j
++
;
k
++
;
continue
;
}
else
if
(
z
[
k
]
==
delim
){
continue
;
}
z
[
j
]
=
0
;
return
len
-
2
-
cnt
;
z
[
j
]
=
z
[
k
];
j
++
;
}
z
[
j
]
=
0
;
return
j
;
}
int32_t
strRmquoteEscape
(
char
*
z
,
int32_t
len
)
{
...
...
src/util/tests/stringTest.cpp
浏览文件 @
dad4ceb6
...
...
@@ -6,6 +6,44 @@
#include "taos.h"
#include "tutil.h"
TEST
(
testCase
,
str_rmquote_test
)
{
char
t1
[]
=
"
\"\"
.dd"
;
int32_t
len
=
strRmquote
(
t1
,
strlen
(
t1
));
printf
(
"t1:%s, len:%d
\n
"
,
t1
,
len
);
EXPECT_EQ
(
3
,
len
);
EXPECT_STRCASEEQ
(
t1
,
".dd"
);
char
t2
[]
=
"
\"
fsd
\\\"
fs
\"
.dd"
;
len
=
strRmquote
(
t2
,
strlen
(
t2
));
printf
(
"t2:%s, len:%d
\n
"
,
t2
,
len
);
EXPECT_EQ
(
9
,
len
);
EXPECT_STRCASEEQ
(
t2
,
"fsd
\"
fs.dd"
);
char
t3
[]
=
"fs
\\
_d
\\
%.d
\\
d"
;
len
=
strRmquote
(
t3
,
strlen
(
t3
));
printf
(
"t3:%s, len:%d
\n
"
,
t3
,
len
);
EXPECT_EQ
(
10
,
len
);
EXPECT_STRCASEEQ
(
t3
,
"fs
\\
_d
\\
%.dd"
);
char
t4
[]
=
"
\"
fs
\\
_d
\\
%
\"
.dd"
;
len
=
strRmquote
(
t4
,
strlen
(
t4
));
printf
(
"t4:%s, len:%d
\n
"
,
t4
,
len
);
EXPECT_EQ
(
10
,
len
);
EXPECT_STRCASEEQ
(
t4
,
"fs
\\
_d
\\
%.dd"
);
char
t5
[]
=
"
\"
fs
\\
_d
\\
%
\"
"
;
len
=
strRmquote
(
t5
,
strlen
(
t5
));
printf
(
"t5:%s, len:%d
\n
"
,
t5
,
len
);
EXPECT_EQ
(
7
,
len
);
EXPECT_STRCASEEQ
(
t5
,
"fs
\\
_d
\\
%"
);
char
t6
[]
=
"'fs
\\
_d
\\
%'"
;
len
=
strRmquote
(
t6
,
strlen
(
t6
));
printf
(
"t6:%s, len:%d
\n
"
,
t6
,
len
);
EXPECT_EQ
(
7
,
len
);
EXPECT_STRCASEEQ
(
t6
,
"fs
\\
_d
\\
%"
);
}
TEST
(
testCase
,
string_dequote_test
)
{
char
t1
[]
=
"'abc'"
;
int32_t
len
=
strdequote
(
t1
);
...
...
tests/develop-test/0-management/3-tag/json_tag.py
浏览文件 @
dad4ceb6
...
...
@@ -75,6 +75,10 @@ class TDTestCase:
tdSql
.
error
(
"CREATE TABLE if not exists jsons1_14 using jsons1 tags('{
\"\t\"
:
\"
fff
\"
}')"
)
tdSql
.
error
(
"CREATE TABLE if not exists jsons1_14 using jsons1 tags('{
\"
试试
\"
:
\"
fff
\"
}')"
)
# test invalidate json value, value number can not be inf,nan TD-12166
tdSql
.
error
(
"CREATE TABLE if not exists jsons1_14 using jsons1 tags('{
\"
k
\"
:1.8e308}')"
)
tdSql
.
error
(
"CREATE TABLE if not exists jsons1_14 using jsons1 tags('{
\"
k
\"
:-1.8e308}')"
)
#test length limit
char1
=
''
.
join
([
'abcd'
]
*
64
)
char3
=
''
.
join
([
'abcd'
]
*
1022
)
...
...
tests/examples/JDBC/connectionPools/pom.xml
浏览文件 @
dad4ceb6
...
...
@@ -53,7 +53,7 @@
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-core
</artifactId>
<version>
2.1
5
.0
</version>
<version>
2.1
6
.0
</version>
</dependency>
<!-- proxool -->
<dependency>
...
...
tests/script/general/parser/select_with_tags.sim
浏览文件 @
dad4ceb6
...
...
@@ -961,9 +961,9 @@ sql create database test11943;
sql use test11943;
sql create stable st (ts timestamp , id int ) tags (ind int );
sql insert into sub1 using st tags(1) values(now ,1);
sql insert into sub1 using st tags(1) values(now ,2);
sql insert into sub2 using st tags(2) values(now ,3);
sql insert into sub2 using st tags(2) values(now ,4);
sql insert into sub1 using st tags(1) values(now
+1s
,2);
sql insert into sub2 using st tags(2) values(now
+2s
,3);
sql insert into sub2 using st tags(2) values(now
+3s
,4);
sql select tbname ,max(id)+5 from sub1;
if $data00 != @sub1@ then
return -1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录