Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
27f698c2
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
27f698c2
编写于
5月 14, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
https://github.com/taosdata/TDengine
into develop
上级
c4c75fea
36973a50
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
90 addition
and
70 deletion
+90
-70
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-34
src/tsdb/src/tsdbCache.c
src/tsdb/src/tsdbCache.c
+2
-2
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+26
-26
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+4
-4
tests/pytest/insert/multi.py
tests/pytest/insert/multi.py
+8
-2
tests/pytest/table/create.py
tests/pytest/table/create.py
+48
-0
tests/pytest/table/del_stable.py
tests/pytest/table/del_stable.py
+0
-2
未找到文件。
src/client/src/tscUtil.c
浏览文件 @
27f698c2
...
@@ -1842,6 +1842,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
...
@@ -1842,6 +1842,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
pNew
->
fp
=
fp
;
pNew
->
fp
=
fp
;
pNew
->
param
=
param
;
pNew
->
param
=
param
;
pNew
->
maxRetry
=
TSDB_MAX_REPLICA_NUM
;
char
*
name
=
pTableMetaInfo
->
name
;
char
*
name
=
pTableMetaInfo
->
name
;
STableMetaInfo
*
pFinalInfo
=
NULL
;
STableMetaInfo
*
pFinalInfo
=
NULL
;
...
@@ -2068,47 +2069,14 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2068,47 +2069,14 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
tscResetForNextRetrieve
(
pRes
);
tscResetForNextRetrieve
(
pRes
);
// in case of async query, set the callback function
// set the callback function
// void* fp1 = pSql->fp;
pSql
->
fp
=
fp
;
pSql
->
fp
=
fp
;
// if (fp1 != NULL) {
// assert(fp != NULL);
// }
int32_t
ret
=
tscProcessSql
(
pSql
);
int32_t
ret
=
tscProcessSql
(
pSql
);
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
return
;
return
;
}
else
{
// todo check for failure
}
else
{
// todo check for failure
}
}
// in case of async query, return now
// if (fp != NULL) {
// return;
// }
//
// if (ret != TSDB_CODE_SUCCESS) {
// pSql->res.code = ret;
// return;
// }
//
// // retrieve data
// assert(pCmd->command == TSDB_SQL_SELECT);
// pCmd->command = TSDB_SQL_FETCH;
//
// if ((ret = tscProcessSql(pSql)) != TSDB_CODE_SUCCESS) {
// pSql->res.code = ret;
// return;
// }
//
// // if the result from current virtual node are empty, try next if exists. otherwise, return the results.
// if (pRes->numOfRows > 0) {
// break;
// }
}
}
// if (pRes->numOfRows == 0) {
// tscTrace("%p all vnodes exhausted, prj query completed. total res:%d", pSql, totalVnode, pRes->numOfTotal);
// }
}
}
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
void
(
*
queryFp
)())
{
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
void
(
*
queryFp
)())
{
...
...
src/tsdb/src/tsdbCache.c
浏览文件 @
27f698c2
...
@@ -154,7 +154,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) {
...
@@ -154,7 +154,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) {
for
(
int
i
=
0
;
i
<
blocksToAdd
;
i
++
)
{
for
(
int
i
=
0
;
i
<
blocksToAdd
;
i
++
)
{
if
(
tsdbAddCacheBlockToPool
(
pCache
)
<
0
)
{
if
(
tsdbAddCacheBlockToPool
(
pCache
)
<
0
)
{
tsdbUnLockRepo
((
TsdbRepoT
*
)
pRepo
);
tsdbUnLockRepo
((
TsdbRepoT
*
)
pRepo
);
tsdbError
(
"tsdbId
%d:
failed to add cache block to cache pool"
,
pRepo
->
config
.
tsdbId
);
tsdbError
(
"tsdbId
:%d,
failed to add cache block to cache pool"
,
pRepo
->
config
.
tsdbId
);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -164,7 +164,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) {
...
@@ -164,7 +164,7 @@ int tsdbAlterCacheTotalBlocks(STsdbRepo *pRepo, int totalBlocks) {
}
}
tsdbUnLockRepo
((
TsdbRepoT
*
)
pRepo
);
tsdbUnLockRepo
((
TsdbRepoT
*
)
pRepo
);
tsdbTrace
(
"vgId:
%d
tsdb total cache blocks changed from %d to %d"
,
pRepo
->
config
.
tsdbId
,
oldNumOfBlocks
,
totalBlocks
);
tsdbTrace
(
"vgId:
%d,
tsdb total cache blocks changed from %d to %d"
,
pRepo
->
config
.
tsdbId
,
oldNumOfBlocks
,
totalBlocks
);
return
0
;
return
0
;
}
}
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
27f698c2
...
@@ -91,7 +91,7 @@ void tsdbFreeCfg(STsdbCfg *pCfg) {
...
@@ -91,7 +91,7 @@ void tsdbFreeCfg(STsdbCfg *pCfg) {
int32_t
tsdbCreateRepo
(
char
*
rootDir
,
STsdbCfg
*
pCfg
,
void
*
limiter
/* TODO */
)
{
int32_t
tsdbCreateRepo
(
char
*
rootDir
,
STsdbCfg
*
pCfg
,
void
*
limiter
/* TODO */
)
{
if
(
mkdir
(
rootDir
,
0755
)
!=
0
)
{
if
(
mkdir
(
rootDir
,
0755
)
!=
0
)
{
tsdbError
(
"
id %d: failed to create rootDir! rootDir %s, reason
%s"
,
pCfg
->
tsdbId
,
rootDir
,
strerror
(
errno
));
tsdbError
(
"
vgId:%d, failed to create rootDir! rootDir:%s, reason:
%s"
,
pCfg
->
tsdbId
,
rootDir
,
strerror
(
errno
));
if
(
errno
==
EACCES
)
{
if
(
errno
==
EACCES
)
{
return
TSDB_CODE_NO_DISK_PERMISSIONS
;
return
TSDB_CODE_NO_DISK_PERMISSIONS
;
}
else
if
(
errno
==
ENOSPC
)
{
}
else
if
(
errno
==
ENOSPC
)
{
...
@@ -150,7 +150,7 @@ int32_t tsdbDropRepo(TsdbRepoT *repo) {
...
@@ -150,7 +150,7 @@ int32_t tsdbDropRepo(TsdbRepoT *repo) {
free
(
pRepo
->
rootDir
);
free
(
pRepo
->
rootDir
);
free
(
pRepo
);
free
(
pRepo
);
tsdbTrace
(
"vgId:
%d
tsdb repository is dropped!"
,
id
);
tsdbTrace
(
"vgId:
%d,
tsdb repository is dropped!"
,
id
);
return
0
;
return
0
;
}
}
...
@@ -242,7 +242,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
...
@@ -242,7 +242,7 @@ TsdbRepoT *tsdbOpenRepo(char *tsdbDir, STsdbAppH *pAppH) {
pRepo
->
state
=
TSDB_REPO_STATE_ACTIVE
;
pRepo
->
state
=
TSDB_REPO_STATE_ACTIVE
;
tsdbTrace
(
"vgId:
%d
open tsdb repository successfully!"
,
pRepo
->
config
.
tsdbId
);
tsdbTrace
(
"vgId:
%d,
open tsdb repository successfully!"
,
pRepo
->
config
.
tsdbId
);
return
(
TsdbRepoT
*
)
pRepo
;
return
(
TsdbRepoT
*
)
pRepo
;
}
}
...
@@ -296,7 +296,7 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) {
...
@@ -296,7 +296,7 @@ int32_t tsdbCloseRepo(TsdbRepoT *repo) {
tfree
(
pRepo
->
rootDir
);
tfree
(
pRepo
->
rootDir
);
tfree
(
pRepo
);
tfree
(
pRepo
);
tsdbTrace
(
"vgId:
%d
repository is closed!"
,
id
);
tsdbTrace
(
"vgId:
%d,
repository is closed!"
,
id
);
return
0
;
return
0
;
}
}
...
@@ -358,7 +358,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) {
...
@@ -358,7 +358,7 @@ int32_t tsdbTriggerCommit(TsdbRepoT *repo) {
pthread_attr_init
(
&
thattr
);
pthread_attr_init
(
&
thattr
);
pthread_attr_setdetachstate
(
&
thattr
,
PTHREAD_CREATE_DETACHED
);
pthread_attr_setdetachstate
(
&
thattr
,
PTHREAD_CREATE_DETACHED
);
pthread_create
(
&
(
pRepo
->
commitThread
),
&
thattr
,
tsdbCommitData
,
(
void
*
)
repo
);
pthread_create
(
&
(
pRepo
->
commitThread
),
&
thattr
,
tsdbCommitData
,
(
void
*
)
repo
);
tsdbTrace
(
"vgId:
%d
start to commit!"
,
pRepo
->
config
.
tsdbId
);
tsdbTrace
(
"vgId:
%d,
start to commit!"
,
pRepo
->
config
.
tsdbId
);
return
0
;
return
0
;
}
}
...
@@ -611,7 +611,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -611,7 +611,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
pCfg
->
precision
=
TSDB_DEFAULT_PRECISION
;
pCfg
->
precision
=
TSDB_DEFAULT_PRECISION
;
}
else
{
}
else
{
if
(
!
IS_VALID_PRECISION
(
pCfg
->
precision
))
{
if
(
!
IS_VALID_PRECISION
(
pCfg
->
precision
))
{
tsdbError
(
"
id %d: invalid precision configuration! precision
%d"
,
pCfg
->
tsdbId
,
pCfg
->
precision
);
tsdbError
(
"
vgId:%d, invalid precision configuration! precision:
%d"
,
pCfg
->
tsdbId
,
pCfg
->
precision
);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -621,7 +621,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -621,7 +621,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
pCfg
->
compression
=
TSDB_DEFAULT_COMPRESSION
;
pCfg
->
compression
=
TSDB_DEFAULT_COMPRESSION
;
}
else
{
}
else
{
if
(
!
IS_VALID_COMPRESSION
(
pCfg
->
compression
))
{
if
(
!
IS_VALID_COMPRESSION
(
pCfg
->
compression
))
{
tsdbError
(
"
id %d: invalid compression configuration! compression
%d"
,
pCfg
->
tsdbId
,
pCfg
->
precision
);
tsdbError
(
"
vgId:%d: invalid compression configuration! compression:
%d"
,
pCfg
->
tsdbId
,
pCfg
->
precision
);
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -634,7 +634,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -634,7 +634,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
pCfg
->
maxTables
=
TSDB_DEFAULT_TABLES
;
pCfg
->
maxTables
=
TSDB_DEFAULT_TABLES
;
}
else
{
}
else
{
if
(
pCfg
->
maxTables
<
TSDB_MIN_TABLES
||
pCfg
->
maxTables
>
TSDB_MAX_TABLES
)
{
if
(
pCfg
->
maxTables
<
TSDB_MIN_TABLES
||
pCfg
->
maxTables
>
TSDB_MAX_TABLES
)
{
tsdbError
(
"
id %d: invalid maxTables configuration! maxTables %d TSDB_MIN_TABLES %d TSDB_MAX_TABLES
%d"
,
tsdbError
(
"
vgId:%d: invalid maxTables configuration! maxTables:%d TSDB_MIN_TABLES:%d TSDB_MAX_TABLES:
%d"
,
pCfg
->
tsdbId
,
pCfg
->
maxTables
,
TSDB_MIN_TABLES
,
TSDB_MAX_TABLES
);
pCfg
->
tsdbId
,
pCfg
->
maxTables
,
TSDB_MIN_TABLES
,
TSDB_MAX_TABLES
);
return
-
1
;
return
-
1
;
}
}
...
@@ -646,7 +646,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -646,7 +646,7 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
}
else
{
}
else
{
if
(
pCfg
->
daysPerFile
<
TSDB_MIN_DAYS_PER_FILE
||
pCfg
->
daysPerFile
>
TSDB_MAX_DAYS_PER_FILE
)
{
if
(
pCfg
->
daysPerFile
<
TSDB_MIN_DAYS_PER_FILE
||
pCfg
->
daysPerFile
>
TSDB_MAX_DAYS_PER_FILE
)
{
tsdbError
(
tsdbError
(
"
id %d: invalid daysPerFile configuration! daysPerFile %d TSDB_MIN_DAYS_PER_FILE %d TSDB_MAX_DAYS_PER_FILE
"
"
vgId:%d, invalid daysPerFile configuration! daysPerFile:%d TSDB_MIN_DAYS_PER_FILE:%d TSDB_MAX_DAYS_PER_FILE:
"
"%d"
,
"%d"
,
pCfg
->
tsdbId
,
pCfg
->
daysPerFile
,
TSDB_MIN_DAYS_PER_FILE
,
TSDB_MAX_DAYS_PER_FILE
);
pCfg
->
tsdbId
,
pCfg
->
daysPerFile
,
TSDB_MIN_DAYS_PER_FILE
,
TSDB_MAX_DAYS_PER_FILE
);
return
-
1
;
return
-
1
;
...
@@ -659,8 +659,8 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -659,8 +659,8 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
}
else
{
}
else
{
if
(
pCfg
->
minRowsPerFileBlock
<
TSDB_MIN_MIN_ROW_FBLOCK
||
pCfg
->
minRowsPerFileBlock
>
TSDB_MAX_MIN_ROW_FBLOCK
)
{
if
(
pCfg
->
minRowsPerFileBlock
<
TSDB_MIN_MIN_ROW_FBLOCK
||
pCfg
->
minRowsPerFileBlock
>
TSDB_MAX_MIN_ROW_FBLOCK
)
{
tsdbError
(
tsdbError
(
"
id %d: invalid minRowsPerFileBlock configuration! minRowsPerFileBlock %d TSDB_MIN_MIN_ROW_FBLOCK
%d "
"
vgId:%d, invalid minRowsPerFileBlock configuration! minRowsPerFileBlock:%d TSDB_MIN_MIN_ROW_FBLOCK:
%d "
"TSDB_MAX_MIN_ROW_FBLOCK
%d"
,
"TSDB_MAX_MIN_ROW_FBLOCK
:
%d"
,
pCfg
->
tsdbId
,
pCfg
->
minRowsPerFileBlock
,
TSDB_MIN_MIN_ROW_FBLOCK
,
TSDB_MAX_MIN_ROW_FBLOCK
);
pCfg
->
tsdbId
,
pCfg
->
minRowsPerFileBlock
,
TSDB_MIN_MIN_ROW_FBLOCK
,
TSDB_MAX_MIN_ROW_FBLOCK
);
return
-
1
;
return
-
1
;
}
}
...
@@ -671,8 +671,8 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -671,8 +671,8 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
}
else
{
}
else
{
if
(
pCfg
->
maxRowsPerFileBlock
<
TSDB_MIN_MAX_ROW_FBLOCK
||
pCfg
->
maxRowsPerFileBlock
>
TSDB_MAX_MAX_ROW_FBLOCK
)
{
if
(
pCfg
->
maxRowsPerFileBlock
<
TSDB_MIN_MAX_ROW_FBLOCK
||
pCfg
->
maxRowsPerFileBlock
>
TSDB_MAX_MAX_ROW_FBLOCK
)
{
tsdbError
(
tsdbError
(
"
id %d: invalid maxRowsPerFileBlock configuration! maxRowsPerFileBlock %d TSDB_MIN_MAX_ROW_FBLOCK
%d "
"
vgId:%d, invalid maxRowsPerFileBlock configuration! maxRowsPerFileBlock:%d TSDB_MIN_MAX_ROW_FBLOCK:
%d "
"TSDB_MAX_MAX_ROW_FBLOCK
%d"
,
"TSDB_MAX_MAX_ROW_FBLOCK
:
%d"
,
pCfg
->
tsdbId
,
pCfg
->
maxRowsPerFileBlock
,
TSDB_MIN_MIN_ROW_FBLOCK
,
TSDB_MAX_MIN_ROW_FBLOCK
);
pCfg
->
tsdbId
,
pCfg
->
maxRowsPerFileBlock
,
TSDB_MIN_MIN_ROW_FBLOCK
,
TSDB_MAX_MIN_ROW_FBLOCK
);
return
-
1
;
return
-
1
;
}
}
...
@@ -686,8 +686,8 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -686,8 +686,8 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
}
else
{
}
else
{
if
(
pCfg
->
keep
<
TSDB_MIN_KEEP
||
pCfg
->
keep
>
TSDB_MAX_KEEP
)
{
if
(
pCfg
->
keep
<
TSDB_MIN_KEEP
||
pCfg
->
keep
>
TSDB_MAX_KEEP
)
{
tsdbError
(
tsdbError
(
"
id %d: invalid keep configuration! keep %d TSDB_MIN_KEEP
%d "
"
vgId:%d, invalid keep configuration! keep:%d TSDB_MIN_KEEP:
%d "
"TSDB_MAX_KEEP
%d"
,
"TSDB_MAX_KEEP
:
%d"
,
pCfg
->
tsdbId
,
pCfg
->
keep
,
TSDB_MIN_KEEP
,
TSDB_MAX_KEEP
);
pCfg
->
tsdbId
,
pCfg
->
keep
,
TSDB_MIN_KEEP
,
TSDB_MAX_KEEP
);
return
-
1
;
return
-
1
;
}
}
...
@@ -754,13 +754,13 @@ static int32_t tsdbSetRepoEnv(STsdbRepo *pRepo) {
...
@@ -754,13 +754,13 @@ static int32_t tsdbSetRepoEnv(STsdbRepo *pRepo) {
if
(
tsdbGetDataDirName
(
pRepo
,
dirName
)
<
0
)
return
-
1
;
if
(
tsdbGetDataDirName
(
pRepo
,
dirName
)
<
0
)
return
-
1
;
if
(
mkdir
(
dirName
,
0755
)
<
0
)
{
if
(
mkdir
(
dirName
,
0755
)
<
0
)
{
tsdbError
(
"vgId:
%d failed to create repository directory! reason
%s"
,
pRepo
->
config
.
tsdbId
,
strerror
(
errno
));
tsdbError
(
"vgId:
%d, failed to create repository directory! reason:
%s"
,
pRepo
->
config
.
tsdbId
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
tsdbTrace
(
tsdbTrace
(
"vgId:
%d set up tsdb environment succeed! cacheBlockSize %d, totalBlocks %d, maxTables %d, daysPerFile %d, keep
"
"vgId:
%d, set up tsdb environment succeed! cacheBlockSize:%d, totalBlocks:%d, maxTables:%d, daysPerFile:%d, keep:
"
"%d, minRowsPerFileBlock
%d, maxRowsPerFileBlock %d, precision %d, compression
%d"
,
"%d, minRowsPerFileBlock
:%d, maxRowsPerFileBlock:%d, precision:%d, compression:
%d"
,
pRepo
->
config
.
tsdbId
,
pCfg
->
cacheBlockSize
,
pCfg
->
totalBlocks
,
pCfg
->
maxTables
,
pCfg
->
daysPerFile
,
pCfg
->
keep
,
pRepo
->
config
.
tsdbId
,
pCfg
->
cacheBlockSize
,
pCfg
->
totalBlocks
,
pCfg
->
maxTables
,
pCfg
->
daysPerFile
,
pCfg
->
keep
,
pCfg
->
minRowsPerFileBlock
,
pCfg
->
maxRowsPerFileBlock
,
pCfg
->
precision
,
pCfg
->
compression
);
pCfg
->
minRowsPerFileBlock
,
pCfg
->
maxRowsPerFileBlock
,
pCfg
->
precision
,
pCfg
->
compression
);
return
0
;
return
0
;
...
@@ -840,7 +840,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
...
@@ -840,7 +840,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
pTable
->
mem
->
numOfPoints
=
tSkipListGetSize
(
pTable
->
mem
->
pData
);
pTable
->
mem
->
numOfPoints
=
tSkipListGetSize
(
pTable
->
mem
->
pData
);
tsdbTrace
(
"vgId:
%d, tid: %d, uid: "
PRId64
"a row is inserted to table! key
"
PRId64
,
tsdbTrace
(
"vgId:
%d, tid:%d, uid:"
PRId64
", a row is inserted to table! key:
"
PRId64
,
pRepo
->
config
.
tsdbId
,
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
dataRowKey
(
row
));
pRepo
->
config
.
tsdbId
,
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
dataRowKey
(
row
));
return
0
;
return
0
;
...
@@ -852,7 +852,7 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
...
@@ -852,7 +852,7 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
STableId
tableId
=
{.
uid
=
pBlock
->
uid
,
.
tid
=
pBlock
->
tid
};
STableId
tableId
=
{.
uid
=
pBlock
->
uid
,
.
tid
=
pBlock
->
tid
};
STable
*
pTable
=
tsdbIsValidTableToInsert
(
pRepo
->
tsdbMeta
,
tableId
);
STable
*
pTable
=
tsdbIsValidTableToInsert
(
pRepo
->
tsdbMeta
,
tableId
);
if
(
pTable
==
NULL
)
{
if
(
pTable
==
NULL
)
{
tsdbError
(
"
id %d: failed to get table for insert, uid:%
"
PRIu64
", tid:%d"
,
pRepo
->
config
.
tsdbId
,
pBlock
->
uid
,
tsdbError
(
"
vgId:%d, failed to get table for insert, uid:
"
PRIu64
", tid:%d"
,
pRepo
->
config
.
tsdbId
,
pBlock
->
uid
,
pBlock
->
tid
);
pBlock
->
tid
);
return
TSDB_CODE_INVALID_TABLE_ID
;
return
TSDB_CODE_INVALID_TABLE_ID
;
}
}
...
@@ -866,9 +866,9 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
...
@@ -866,9 +866,9 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
tsdbInitSubmitBlkIter
(
pBlock
,
&
blkIter
);
tsdbInitSubmitBlkIter
(
pBlock
,
&
blkIter
);
while
((
row
=
tsdbGetSubmitBlkNext
(
&
blkIter
))
!=
NULL
)
{
while
((
row
=
tsdbGetSubmitBlkNext
(
&
blkIter
))
!=
NULL
)
{
if
(
dataRowKey
(
row
)
<
minKey
||
dataRowKey
(
row
)
>
maxKey
)
{
if
(
dataRowKey
(
row
)
<
minKey
||
dataRowKey
(
row
)
>
maxKey
)
{
tsdbError
(
tsdbError
(
"vgId:%d, table tid:%d, talbe uid:%ld timestamp is out of range. now:"
PRId64
", maxKey:"
PRId64
"tsdbId: %d, table tid: %d, talbe uid: %ld timestamp is out of range. now: %ld maxKey: %ld, minKey: %ld"
,
", minKey:"
PRId64
,
pRepo
->
config
.
tsdbId
,
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
now
,
minKey
,
maxKey
);
pRepo
->
config
.
tsdbId
,
pTable
->
tableId
.
tid
,
pTable
->
tableId
.
uid
,
now
,
minKey
,
maxKey
);
return
TSDB_CODE_TIMESTAMP_OUT_OF_RANGE
;
return
TSDB_CODE_TIMESTAMP_OUT_OF_RANGE
;
}
}
...
@@ -1109,7 +1109,7 @@ static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minK
...
@@ -1109,7 +1109,7 @@ static int tsdbHasDataToCommit(SSkipListIterator **iters, int nIters, TSKEY minK
static
void
tsdbAlterCompression
(
STsdbRepo
*
pRepo
,
int8_t
compression
)
{
static
void
tsdbAlterCompression
(
STsdbRepo
*
pRepo
,
int8_t
compression
)
{
int8_t
oldCompRession
=
pRepo
->
config
.
compression
;
int8_t
oldCompRession
=
pRepo
->
config
.
compression
;
pRepo
->
config
.
compression
=
compression
;
pRepo
->
config
.
compression
=
compression
;
tsdbTrace
(
"vgId:
%d
tsdb compression is changed from %d to %d"
,
oldCompRession
,
compression
);
tsdbTrace
(
"vgId:
%d,
tsdb compression is changed from %d to %d"
,
oldCompRession
,
compression
);
}
}
static
void
tsdbAlterKeep
(
STsdbRepo
*
pRepo
,
int32_t
keep
)
{
static
void
tsdbAlterKeep
(
STsdbRepo
*
pRepo
,
int32_t
keep
)
{
...
@@ -1126,13 +1126,13 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
...
@@ -1126,13 +1126,13 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
}
}
pRepo
->
tsdbFileH
->
maxFGroups
=
maxFiles
;
pRepo
->
tsdbFileH
->
maxFGroups
=
maxFiles
;
}
}
tsdbTrace
(
"vgId:
%d
keep is changed from %d to %d"
,
pRepo
->
config
.
tsdbId
,
oldKeep
,
keep
);
tsdbTrace
(
"vgId:
%d,
keep is changed from %d to %d"
,
pRepo
->
config
.
tsdbId
,
oldKeep
,
keep
);
}
}
static
void
tsdbAlterMaxTables
(
STsdbRepo
*
pRepo
,
int32_t
maxTables
)
{
static
void
tsdbAlterMaxTables
(
STsdbRepo
*
pRepo
,
int32_t
maxTables
)
{
// TODO
// TODO
int
oldMaxTables
=
pRepo
->
config
.
maxTables
;
int
oldMaxTables
=
pRepo
->
config
.
maxTables
;
tsdbTrace
(
"vgId:
%d
tsdb maxTables is changed from %d to %d!"
,
pRepo
->
config
.
tsdbId
,
oldMaxTables
,
maxTables
);
tsdbTrace
(
"vgId:
%d,
tsdb maxTables is changed from %d to %d!"
,
pRepo
->
config
.
tsdbId
,
oldMaxTables
,
maxTables
);
}
}
uint32_t
tsdbGetFileInfo
(
TsdbRepoT
*
repo
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
)
{
uint32_t
tsdbGetFileInfo
(
TsdbRepoT
*
repo
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
)
{
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
27f698c2
...
@@ -356,11 +356,11 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
...
@@ -356,11 +356,11 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
// Register to meta
// Register to meta
if
(
newSuper
)
{
if
(
newSuper
)
{
tsdbAddTableToMeta
(
pMeta
,
super
,
true
);
tsdbAddTableToMeta
(
pMeta
,
super
,
true
);
tsdbTrace
(
"vgId:
%d super table is created! uid
"
PRId64
,
pRepo
->
config
.
tsdbId
,
tsdbTrace
(
"vgId:
%d, super table is created! uid:
"
PRId64
,
pRepo
->
config
.
tsdbId
,
super
->
tableId
.
uid
);
super
->
tableId
.
uid
);
}
}
tsdbAddTableToMeta
(
pMeta
,
table
,
true
);
tsdbAddTableToMeta
(
pMeta
,
table
,
true
);
tsdbTrace
(
"vgId:
%d table is created! tid %d, uid
"
PRId64
,
pRepo
->
config
.
tsdbId
,
table
->
tableId
.
tid
,
tsdbTrace
(
"vgId:
%d, table is created! tid:%d, uid:
"
PRId64
,
pRepo
->
config
.
tsdbId
,
table
->
tableId
.
tid
,
table
->
tableId
.
uid
);
table
->
tableId
.
uid
);
// Write to meta file
// Write to meta file
...
@@ -404,12 +404,12 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
...
@@ -404,12 +404,12 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
STable
*
pTable
=
tsdbGetTableByUid
(
pMeta
,
tableId
.
uid
);
STable
*
pTable
=
tsdbGetTableByUid
(
pMeta
,
tableId
.
uid
);
if
(
pTable
==
NULL
)
{
if
(
pTable
==
NULL
)
{
tsdbError
(
"vgId
%d: failed to drop table since table not exists! tid %d, uid
"
PRId64
,
pRepo
->
config
.
tsdbId
,
tsdbError
(
"vgId
:%d, failed to drop table since table not exists! tid:%d, uid:
"
PRId64
,
pRepo
->
config
.
tsdbId
,
tableId
.
tid
,
tableId
.
uid
);
tableId
.
tid
,
tableId
.
uid
);
return
-
1
;
return
-
1
;
}
}
tsdbTrace
(
"vgId:
%d table is dropped! tid %d, uid
"
PRId64
,
pRepo
->
config
.
tsdbId
,
tableId
.
tid
,
tableId
.
uid
);
tsdbTrace
(
"vgId:
%d, table is dropped! tid:%d, uid:
"
PRId64
,
pRepo
->
config
.
tsdbId
,
tableId
.
tid
,
tableId
.
uid
);
if
(
tsdbRemoveTableFromMeta
(
pMeta
,
pTable
)
<
0
)
return
-
1
;
if
(
tsdbRemoveTableFromMeta
(
pMeta
,
pTable
)
<
0
)
return
-
1
;
return
0
;
return
0
;
...
...
tests/pytest/insert/multi.py
浏览文件 @
27f698c2
...
@@ -37,9 +37,15 @@ class TDTestCase:
...
@@ -37,9 +37,15 @@ class TDTestCase:
"CREATE TABLE if not exists dev_001 using st tags('dev_01')"
)
"CREATE TABLE if not exists dev_001 using st tags('dev_01')"
)
print
(
"==============step2"
)
print
(
"==============step2"
)
tdLog
.
info
(
"multiple inserts"
)
tdLog
.
info
(
"multiple inserts
by insert
"
)
tdSql
.
execute
(
tdSql
.
execute
(
"INSERT INTO dev_001 VALUES ('2020-05-13 10:00:00.000', 1),('2020-05-13 10:00:00.001', 1)"
)
"insert INTO dev_001 VALUES ('2020-05-13 10:00:00.000', 1),('2020-05-13 10:00:00.001', 1)"
)
tdSql
.
checkAffectedRows
(
2
)
print
(
"==============step3"
)
tdLog
.
info
(
"multiple inserts by import"
)
tdSql
.
execute
(
"import INTO dev_001 VALUES ('2020-05-13 10:00:00.000', 1),('2020-05-13 10:00:00.001', 1)"
)
tdSql
.
checkAffectedRows
(
2
)
tdSql
.
checkAffectedRows
(
2
)
def
stop
(
self
):
def
stop
(
self
):
...
...
tests/pytest/table/create.py
0 → 100644
浏览文件 @
27f698c2
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
taos
from
util.log
import
tdLog
from
util.cases
import
tdCases
from
util.sql
import
tdSql
class
TDTestCase
:
def
init
(
self
,
conn
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
def
run
(
self
):
tdSql
.
prepare
()
print
(
"==============step1"
)
print
(
"prepare data"
)
tdSql
.
execute
(
"create table db.st (ts timestamp, i int) tags(j int)"
)
tdSql
.
execute
(
"create table db.tb using st tags(1)"
)
tdSql
.
execute
(
"insert into db.tb values(now, 1)"
)
print
(
"==============step2"
)
print
(
"create table as select"
)
try
:
tdSql
.
execute
(
"create table db.test as select * from db.st"
)
except
Exception
as
e
:
tdLog
.
exit
(
e
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tests/pytest/table/del_stable.py
浏览文件 @
27f698c2
...
@@ -26,9 +26,7 @@ class TDTestCase:
...
@@ -26,9 +26,7 @@ class TDTestCase:
def
run
(
self
):
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
prepare
()
tdSql
.
execute
(
"drop database if exists db"
)
print
(
"==============step1"
)
print
(
"==============step1"
)
tdSql
.
execute
(
"create database db"
)
tdSql
.
execute
(
"create table db.st (ts timestamp, i int) tags(j int)"
)
tdSql
.
execute
(
"create table db.st (ts timestamp, i int) tags(j int)"
)
tdSql
.
execute
(
"create table db.tb using st tags(1)"
)
tdSql
.
execute
(
"create table db.tb using st tags(1)"
)
tdSql
.
execute
(
"insert into db.tb values(now, 1)"
)
tdSql
.
execute
(
"insert into db.tb values(now, 1)"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录