Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
1c0cb588
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看板
提交
1c0cb588
编写于
5月 18, 2020
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change uid from int64_t to uint64_t in tsdb
上级
4ff1ca4b
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
35 addition
and
34 deletion
+35
-34
src/inc/tsdb.h
src/inc/tsdb.h
+6
-6
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+12
-12
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+3
-3
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+3
-3
src/tsdb/src/tsdbMetaFile.c
src/tsdb/src/tsdbMetaFile.c
+6
-6
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+4
-3
src/tsdb/tests/tsdbTests.cpp
src/tsdb/tests/tsdbTests.cpp
+1
-1
未找到文件。
src/inc/tsdb.h
浏览文件 @
1c0cb588
...
@@ -77,7 +77,7 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg);
...
@@ -77,7 +77,7 @@ int32_t tsdbConfigRepo(TsdbRepoT *repo, STsdbCfg *pCfg);
// --------- TSDB TABLE DEFINITION
// --------- TSDB TABLE DEFINITION
typedef
struct
{
typedef
struct
{
int64_t
uid
;
// the unique table ID
u
int64_t
uid
;
// the unique table ID
int32_t
tid
;
// the table ID in the repository.
int32_t
tid
;
// the table ID in the repository.
}
STableId
;
}
STableId
;
...
@@ -88,14 +88,14 @@ typedef struct {
...
@@ -88,14 +88,14 @@ typedef struct {
STableId
tableId
;
STableId
tableId
;
int32_t
sversion
;
int32_t
sversion
;
char
*
sname
;
// super table name
char
*
sname
;
// super table name
int64_t
superUid
;
uint64_t
superUid
;
STSchema
*
schema
;
STSchema
*
schema
;
STSchema
*
tagSchema
;
STSchema
*
tagSchema
;
SDataRow
tagValues
;
SDataRow
tagValues
;
}
STableCfg
;
}
STableCfg
;
int
tsdbInitTableCfg
(
STableCfg
*
config
,
ETableType
type
,
int64_t
uid
,
int32_t
tid
);
int
tsdbInitTableCfg
(
STableCfg
*
config
,
ETableType
type
,
u
int64_t
uid
,
int32_t
tid
);
int
tsdbTableSetSuperUid
(
STableCfg
*
config
,
int64_t
uid
);
int
tsdbTableSetSuperUid
(
STableCfg
*
config
,
u
int64_t
uid
);
int
tsdbTableSetSchema
(
STableCfg
*
config
,
STSchema
*
pSchema
,
bool
dup
);
int
tsdbTableSetSchema
(
STableCfg
*
config
,
STSchema
*
pSchema
,
bool
dup
);
int
tsdbTableSetTagSchema
(
STableCfg
*
config
,
STSchema
*
pSchema
,
bool
dup
);
int
tsdbTableSetTagSchema
(
STableCfg
*
config
,
STSchema
*
pSchema
,
bool
dup
);
int
tsdbTableSetTagValue
(
STableCfg
*
config
,
SDataRow
row
,
bool
dup
);
int
tsdbTableSetTagValue
(
STableCfg
*
config
,
SDataRow
row
,
bool
dup
);
...
@@ -109,7 +109,7 @@ char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes);
...
@@ -109,7 +109,7 @@ char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes);
int
tsdbCreateTable
(
TsdbRepoT
*
repo
,
STableCfg
*
pCfg
);
int
tsdbCreateTable
(
TsdbRepoT
*
repo
,
STableCfg
*
pCfg
);
int
tsdbDropTable
(
TsdbRepoT
*
pRepo
,
STableId
tableId
);
int
tsdbDropTable
(
TsdbRepoT
*
pRepo
,
STableId
tableId
);
int
tsdbAlterTable
(
TsdbRepoT
*
repo
,
STableCfg
*
pCfg
);
int
tsdbAlterTable
(
TsdbRepoT
*
repo
,
STableCfg
*
pCfg
);
TSKEY
tsdbGetTableLastKey
(
TsdbRepoT
*
repo
,
int64_t
uid
);
TSKEY
tsdbGetTableLastKey
(
TsdbRepoT
*
repo
,
u
int64_t
uid
);
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/inc/tsdbMain.h
浏览文件 @
1c0cb588
...
@@ -63,9 +63,9 @@ typedef struct {
...
@@ -63,9 +63,9 @@ typedef struct {
}
SMetaFile
;
}
SMetaFile
;
SMetaFile
*
tsdbInitMetaFile
(
char
*
rootDir
,
int32_t
maxTables
,
iterFunc
iFunc
,
afterFunc
aFunc
,
void
*
appH
);
SMetaFile
*
tsdbInitMetaFile
(
char
*
rootDir
,
int32_t
maxTables
,
iterFunc
iFunc
,
afterFunc
aFunc
,
void
*
appH
);
int32_t
tsdbInsertMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
,
void
*
cont
,
int32_t
contLen
);
int32_t
tsdbInsertMetaRecord
(
SMetaFile
*
mfh
,
u
int64_t
uid
,
void
*
cont
,
int32_t
contLen
);
int32_t
tsdbDeleteMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
);
int32_t
tsdbDeleteMetaRecord
(
SMetaFile
*
mfh
,
u
int64_t
uid
);
int32_t
tsdbUpdateMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
,
void
*
cont
,
int32_t
contLen
);
int32_t
tsdbUpdateMetaRecord
(
SMetaFile
*
mfh
,
u
int64_t
uid
,
void
*
cont
,
int32_t
contLen
);
void
tsdbCloseMetaFile
(
SMetaFile
*
mfh
);
void
tsdbCloseMetaFile
(
SMetaFile
*
mfh
);
// ------------------------------ TSDB META INTERFACES ------------------------------
// ------------------------------ TSDB META INTERFACES ------------------------------
...
@@ -82,7 +82,7 @@ typedef struct {
...
@@ -82,7 +82,7 @@ typedef struct {
typedef
struct
STable
{
typedef
struct
STable
{
int8_t
type
;
int8_t
type
;
STableId
tableId
;
STableId
tableId
;
int64_t
superUid
;
// Super table UID
uint64_t
superUid
;
// Super table UID
int32_t
sversion
;
int32_t
sversion
;
STSchema
*
schema
;
STSchema
*
schema
;
STSchema
*
tagSchema
;
STSchema
*
tagSchema
;
...
@@ -153,7 +153,7 @@ STsdbMeta *tsdbGetMeta(TsdbRepoT *pRepo);
...
@@ -153,7 +153,7 @@ STsdbMeta *tsdbGetMeta(TsdbRepoT *pRepo);
STable
*
tsdbIsValidTableToInsert
(
STsdbMeta
*
pMeta
,
STableId
tableId
);
STable
*
tsdbIsValidTableToInsert
(
STsdbMeta
*
pMeta
,
STableId
tableId
);
// int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable);
// int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable);
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
int64_t
uid
);
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
u
int64_t
uid
);
char
*
getTSTupleKey
(
const
void
*
data
);
char
*
getTSTupleKey
(
const
void
*
data
);
typedef
struct
{
typedef
struct
{
...
@@ -275,7 +275,7 @@ typedef struct {
...
@@ -275,7 +275,7 @@ typedef struct {
uint32_t
padding
;
// For padding purpose
uint32_t
padding
;
// For padding purpose
uint32_t
hasLast
:
2
;
uint32_t
hasLast
:
2
;
uint32_t
numOfBlocks
:
30
;
uint32_t
numOfBlocks
:
30
;
int64_t
uid
;
u
int64_t
uid
;
TSKEY
maxKey
;
TSKEY
maxKey
;
}
SCompIdx
;
/* sizeof(SCompIdx) = 28 */
}
SCompIdx
;
/* sizeof(SCompIdx) = 28 */
...
@@ -311,7 +311,7 @@ typedef struct {
...
@@ -311,7 +311,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int32_t
delimiter
;
// For recovery usage
int32_t
delimiter
;
// For recovery usage
int32_t
checksum
;
// TODO: decide if checksum logic in this file or make it one API
int32_t
checksum
;
// TODO: decide if checksum logic in this file or make it one API
int64_t
uid
;
uint64_t
uid
;
SCompBlock
blocks
[];
SCompBlock
blocks
[];
}
SCompInfo
;
}
SCompInfo
;
...
@@ -345,7 +345,7 @@ typedef struct {
...
@@ -345,7 +345,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int32_t
delimiter
;
// For recovery usage
int32_t
delimiter
;
// For recovery usage
int32_t
numOfCols
;
// For recovery usage
int32_t
numOfCols
;
// For recovery usage
int64_t
uid
;
// For recovery usage
uint64_t
uid
;
// For recovery usage
SCompCol
cols
[];
SCompCol
cols
[];
}
SCompData
;
}
SCompData
;
...
@@ -441,7 +441,7 @@ typedef struct {
...
@@ -441,7 +441,7 @@ typedef struct {
}
SHelperFile
;
}
SHelperFile
;
typedef
struct
{
typedef
struct
{
int64_t
uid
;
u
int64_t
uid
;
int32_t
tid
;
int32_t
tid
;
int32_t
sversion
;
int32_t
sversion
;
}
SHelperTable
;
}
SHelperTable
;
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
1c0cb588
...
@@ -392,7 +392,7 @@ int tsdbAlterTable(TsdbRepoT *pRepo, STableCfg *pCfg) {
...
@@ -392,7 +392,7 @@ int tsdbAlterTable(TsdbRepoT *pRepo, STableCfg *pCfg) {
return
0
;
return
0
;
}
}
TSKEY
tsdbGetTableLastKey
(
TsdbRepoT
*
repo
,
int64_t
uid
)
{
TSKEY
tsdbGetTableLastKey
(
TsdbRepoT
*
repo
,
u
int64_t
uid
)
{
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
STable
*
pTable
=
tsdbGetTableByUid
(
pRepo
->
tsdbMeta
,
uid
);
STable
*
pTable
=
tsdbGetTableByUid
(
pRepo
->
tsdbMeta
,
uid
);
...
@@ -430,7 +430,7 @@ int32_t tsdbInsertData(TsdbRepoT *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg * p
...
@@ -430,7 +430,7 @@ int32_t tsdbInsertData(TsdbRepoT *repo, SSubmitMsg *pMsg, SShellSubmitRspMsg * p
/**
/**
* Initialize a table configuration
* Initialize a table configuration
*/
*/
int
tsdbInitTableCfg
(
STableCfg
*
config
,
ETableType
type
,
int64_t
uid
,
int32_t
tid
)
{
int
tsdbInitTableCfg
(
STableCfg
*
config
,
ETableType
type
,
u
int64_t
uid
,
int32_t
tid
)
{
if
(
config
==
NULL
)
return
-
1
;
if
(
config
==
NULL
)
return
-
1
;
if
(
type
!=
TSDB_NORMAL_TABLE
&&
type
!=
TSDB_CHILD_TABLE
)
return
-
1
;
if
(
type
!=
TSDB_NORMAL_TABLE
&&
type
!=
TSDB_CHILD_TABLE
)
return
-
1
;
...
@@ -447,7 +447,7 @@ int tsdbInitTableCfg(STableCfg *config, ETableType type, int64_t uid, int32_t ti
...
@@ -447,7 +447,7 @@ int tsdbInitTableCfg(STableCfg *config, ETableType type, int64_t uid, int32_t ti
/**
/**
* Set the super table UID of the created table
* Set the super table UID of the created table
*/
*/
int
tsdbTableSetSuperUid
(
STableCfg
*
config
,
int64_t
uid
)
{
int
tsdbTableSetSuperUid
(
STableCfg
*
config
,
u
int64_t
uid
)
{
if
(
config
->
type
!=
TSDB_CHILD_TABLE
)
return
-
1
;
if
(
config
->
type
!=
TSDB_CHILD_TABLE
)
return
-
1
;
if
(
uid
==
TSDB_INVALID_SUPER_TABLE_ID
)
return
-
1
;
if
(
uid
==
TSDB_INVALID_SUPER_TABLE_ID
)
return
-
1
;
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
1c0cb588
...
@@ -87,9 +87,9 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
...
@@ -87,9 +87,9 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
memcpy
(
pTable
->
name
->
data
,
ptr
,
len
);
memcpy
(
pTable
->
name
->
data
,
ptr
,
len
);
ptr
=
(
char
*
)
ptr
+
len
;
ptr
=
(
char
*
)
ptr
+
len
;
T_READ_MEMBER
(
ptr
,
int64_t
,
pTable
->
tableId
.
uid
);
T_READ_MEMBER
(
ptr
,
u
int64_t
,
pTable
->
tableId
.
uid
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
tableId
.
tid
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
tableId
.
tid
);
T_READ_MEMBER
(
ptr
,
int64_t
,
pTable
->
superUid
);
T_READ_MEMBER
(
ptr
,
u
int64_t
,
pTable
->
superUid
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
sversion
);
T_READ_MEMBER
(
ptr
,
int32_t
,
pTable
->
sversion
);
if
(
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
...
@@ -455,7 +455,7 @@ static int32_t tsdbCheckTableCfg(STableCfg *pCfg) {
...
@@ -455,7 +455,7 @@ static int32_t tsdbCheckTableCfg(STableCfg *pCfg) {
return
0
;
return
0
;
}
}
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
int64_t
uid
)
{
STable
*
tsdbGetTableByUid
(
STsdbMeta
*
pMeta
,
u
int64_t
uid
)
{
void
*
ptr
=
taosHashGet
(
pMeta
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
void
*
ptr
=
taosHashGet
(
pMeta
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
if
(
ptr
==
NULL
)
return
NULL
;
if
(
ptr
==
NULL
)
return
NULL
;
...
...
src/tsdb/src/tsdbMetaFile.c
浏览文件 @
1c0cb588
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
typedef
struct
{
typedef
struct
{
int32_t
offset
;
int32_t
offset
;
int32_t
size
;
int32_t
size
;
int64_t
uid
;
u
int64_t
uid
;
}
SRecordInfo
;
}
SRecordInfo
;
// static int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
// static int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
...
@@ -76,7 +76,7 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables, iterFunc iFunc, af
...
@@ -76,7 +76,7 @@ SMetaFile *tsdbInitMetaFile(char *rootDir, int32_t maxTables, iterFunc iFunc, af
return
mfh
;
return
mfh
;
}
}
int32_t
tsdbInsertMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
,
void
*
cont
,
int32_t
contLen
)
{
int32_t
tsdbInsertMetaRecord
(
SMetaFile
*
mfh
,
u
int64_t
uid
,
void
*
cont
,
int32_t
contLen
)
{
if
(
taosHashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
))
!=
NULL
)
{
if
(
taosHashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
))
!=
NULL
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -112,7 +112,7 @@ int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t co
...
@@ -112,7 +112,7 @@ int32_t tsdbInsertMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t co
return
0
;
return
0
;
}
}
int32_t
tsdbDeleteMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
)
{
int32_t
tsdbDeleteMetaRecord
(
SMetaFile
*
mfh
,
u
int64_t
uid
)
{
char
*
ptr
=
taosHashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
char
*
ptr
=
taosHashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
if
(
ptr
==
NULL
)
return
-
1
;
if
(
ptr
==
NULL
)
return
-
1
;
...
@@ -139,7 +139,7 @@ int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid) {
...
@@ -139,7 +139,7 @@ int32_t tsdbDeleteMetaRecord(SMetaFile *mfh, int64_t uid) {
return
0
;
return
0
;
}
}
int32_t
tsdbUpdateMetaRecord
(
SMetaFile
*
mfh
,
int64_t
uid
,
void
*
cont
,
int32_t
contLen
)
{
int32_t
tsdbUpdateMetaRecord
(
SMetaFile
*
mfh
,
u
int64_t
uid
,
void
*
cont
,
int32_t
contLen
)
{
char
*
ptr
=
taosHashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
char
*
ptr
=
taosHashGet
(
mfh
->
map
,
(
char
*
)(
&
uid
),
sizeof
(
uid
));
if
(
ptr
==
NULL
)
return
-
1
;
if
(
ptr
==
NULL
)
return
-
1
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
1c0cb588
...
@@ -1516,8 +1516,9 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr)
...
@@ -1516,8 +1516,9 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr)
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
tsdbQuerySTableByTagCond
(
TsdbRepoT
*
tsdb
,
int64_t
uid
,
const
char
*
pTagCond
,
size_t
len
,
int16_t
tagNameRelType
,
int32_t
tsdbQuerySTableByTagCond
(
TsdbRepoT
*
tsdb
,
uint64_t
uid
,
const
char
*
pTagCond
,
size_t
len
,
const
char
*
tbnameCond
,
STableGroupInfo
*
pGroupInfo
,
SColIndex
*
pColIndex
,
int32_t
numOfCols
)
{
int16_t
tagNameRelType
,
const
char
*
tbnameCond
,
STableGroupInfo
*
pGroupInfo
,
SColIndex
*
pColIndex
,
int32_t
numOfCols
)
{
STable
*
pTable
=
tsdbGetTableByUid
(
tsdbGetMeta
(
tsdb
),
uid
);
STable
*
pTable
=
tsdbGetTableByUid
(
tsdbGetMeta
(
tsdb
),
uid
);
if
(
pTable
==
NULL
)
{
if
(
pTable
==
NULL
)
{
uError
(
"%p failed to get stable, uid:%"
PRIu64
,
tsdb
,
uid
);
uError
(
"%p failed to get stable, uid:%"
PRIu64
,
tsdb
,
uid
);
...
@@ -1589,7 +1590,7 @@ int32_t tsdbQuerySTableByTagCond(TsdbRepoT *tsdb, int64_t uid, const char *pTagC
...
@@ -1589,7 +1590,7 @@ int32_t tsdbQuerySTableByTagCond(TsdbRepoT *tsdb, int64_t uid, const char *pTagC
return
ret
;
return
ret
;
}
}
int32_t
tsdbGetOneTableGroup
(
TsdbRepoT
*
tsdb
,
int64_t
uid
,
STableGroupInfo
*
pGroupInfo
)
{
int32_t
tsdbGetOneTableGroup
(
TsdbRepoT
*
tsdb
,
u
int64_t
uid
,
STableGroupInfo
*
pGroupInfo
)
{
STable
*
pTable
=
tsdbGetTableByUid
(
tsdbGetMeta
(
tsdb
),
uid
);
STable
*
pTable
=
tsdbGetTableByUid
(
tsdbGetMeta
(
tsdb
),
uid
);
if
(
pTable
==
NULL
)
{
if
(
pTable
==
NULL
)
{
return
TSDB_CODE_INVALID_TABLE_ID
;
return
TSDB_CODE_INVALID_TABLE_ID
;
...
...
src/tsdb/tests/tsdbTests.cpp
浏览文件 @
1c0cb588
...
@@ -16,7 +16,7 @@ typedef struct {
...
@@ -16,7 +16,7 @@ typedef struct {
TsdbRepoT
*
pRepo
;
TsdbRepoT
*
pRepo
;
bool
isAscend
;
bool
isAscend
;
int
tid
;
int
tid
;
int64_t
uid
;
uint64_t
uid
;
int
sversion
;
int
sversion
;
TSKEY
startTime
;
TSKEY
startTime
;
TSKEY
interval
;
TSKEY
interval
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录