Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
42f95ccb
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
42f95ccb
编写于
10月 26, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/3.0' into fix/TD-19815
上级
ba0913e6
f3eb9c06
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
201 addition
and
111 deletion
+201
-111
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+1
-1
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+13
-7
source/libs/catalog/test/CMakeLists.txt
source/libs/catalog/test/CMakeLists.txt
+4
-4
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+68
-65
source/libs/scheduler/inc/schInt.h
source/libs/scheduler/inc/schInt.h
+2
-2
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+4
-2
source/libs/scheduler/src/schTask.c
source/libs/scheduler/src/schTask.c
+1
-0
source/util/src/thash.c
source/util/src/thash.c
+1
-1
source/util/test/arrayTest.cpp
source/util/test/arrayTest.cpp
+29
-29
tests/system-test/1-insert/tb_100w_data_order.py
tests/system-test/1-insert/tb_100w_data_order.py
+77
-0
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+1
-0
未找到文件。
source/libs/catalog/src/catalog.c
浏览文件 @
42f95ccb
...
...
@@ -570,7 +570,7 @@ int32_t catalogInit(SCatalogCfg* cfg) {
CTG_ERR_RET
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
atomic_store_8
((
int8_t
*
)
&
gCtgMgmt
.
exit
,
false
);
memset
(
&
gCtgMgmt
,
0
,
sizeof
(
gCtgMgmt
)
);
if
(
cfg
)
{
memcpy
(
&
gCtgMgmt
.
cfg
,
cfg
,
sizeof
(
*
cfg
));
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
42f95ccb
...
...
@@ -72,7 +72,10 @@ void ctgRUnlockVgInfo(SCtgDBCache *dbCache) { CTG_UNLOCK(CTG_READ, &dbCache->vgC
void
ctgWUnlockVgInfo
(
SCtgDBCache
*
dbCache
)
{
CTG_UNLOCK
(
CTG_WRITE
,
&
dbCache
->
vgCache
.
vgLock
);
}
void
ctgReleaseDBCache
(
SCatalog
*
pCtg
,
SCtgDBCache
*
dbCache
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
dbLock
);
}
void
ctgReleaseDBCache
(
SCatalog
*
pCtg
,
SCtgDBCache
*
dbCache
)
{
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
dbLock
);
taosHashRelease
(
pCtg
->
dbCache
,
dbCache
);
}
int32_t
ctgAcquireDBCacheImpl
(
SCatalog
*
pCtg
,
const
char
*
dbFName
,
SCtgDBCache
**
pCache
,
bool
acquire
)
{
char
*
p
=
strchr
(
dbFName
,
'.'
);
...
...
@@ -80,7 +83,14 @@ int32_t ctgAcquireDBCacheImpl(SCatalog *pCtg, const char *dbFName, SCtgDBCache *
dbFName
=
p
+
1
;
}
SCtgDBCache
*
dbCache
=
(
SCtgDBCache
*
)
taosHashGet
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
SCtgDBCache
*
dbCache
=
NULL
;
if
(
acquire
)
{
dbCache
=
(
SCtgDBCache
*
)
taosHashAcquire
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
}
else
{
dbCache
=
(
SCtgDBCache
*
)
taosHashGet
(
pCtg
->
dbCache
,
dbFName
,
strlen
(
dbFName
));
}
if
(
NULL
==
dbCache
)
{
*
pCache
=
NULL
;
ctgDebug
(
"db not in cache, dbFName:%s"
,
dbFName
);
...
...
@@ -1356,7 +1366,6 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
SCtgTbCache
*
pCache
=
taosHashGet
(
dbCache
->
tbCache
,
tbName
,
strlen
(
tbName
));
STableMeta
*
orig
=
(
pCache
?
pCache
->
pMeta
:
NULL
);
int8_t
origType
=
0
;
uint64_t
origSuid
=
0
;
if
(
orig
)
{
origType
=
orig
->
tableType
;
...
...
@@ -1375,8 +1384,6 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
CTG_CACHE_STAT_DEC
(
numOfStb
,
1
);
ctgDebug
(
"stb removed from stbCache, dbFName:%s, stb:%s, suid:0x%"
PRIx64
,
dbFName
,
tbName
,
orig
->
suid
);
}
origSuid
=
orig
->
suid
;
}
}
...
...
@@ -1408,8 +1415,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
return
TSDB_CODE_SUCCESS
;
}
if
(
origSuid
!=
meta
->
suid
&&
taosHashPut
(
dbCache
->
stbCache
,
&
meta
->
suid
,
sizeof
(
meta
->
suid
),
tbName
,
strlen
(
tbName
)
+
1
)
!=
0
)
{
if
(
taosHashPut
(
dbCache
->
stbCache
,
&
meta
->
suid
,
sizeof
(
meta
->
suid
),
tbName
,
strlen
(
tbName
)
+
1
)
!=
0
)
{
ctgError
(
"taosHashPut to stable cache failed, suid:0x%"
PRIx64
,
meta
->
suid
);
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
...
...
source/libs/catalog/test/CMakeLists.txt
浏览文件 @
42f95ccb
...
...
@@ -18,8 +18,8 @@ IF(NOT TD_DARWIN)
PRIVATE
"
${
TD_SOURCE_DIR
}
/source/libs/catalog/inc"
)
#
add_test(
#
NAME catalogTest
#
COMMAND catalogTest
#
)
#add_test(
# NAME catalogTest
# COMMAND catalogTest
#)
ENDIF
()
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
42f95ccb
...
...
@@ -143,6 +143,7 @@ void ctgTestInitLogFile() {
ctgdEnableDebug
(
"api"
);
ctgdEnableDebug
(
"meta"
);
ctgdEnableDebug
(
"cache"
);
ctgdEnableDebug
(
"lock"
);
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
...
...
@@ -255,8 +256,8 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) {
rspMsg
->
tableType
=
TSDB_SUPER_TABLE
;
rspMsg
->
sversion
=
ctgTestSVersion
+
1
;
rspMsg
->
tversion
=
ctgTestTVersion
+
1
;
rspMsg
->
suid
=
ctgTestSuid
+
1
;
rspMsg
->
tuid
=
ctgTestSuid
+
1
;
rspMsg
->
suid
=
ctgTestSuid
;
rspMsg
->
tuid
=
ctgTestSuid
;
rspMsg
->
vgId
=
1
;
rspMsg
->
pSchemas
=
(
SSchema
*
)
taosMemoryCalloc
(
rspMsg
->
numOfTags
+
rspMsg
->
numOfColumns
,
sizeof
(
SSchema
));
...
...
@@ -424,7 +425,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg
metaRsp
.
sversion
=
ctgTestSVersion
;
metaRsp
.
tversion
=
ctgTestTVersion
;
metaRsp
.
suid
=
ctgTestSuid
;
metaRsp
.
tuid
=
ctgTestSuid
+
+
;
metaRsp
.
tuid
=
ctgTestSuid
+
1
;
metaRsp
.
vgId
=
0
;
metaRsp
.
pSchemas
=
(
SSchema
*
)
taosMemoryMalloc
((
metaRsp
.
numOfTags
+
metaRsp
.
numOfColumns
)
*
sizeof
(
SSchema
));
...
...
@@ -785,13 +786,15 @@ void ctgTestSetRspDbVgroupsAndMultiSuperMeta() {
void
*
ctgTestGetDbVgroupThread
(
void
*
param
)
{
struct
SCatalog
*
pCtg
=
(
struct
SCatalog
*
)
param
;
int32_t
code
=
0
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SArray
*
vgList
=
NULL
;
int32_t
n
=
0
;
while
(
!
ctgTestStop
)
{
code
=
catalogGetDBVgList
(
pCtg
,
mockPointer
,
ctgTestDbname
,
&
vgList
);
if
(
code
)
{
printf
(
"code:%x
\n
"
,
code
);
assert
(
0
);
}
...
...
@@ -875,7 +878,7 @@ void *ctgTestGetCtableMetaThread(void *param) {
while
(
!
ctgTestStop
)
{
code
=
ctgReadTbMetaFromCache
(
pCtg
,
&
ctx
,
&
tbMeta
);
if
(
code
||
!
inCache
)
{
if
(
code
||
NULL
==
tbMeta
)
{
assert
(
0
);
}
...
...
@@ -929,12 +932,12 @@ void *ctgTestSetCtableMetaThread(void *param) {
return
NULL
;
}
#if 1
TEST
(
tableMeta
,
normalTable
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SVgroupInfo
vgInfo
=
{
0
};
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
ctgTestInitLogFile
();
...
...
@@ -1040,7 +1043,8 @@ TEST(tableMeta, normalTable) {
TEST
(
tableMeta
,
childTableCase
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
ctgTestInitLogFile
();
...
...
@@ -1148,7 +1152,8 @@ TEST(tableMeta, childTableCase) {
TEST
(
tableMeta
,
superTableCase
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
ctgTestSetRspDbVgroupsAndSuperMeta
();
...
...
@@ -1173,8 +1178,8 @@ TEST(tableMeta, superTableCase) {
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
...
...
@@ -1269,7 +1274,8 @@ TEST(tableMeta, superTableCase) {
TEST
(
tableMeta
,
rmStbMeta
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
ctgTestInitLogFile
();
...
...
@@ -1296,8 +1302,8 @@ TEST(tableMeta, rmStbMeta) {
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
...
...
@@ -1312,7 +1318,7 @@ TEST(tableMeta, rmStbMeta) {
}
}
code
=
catalogRemoveStbMeta
(
pCtg
,
"1.db1"
,
ctgTestDbId
,
ctgTestSTablename
,
ctgTestSuid
-
1
);
code
=
catalogRemoveStbMeta
(
pCtg
,
"1.db1"
,
ctgTestDbId
,
ctgTestSTablename
,
ctgTestSuid
);
ASSERT_EQ
(
code
,
0
);
while
(
true
)
{
...
...
@@ -1337,7 +1343,8 @@ TEST(tableMeta, rmStbMeta) {
TEST
(
tableMeta
,
updateStbMeta
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
ctgTestInitLogFile
();
...
...
@@ -1364,8 +1371,8 @@ TEST(tableMeta, updateStbMeta) {
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
...
...
@@ -1411,8 +1418,8 @@ TEST(tableMeta, updateStbMeta) {
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
+
1
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
+
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
+
1
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
+
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
+
1
);
...
...
@@ -1453,7 +1460,8 @@ TEST(getIndexInfo, notExists) {
TEST
(
refreshGetMeta
,
normal2normal
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SArray
*
vgList
=
NULL
;
...
...
@@ -1532,7 +1540,8 @@ TEST(refreshGetMeta, normal2normal) {
TEST
(
refreshGetMeta
,
normal2notexist
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SArray
*
vgList
=
NULL
;
...
...
@@ -1602,7 +1611,8 @@ TEST(refreshGetMeta, normal2notexist) {
TEST
(
refreshGetMeta
,
normal2child
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SArray
*
vgList
=
NULL
;
...
...
@@ -1683,9 +1693,11 @@ TEST(refreshGetMeta, normal2child) {
ctgTestCurrentSTableName
=
NULL
;
}
TEST
(
refreshGetMeta
,
stable2child
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SArray
*
vgList
=
NULL
;
...
...
@@ -1738,8 +1750,8 @@ TEST(refreshGetMeta, stable2child) {
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
...
...
@@ -1771,7 +1783,8 @@ TEST(refreshGetMeta, stable2child) {
TEST
(
refreshGetMeta
,
stable2stable
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SArray
*
vgList
=
NULL
;
...
...
@@ -1823,8 +1836,8 @@ TEST(refreshGetMeta, stable2stable) {
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
...
...
@@ -1841,8 +1854,8 @@ TEST(refreshGetMeta, stable2stable) {
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
...
...
@@ -1857,7 +1870,8 @@ TEST(refreshGetMeta, stable2stable) {
TEST
(
refreshGetMeta
,
child2stable
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SArray
*
vgList
=
NULL
;
...
...
@@ -1927,8 +1941,8 @@ TEST(refreshGetMeta, child2stable) {
ASSERT_EQ
(
tableMeta
->
tableType
,
TSDB_SUPER_TABLE
);
ASSERT_EQ
(
tableMeta
->
sversion
,
ctgTestSVersion
);
ASSERT_EQ
(
tableMeta
->
tversion
,
ctgTestTVersion
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
-
1
);
ASSERT_EQ
(
tableMeta
->
uid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
suid
,
ctgTestSuid
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfColumns
,
ctgTestColNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
numOfTags
,
ctgTestTagNum
);
ASSERT_EQ
(
tableMeta
->
tableInfo
.
precision
,
1
);
...
...
@@ -1943,7 +1957,8 @@ TEST(refreshGetMeta, child2stable) {
TEST
(
tableDistVgroup
,
normalTable
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
*
vgInfo
=
NULL
;
SArray
*
vgList
=
NULL
;
...
...
@@ -1972,11 +1987,7 @@ TEST(tableDistVgroup, normalTable) {
strcpy
(
n
.
tname
,
ctgTestTablename
);
code
=
catalogGetTableDistVgInfo
(
pCtg
,
mockPointer
,
&
n
,
&
vgList
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
taosArrayGetSize
((
const
SArray
*
)
vgList
),
1
);
vgInfo
=
(
SVgroupInfo
*
)
taosArrayGet
(
vgList
,
0
);
ASSERT_EQ
(
vgInfo
->
vgId
,
8
);
ASSERT_EQ
(
vgInfo
->
epSet
.
numOfEps
,
3
);
ASSERT_TRUE
(
code
!=
0
);
catalogDestroy
();
memset
(
&
gCtgMgmt
,
0
,
sizeof
(
gCtgMgmt
));
...
...
@@ -1984,7 +1995,8 @@ TEST(tableDistVgroup, normalTable) {
TEST
(
tableDistVgroup
,
childTableCase
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
*
vgInfo
=
NULL
;
SArray
*
vgList
=
NULL
;
...
...
@@ -2014,11 +2026,7 @@ TEST(tableDistVgroup, childTableCase) {
strcpy
(
n
.
tname
,
ctgTestCTablename
);
code
=
catalogGetTableDistVgInfo
(
pCtg
,
mockPointer
,
&
n
,
&
vgList
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
taosArrayGetSize
((
const
SArray
*
)
vgList
),
1
);
vgInfo
=
(
SVgroupInfo
*
)
taosArrayGet
(
vgList
,
0
);
ASSERT_EQ
(
vgInfo
->
vgId
,
9
);
ASSERT_EQ
(
vgInfo
->
epSet
.
numOfEps
,
4
);
ASSERT_TRUE
(
code
!=
0
);
catalogDestroy
();
memset
(
&
gCtgMgmt
,
0
,
sizeof
(
gCtgMgmt
));
...
...
@@ -2026,7 +2034,8 @@ TEST(tableDistVgroup, childTableCase) {
TEST
(
tableDistVgroup
,
superTableCase
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
*
vgInfo
=
NULL
;
SArray
*
vgList
=
NULL
;
...
...
@@ -2073,7 +2082,8 @@ TEST(tableDistVgroup, superTableCase) {
TEST
(
dbVgroup
,
getSetDbVgroupCase
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
*
pvgInfo
=
NULL
;
SDBVgInfo
*
dbVgroup
=
NULL
;
...
...
@@ -2121,12 +2131,7 @@ TEST(dbVgroup, getSetDbVgroupCase) {
ASSERT_EQ
(
vgInfo
.
epSet
.
numOfEps
,
3
);
code
=
catalogGetTableDistVgInfo
(
pCtg
,
mockPointer
,
&
n
,
&
vgList
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
taosArrayGetSize
((
const
SArray
*
)
vgList
),
1
);
pvgInfo
=
(
SVgroupInfo
*
)
taosArrayGet
(
vgList
,
0
);
ASSERT_EQ
(
pvgInfo
->
vgId
,
8
);
ASSERT_EQ
(
pvgInfo
->
epSet
.
numOfEps
,
3
);
taosArrayDestroy
(
vgList
);
ASSERT_TRUE
(
code
!=
0
);
ctgTestBuildDBVgroup
(
&
dbVgroup
);
code
=
catalogUpdateDBVgInfo
(
pCtg
,
ctgTestDbname
,
ctgTestDbId
,
dbVgroup
);
...
...
@@ -2148,12 +2153,7 @@ TEST(dbVgroup, getSetDbVgroupCase) {
ASSERT_EQ
(
vgInfo
.
epSet
.
numOfEps
,
2
);
code
=
catalogGetTableDistVgInfo
(
pCtg
,
mockPointer
,
&
n
,
&
vgList
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
taosArrayGetSize
((
const
SArray
*
)
vgList
),
1
);
pvgInfo
=
(
SVgroupInfo
*
)
taosArrayGet
(
vgList
,
0
);
ASSERT_EQ
(
pvgInfo
->
vgId
,
8
);
ASSERT_EQ
(
pvgInfo
->
epSet
.
numOfEps
,
3
);
taosArrayDestroy
(
vgList
);
ASSERT_TRUE
(
code
!=
0
);
catalogDestroy
();
memset
(
&
gCtgMgmt
,
0
,
sizeof
(
gCtgMgmt
));
...
...
@@ -2161,7 +2161,8 @@ TEST(dbVgroup, getSetDbVgroupCase) {
TEST
(
multiThread
,
getSetRmSameDbVgroup
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
*
pvgInfo
=
NULL
;
SDBVgInfo
dbVgroup
=
{
0
};
...
...
@@ -2213,7 +2214,8 @@ TEST(multiThread, getSetRmSameDbVgroup) {
TEST
(
multiThread
,
getSetRmDiffDbVgroup
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
*
pvgInfo
=
NULL
;
SDBVgInfo
dbVgroup
=
{
0
};
...
...
@@ -2265,7 +2267,8 @@ TEST(multiThread, getSetRmDiffDbVgroup) {
TEST
(
multiThread
,
ctableMeta
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
*
pvgInfo
=
NULL
;
SDBVgInfo
dbVgroup
=
{
0
};
...
...
@@ -2316,7 +2319,8 @@ TEST(multiThread, ctableMeta) {
TEST
(
rentTest
,
allRent
)
{
struct
SCatalog
*
pCtg
=
NULL
;
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
0x1
;
SRequestConnInfo
connInfo
=
{
0
};
SRequestConnInfo
*
mockPointer
=
(
SRequestConnInfo
*
)
&
connInfo
;
SVgroupInfo
vgInfo
=
{
0
};
SVgroupInfo
*
pvgInfo
=
NULL
;
SDBVgInfo
dbVgroup
=
{
0
};
...
...
@@ -2391,7 +2395,6 @@ TEST(rentTest, allRent) {
memset
(
&
gCtgMgmt
,
0
,
sizeof
(
gCtgMgmt
));
}
#endif
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
...
...
source/libs/scheduler/inc/schInt.h
浏览文件 @
42f95ccb
...
...
@@ -57,8 +57,8 @@ typedef enum {
#define SCHEDULE_DEFAULT_POLICY SCH_LOAD_SEQ
#define SCHEDULE_DEFAULT_MAX_NODE_NUM 20
#define SCH_DEFAULT_TASK_TIMEOUT_USEC
1
0000000
#define SCH_MAX_TASK_TIMEOUT_USEC
6
0000000
#define SCH_DEFAULT_TASK_TIMEOUT_USEC
6
0000000
#define SCH_MAX_TASK_TIMEOUT_USEC
30
0000000
#define SCH_DEFAULT_MAX_RETRY_NUM 6
#define SCH_MIN_AYSNC_EXEC_NUM 3
...
...
source/libs/scheduler/src/schRemote.c
浏览文件 @
42f95ccb
...
...
@@ -145,8 +145,10 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
int32_t
msgType
=
pMsg
->
msgType
;
bool
dropExecNode
=
(
msgType
==
TDMT_SCH_LINK_BROKEN
||
SCH_NETWORK_ERR
(
rspCode
));
SCH_ERR_JRET
(
schUpdateTaskHandle
(
pJob
,
pTask
,
dropExecNode
,
pMsg
->
handle
,
execId
));
if
(
SCH_IS_QUERY_JOB
(
pJob
))
{
SCH_ERR_JRET
(
schUpdateTaskHandle
(
pJob
,
pTask
,
dropExecNode
,
pMsg
->
handle
,
execId
));
}
SCH_ERR_JRET
(
schValidateRspMsgType
(
pJob
,
pTask
,
msgType
));
int32_t
reqType
=
IsReq
(
pMsg
)
?
pMsg
->
msgType
:
(
pMsg
->
msgType
-
1
);
...
...
source/libs/scheduler/src/schTask.c
浏览文件 @
42f95ccb
...
...
@@ -127,6 +127,7 @@ int32_t schDropTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_
if
(
taosHashRemove
(
pTask
->
execNodes
,
&
execId
,
sizeof
(
execId
)))
{
SCH_TASK_DLOG
(
"execId %d already not in execNodeList"
,
execId
);
SCH_ERR_RET
(
TSDB_CODE_SCH_IGNORE_ERROR
);
}
else
{
SCH_TASK_DLOG
(
"execId %d removed from execNodeList"
,
execId
);
}
...
...
source/util/src/thash.c
浏览文件 @
42f95ccb
...
...
@@ -798,7 +798,7 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) {
}
void
*
taosHashIterate
(
SHashObj
*
pHashObj
,
void
*
p
)
{
if
(
pHashObj
==
NULL
)
return
NULL
;
if
(
pHashObj
==
NULL
||
pHashObj
->
size
==
0
)
return
NULL
;
int
slot
=
0
;
char
*
data
=
NULL
;
...
...
source/util/test/arrayTest.cpp
浏览文件 @
42f95ccb
...
...
@@ -5,52 +5,52 @@
#include "tarray.h"
#include "tcompare.h"
/*
namespace {
static void remove_batch_test() {
SArray
*
pa
=
(
SArray
*
)
taosArrayInit
(
4
,
sizeof
(
int32_t
));
SArray* pa = (SArray*)taosArrayInit(4, sizeof(int32_t));
for
(
int32_t
i
=
0
;
i
<
20
;
++
i
)
{
int32_t
a
=
i
;
taosArrayPush
(
pa
,
&
a
);
}
for (int32_t i = 0; i < 20; ++i) {
int32_t a = i;
taosArrayPush(pa, &a);
}
SArray
*
delList
=
(
SArray
*
)
taosArrayInit
(
4
,
sizeof
(
int32_t
));
taosArrayRemoveBatch
(
pa
,
(
const
int32_t
*
)
TARRAY_GET_START
(
delList
),
taosArrayGetSize
(
delList
));
EXPECT_EQ
(
taosArrayGetSize
(
pa
),
20
);
SArray* delList = (SArray*)taosArrayInit(4, sizeof(int32_t));
taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList));
EXPECT_EQ(taosArrayGetSize(pa), 20);
int32_t
a
=
5
;
taosArrayPush
(
delList
,
&
a
);
int32_t a = 5;
taosArrayPush(delList, &a);
taosArrayRemoveBatch
(
pa
,
(
const
int32_t
*
)
TARRAY_GET_START
(
delList
),
taosArrayGetSize
(
delList
));
EXPECT_EQ
(
taosArrayGetSize
(
pa
),
19
);
EXPECT_EQ
(
*
(
int
*
)
taosArrayGet
(
pa
,
5
),
6
);
taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList));
EXPECT_EQ(taosArrayGetSize(pa), 19);
EXPECT_EQ(*(int*)taosArrayGet(pa, 5), 6);
taosArrayInsert
(
pa
,
5
,
&
a
);
EXPECT_EQ
(
taosArrayGetSize
(
pa
),
20
);
EXPECT_EQ
(
*
(
int
*
)
taosArrayGet
(
pa
,
5
),
5
);
taosArrayInsert(pa, 5, &a);
EXPECT_EQ(taosArrayGetSize(pa), 20);
EXPECT_EQ(*(int*)taosArrayGet(pa, 5), 5);
taosArrayClear
(
delList
);
taosArrayClear(delList);
a
=
6
;
taosArrayPush
(
delList
,
&
a
);
a = 6;
taosArrayPush(delList, &a);
a
=
9
;
taosArrayPush
(
delList
,
&
a
);
a = 9;
taosArrayPush(delList, &a);
a
=
14
;
taosArrayPush
(
delList
,
&
a
);
taosArrayRemoveBatch
(
pa
,
(
const
int32_t
*
)
TARRAY_GET_START
(
delList
),
taosArrayGetSize
(
delList
));
EXPECT_EQ
(
taosArrayGetSize
(
pa
),
17
);
a = 14;
taosArrayPush(delList, &a);
taosArrayRemoveBatch(pa, (const int32_t*)TARRAY_GET_START(delList), taosArrayGetSize(delList));
EXPECT_EQ(taosArrayGetSize(pa), 17);
taosArrayDestroy
(
pa
);
taosArrayDestroy
(
delList
);
taosArrayDestroy(pa);
taosArrayDestroy(delList);
}
} // namespace
TEST(arrayTest, array_list_test) { remove_batch_test(); }
*/
TEST
(
arrayTest
,
array_search_test
)
{
SArray
*
pa
=
(
SArray
*
)
taosArrayInit
(
4
,
sizeof
(
int32_t
));
...
...
tests/system-test/1-insert/tb_100w_data_order.py
0 → 100644
浏览文件 @
42f95ccb
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.common
import
*
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
ts
=
1537146000000
self
.
binary_str
=
'taosdata'
self
.
nchar_str
=
'涛思数据'
def
set_create_normaltable_sql
(
self
,
ntbname
,
column_dict
):
column_sql
=
''
for
k
,
v
in
column_dict
.
items
():
column_sql
+=
f
"
{
k
}
{
v
}
,"
create_ntb_sql
=
f
'create table
{
ntbname
}
(ts timestamp,
{
column_sql
[:
-
1
]
}
)'
return
create_ntb_sql
def
set_create_stable_sql
(
self
,
stbname
,
column_dict
,
tag_dict
):
column_sql
=
''
tag_sql
=
''
for
k
,
v
in
column_dict
.
items
():
column_sql
+=
f
"
{
k
}
{
v
}
,"
for
k
,
v
in
tag_dict
.
items
():
tag_sql
+=
f
"
{
k
}
{
v
}
,"
create_stb_sql
=
f
'create table
{
stbname
}
(ts timestamp,
{
column_sql
[:
-
1
]
}
) tags(
{
tag_sql
[:
-
1
]
}
)'
return
create_stb_sql
def
gen_batch_sql
(
self
,
ntbname
,
batch
=
10
):
values_str
=
""
for
i
in
range
(
batch
):
values_str
+=
f
'(
{
self
.
ts
}
, 1, 1, 1,
{
i
+
1
}
, 1, 1, 1,
{
i
+
1
}
,
{
i
+
0.1
}
,
{
i
+
0.1
}
,
{
i
%
2
}
,
{
i
+
1
}
,
{
i
+
1
}
),'
self
.
ts
+=
1
return
f
'insert into
{
ntbname
}
values
{
values_str
[:
-
1
]
}
;'
def
query_ntb_order_by_col
(
self
,
batch_num
,
rows_count
):
tdSql
.
prepare
()
ntbname
=
f
'db.
{
tdCom
.
getLongName
(
5
,
"letters"
)
}
'
column_dict
=
{
'col1'
:
'tinyint'
,
'col2'
:
'smallint'
,
'col3'
:
'int'
,
'col4'
:
'bigint'
,
'col5'
:
'tinyint unsigned'
,
'col6'
:
'smallint unsigned'
,
'col7'
:
'int unsigned'
,
'col8'
:
'bigint unsigned'
,
'col9'
:
'float'
,
'col10'
:
'double'
,
'col11'
:
'bool'
,
'col12'
:
'binary(20)'
,
'col13'
:
'nchar(20)'
}
range_times
=
int
(
rows_count
/
batch_num
)
create_ntb_sql
=
self
.
set_create_normaltable_sql
(
ntbname
,
column_dict
)
tdSql
.
execute
(
create_ntb_sql
)
for
i
in
range
(
range_times
):
tdSql
.
execute
(
self
.
gen_batch_sql
(
ntbname
,
batch_num
))
tdSql
.
query
(
f
'select count(*) from
{
ntbname
}
'
)
tdSql
.
checkEqual
(
tdSql
.
queryResult
[
0
][
0
],
rows_count
)
tdSql
.
query
(
f
'select * from
{
ntbname
}
order by col1'
)
tdSql
.
execute
(
f
'flush database db'
)
def
run
(
self
):
self
.
query_ntb_order_by_col
(
batch_num
=
1000
,
rows_count
=
1000000
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/system-test/fulltest.sh
浏览文件 @
42f95ccb
...
...
@@ -207,6 +207,7 @@ python3 ./test.py -f 2-query/varchar.py -R
python3 ./test.py
-f
1-insert/update_data.py
python3 ./test.py
-f
1-insert/tb_100w_data_order.py
python3 ./test.py
-f
1-insert/delete_data.py
python3 ./test.py
-f
1-insert/keep_expired.py
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录