Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
06e89a5e
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看板
提交
06e89a5e
编写于
3月 19, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-32] refactor the tablemeta
上级
03346d0c
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
128 addition
and
90 deletion
+128
-90
src/client/CMakeLists.txt
src/client/CMakeLists.txt
+1
-0
src/client/inc/tschemautil.h
src/client/inc/tschemautil.h
+9
-7
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+6
-3
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+17
-41
src/client/src/tscServer.c
src/client/src/tscServer.c
+14
-10
src/common/inc/name.h
src/common/inc/name.h
+8
-0
src/common/src/name.c
src/common/src/name.c
+42
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+2
-3
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+13
-11
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+1
-1
src/mnode/src/mgmtSuperTable.c
src/mnode/src/mgmtSuperTable.c
+1
-1
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+3
-3
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+1
-1
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+3
-3
src/query/CMakeLists.txt
src/query/CMakeLists.txt
+1
-1
src/util/src/tcache.c
src/util/src/tcache.c
+6
-5
未找到文件。
src/client/CMakeLists.txt
浏览文件 @
06e89a5e
...
...
@@ -6,6 +6,7 @@ INCLUDE_DIRECTORIES(jni)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/util/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/query/inc
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/src/common/inc
)
INCLUDE_DIRECTORIES
(
${
TD_ENTERPRISE_DIR
}
/src/inc
)
INCLUDE_DIRECTORIES
(
${
TD_OS_DIR
}
/inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
...
...
src/client/inc/tschemautil.h
浏览文件 @
06e89a5e
...
...
@@ -89,17 +89,19 @@ bool isValidSchema(struct SSchema *pSchema, int32_t numOfCols);
* get the schema for the "tbname" column. it is a built column
* @return
*/
SSchema
tsGetTbnameColumnSchema
();
SSchema
tscGetTbnameColumnSchema
();
/**
* create the table meta from the msg
* @param pTableMetaMsg
* @param size size of the table meta
* @return
*/
STableMeta
*
tscCreateTableMetaFromMsg
(
STableMetaMsg
*
pTableMetaMsg
,
size_t
*
size
);
//todo tags value as well as the table id structure needs refactor
char
*
tsGetTagsValue
(
STableMeta
*
pMeta
);
bool
tsMeterMetaIdentical
(
STableMeta
*
p1
,
STableMeta
*
p2
);
void
extractTableName
(
char
*
tableId
,
char
*
name
);
SSQLToken
extractDBName
(
char
*
tableId
,
char
*
name
);
void
extractTableNameFromToken
(
SSQLToken
*
pToken
,
SSQLToken
*
pTable
);
#ifdef __cplusplus
...
...
src/client/src/tscSQLParser.c
浏览文件 @
06e89a5e
...
...
@@ -29,6 +29,8 @@
#include "tsclient.h"
#include "ttokendef.h"
#include "name.h"
#define DEFAULT_PRIMARY_TIMESTAMP_COL_NAME "_c0"
// -1 is tbname column index, so here use the -2 as the initial value
...
...
@@ -2470,7 +2472,7 @@ int32_t parseGroupbyClause(SQueryInfo* pQueryInfo, tVariantList* pList, SSqlCmd*
STableMeta
*
pTableMeta
=
NULL
;
SSchema
*
pSchema
=
NULL
;
SSchema
s
=
tsGetTbnameColumnSchema
();
SSchema
s
=
ts
c
GetTbnameColumnSchema
();
int32_t
tableIndex
=
COLUMN_INDEX_INITIAL_VAL
;
...
...
@@ -3538,8 +3540,9 @@ static int32_t setTableCondForMetricQuery(SQueryInfo* pQueryInfo, const char* ac
}
num
=
j
;
SSQLToken
dbToken
=
extractDBName
(
pTableMetaInfo
->
name
,
db
);
char
*
name
=
extractDBName
(
pTableMetaInfo
->
name
,
db
);
SSQLToken
dbToken
=
{.
type
=
TK_STRING
,
.
z
=
name
,
.
n
=
strlen
(
name
)};
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
if
(
i
>=
1
)
{
taosStringBuilderAppendStringLen
(
&
sb1
,
TBNAME_LIST_SEP
,
1
);
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
06e89a5e
...
...
@@ -45,8 +45,6 @@ int32_t tscGetNumOfColumns(const STableMeta* pTableMeta) {
// table created according to super table, use data from super table
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMeta
);
assert
(
tinfo
.
numOfColumns
>=
2
);
return
tinfo
.
numOfColumns
;
}
...
...
@@ -141,7 +139,7 @@ SSchema* tscGetTableColumnSchema(const STableMeta* pTableMeta, int32_t startCol)
return
&
pSchema
[
startCol
];
}
struct
SSchema
tsGetTbnameColumnSchema
()
{
struct
SSchema
ts
c
GetTbnameColumnSchema
()
{
struct
SSchema
s
=
{
.
colId
=
TSDB_TBNAME_COLUMN_INDEX
,
.
type
=
TSDB_DATA_TYPE_BINARY
,
...
...
@@ -152,6 +150,22 @@ struct SSchema tsGetTbnameColumnSchema() {
return
s
;
}
STableMeta
*
tscCreateTableMetaFromMsg
(
STableMetaMsg
*
pTableMetaMsg
,
size_t
*
size
)
{
assert
(
pTableMetaMsg
!=
NULL
);
int32_t
schemaSize
=
(
pTableMetaMsg
->
numOfColumns
+
pTableMetaMsg
->
numOfTags
)
*
sizeof
(
SSchema
);
STableMeta
*
pTableMeta
=
calloc
(
1
,
sizeof
(
STableMeta
)
+
schemaSize
);
memcpy
(
pTableMeta
->
schema
,
pTableMetaMsg
->
schema
,
schemaSize
);
if
(
size
!=
NULL
)
{
*
size
=
sizeof
(
STableMeta
)
+
schemaSize
;
}
return
pTableMeta
;
}
/**
* the TableMeta data format in memory is as follows:
*
...
...
@@ -174,26 +188,6 @@ char* tsGetTagsValue(STableMeta* pTableMeta) {
return
((
char
*
)
pTableMeta
+
offset
);
}
bool
tsMeterMetaIdentical
(
STableMeta
*
p1
,
STableMeta
*
p2
)
{
if
(
p1
==
NULL
||
p2
==
NULL
||
p1
->
uid
!=
p2
->
uid
||
p1
->
sversion
!=
p2
->
sversion
)
{
return
false
;
}
//
// if (p1 == p2) {
// return true;
// }
//
// size_t size = sizeof(STableMeta) + p1->numOfColumns * sizeof(SSchema);
//
// for (int32_t i = 0; i < p1->numOfTags; ++i) {
// SSchema* pColSchema = tscGetTableColumnSchema(p1, i + p1->numOfColumns);
// size += pColSchema->bytes;
// }
// return memcmp(p1, p2, size) == 0;
return
true
;
}
// todo refactor
static
FORCE_INLINE
char
*
skipSegments
(
char
*
input
,
char
delim
,
int32_t
num
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
...
...
@@ -213,24 +207,6 @@ static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) {
return
len
;
}
/**
* extract table name from meterid, which the format of userid.dbname.metername
* @param tableId
* @return
*/
void
extractTableName
(
char
*
tableId
,
char
*
name
)
{
char
*
r
=
skipSegments
(
tableId
,
TS_PATH_DELIMITER
[
0
],
2
);
copy
(
name
,
r
,
TS_PATH_DELIMITER
[
0
]);
}
SSQLToken
extractDBName
(
char
*
tableId
,
char
*
name
)
{
char
*
r
=
skipSegments
(
tableId
,
TS_PATH_DELIMITER
[
0
],
1
);
size_t
len
=
copy
(
name
,
r
,
TS_PATH_DELIMITER
[
0
]);
SSQLToken
token
=
{.
z
=
name
,
.
n
=
len
,
.
type
=
TK_STRING
};
return
token
;
}
/*
* tablePrefix.columnName
* extract table name and save it in pTable, with only column name in pToken
...
...
src/client/src/tscServer.c
浏览文件 @
06e89a5e
...
...
@@ -2247,7 +2247,7 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return
TSDB_CODE_SUCCESS
;
}
int
tscBuild
Meter
MetaMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
int
tscBuild
Table
MetaMsg
(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
{
SCMTableInfoMsg
*
pInfoMsg
;
char
*
pMsg
;
int
msgLen
=
0
;
...
...
@@ -2878,7 +2878,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
//?
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
0
);
...
...
@@ -2891,7 +2891,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
pMetaMsg
->
numOfColumns
=
ntohs
(
pMetaMsg
->
numOfColumns
);
pSchema
=
(
SSchema
*
)((
char
*
)
pMetaMsg
+
sizeof
(
STableMeta
))
;
pSchema
=
pMetaMsg
->
schema
;
pMetaMsg
->
sid
=
ntohs
(
pMetaMsg
->
sid
);
for
(
int
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
...
...
@@ -2902,12 +2902,14 @@ int tscProcessShowRsp(SSqlObj *pSql) {
strcpy
(
key
+
1
,
"showlist"
);
taosCacheRelease
(
tscCacheHandle
,
(
void
*
)
&
(
pTableMetaInfo
->
pTableMeta
),
false
);
int32_t
size
=
pMetaMsg
->
numOfColumns
*
sizeof
(
SSchema
)
+
sizeof
(
STableMeta
);
size_t
size
=
0
;
STableMeta
*
pTableMeta
=
tscCreateTableMetaFromMsg
(
pMetaMsg
,
&
size
);
pTableMetaInfo
->
pTableMeta
=
(
STableMeta
*
)
taosCachePut
(
tscCacheHandle
,
key
,
(
char
*
)
pMetaMsg
,
size
,
tsMeterMetaKeepTimer
);
(
STableMeta
*
)
taosCachePut
(
tscCacheHandle
,
key
,
(
char
*
)
pTableMeta
,
size
,
tsMeterMetaKeepTimer
);
pCmd
->
numOfCols
=
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
SSchema
*
p
Meter
Schema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
SSchema
*
p
Table
Schema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
tscColumnBaseInfoReserve
(
&
pQueryInfo
->
colList
,
pMetaMsg
->
numOfColumns
);
SColumnIndex
index
=
{
0
};
...
...
@@ -2915,13 +2917,15 @@ int tscProcessShowRsp(SSqlObj *pSql) {
for
(
int16_t
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
index
.
columnIndex
=
i
;
tscColumnBaseInfoInsert
(
pQueryInfo
,
&
index
);
tscFieldInfoSetValFromSchema
(
&
pQueryInfo
->
fieldsInfo
,
i
,
&
p
Meter
Schema
[
i
]);
tscFieldInfoSetValFromSchema
(
&
pQueryInfo
->
fieldsInfo
,
i
,
&
p
Table
Schema
[
i
]);
pQueryInfo
->
fieldsInfo
.
pSqlExpr
[
i
]
=
tscSqlExprInsert
(
pQueryInfo
,
i
,
TSDB_FUNC_TS_DUMMY
,
&
index
,
p
MeterSchema
[
i
].
type
,
pMeterSchema
[
i
].
bytes
,
pMeter
Schema
[
i
].
bytes
);
p
TableSchema
[
i
].
type
,
pTableSchema
[
i
].
bytes
,
pTable
Schema
[
i
].
bytes
);
}
tscFieldInfoCalOffset
(
pQueryInfo
);
tfree
(
pTableMeta
);
return
0
;
}
...
...
@@ -3379,7 +3383,7 @@ void tscInitMsgs() {
tscBuildMsg
[
TSDB_SQL_CONNECT
]
=
tscBuildConnectMsg
;
tscBuildMsg
[
TSDB_SQL_USE_DB
]
=
tscBuildUseDbMsg
;
tscBuildMsg
[
TSDB_SQL_META
]
=
tscBuild
Meter
MetaMsg
;
tscBuildMsg
[
TSDB_SQL_META
]
=
tscBuild
Table
MetaMsg
;
tscBuildMsg
[
TSDB_SQL_METRIC
]
=
tscBuildMetricMetaMsg
;
tscBuildMsg
[
TSDB_SQL_MULTI_META
]
=
tscBuildMultiMeterMetaMsg
;
...
...
src/common/inc/name.h
0 → 100644
浏览文件 @
06e89a5e
#ifndef TDENGINE_NAME_H
#define TDENGINE_NAME_H
int32_t
extractTableName
(
const
char
*
tableId
,
char
*
name
);
char
*
extractDBName
(
const
char
*
tableId
,
char
*
name
);
#endif // TDENGINE_NAME_H
src/common/src/name.c
0 → 100644
浏览文件 @
06e89a5e
#include "os.h"
#include "tutil.h"
#include "name.h"
#include "tstoken.h"
#include "ttokendef.h"
// todo refactor
static
FORCE_INLINE
const
char
*
skipSegments
(
const
char
*
input
,
char
delim
,
int32_t
num
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
while
(
*
input
!=
0
&&
*
input
++
!=
delim
)
{
};
}
return
input
;
}
static
FORCE_INLINE
size_t
copy
(
char
*
dst
,
const
char
*
src
,
char
delimiter
)
{
size_t
len
=
0
;
while
(
*
src
!=
delimiter
&&
*
src
!=
0
)
{
*
dst
++
=
*
src
++
;
len
++
;
}
return
len
;
}
int32_t
extractTableName
(
const
char
*
tableId
,
char
*
name
)
{
size_t
offset
=
strcspn
(
tableId
,
&
TS_PATH_DELIMITER
[
0
]);
offset
=
strcspn
(
&
tableId
[
offset
],
&
TS_PATH_DELIMITER
[
0
]);
return
strncpy
(
name
,
&
tableId
[
offset
],
TSDB_TABLE_NAME_LEN
);
// char* r = skipSegments(tableId, TS_PATH_DELIMITER[0], 2);
// return copy(name, r, TS_PATH_DELIMITER[0]);
}
char
*
extractDBName
(
const
char
*
tableId
,
char
*
name
)
{
size_t
offset1
=
strcspn
(
tableId
,
&
TS_PATH_DELIMITER
[
0
]);
size_t
len
=
strcspn
(
&
tableId
[
offset1
+
1
],
&
TS_PATH_DELIMITER
[
0
]);
return
strncpy
(
name
,
&
tableId
[
offset1
+
1
],
len
);
}
src/inc/taosmsg.h
浏览文件 @
06e89a5e
...
...
@@ -223,7 +223,7 @@ typedef struct {
typedef
struct
SSchema
{
uint8_t
type
;
char
name
[
TSDB_COL_NAME_LEN
+
1
];
char
name
[
TSDB_COL_NAME_LEN
];
int16_t
colId
;
int16_t
bytes
;
}
SSchema
;
...
...
@@ -684,10 +684,9 @@ typedef struct STableMetaMsg {
uint8_t
numOfTags
;
uint8_t
precision
;
uint8_t
tableType
;
// uint8_t index : 4; // used locally
int16_t
numOfColumns
;
// int16_t rowSize; // used locally, calculated in client
int16_t
sversion
;
int8_t
numOfVpeers
;
SVnodeDesc
vpeerDesc
[
TSDB_VNODES_SUPPORT
];
int32_t
sid
;
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
06e89a5e
...
...
@@ -15,23 +15,26 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "taoserror.h"
#include "tstatus.h"
#include "tutil.h"
#include "mnode.h"
#include "mgmtDb.h"
#include "mgmtAcct.h"
#include "mgmtBalance.h"
#include "mgmt
Db
.h"
#include "mgmt
ChildTable
.h"
#include "mgmtDnode.h"
#include "mgmtMnode.h"
#include "mgmtGrant.h"
#include "mgmt
Shell
.h"
#include "mgmt
Mnode
.h"
#include "mgmtNormalTable.h"
#include "mgmt
ChildTable
.h"
#include "mgmt
Shell
.h"
#include "mgmtSuperTable.h"
#include "mgmtTable.h"
#include "mgmtUser.h"
#include "mgmtVgroup.h"
#include "mnode.h"
#include "taoserror.h"
#include "tstatus.h"
#include "tutil.h"
#include "name.h"
static
void
*
tsDbSdb
=
NULL
;
static
int32_t
tsDbUpdateSize
;
...
...
@@ -294,8 +297,7 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) {
bool
mgmtCheckIsMonitorDB
(
char
*
db
,
char
*
monitordb
)
{
char
dbName
[
TSDB_DB_NAME_LEN
+
1
]
=
{
0
};
assert
(
0
);
// extractDBName(db, dbName);
extractDBName
(
db
,
dbName
);
size_t
len
=
strlen
(
dbName
);
return
(
strncasecmp
(
dbName
,
monitordb
,
len
)
==
0
&&
len
==
strlen
(
monitordb
));
...
...
@@ -436,7 +438,7 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"created
time"
);
strcpy
(
pSchema
[
cols
].
name
,
"created
_
time"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
06e89a5e
...
...
@@ -331,7 +331,7 @@ static int32_t mgmtGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
pShow
->
bytes
[
cols
]
=
12
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"sync
status"
);
strcpy
(
pSchema
[
cols
].
name
,
"sync
_
status"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
src/mnode/src/mgmtSuperTable.c
浏览文件 @
06e89a5e
...
...
@@ -508,7 +508,7 @@ static int32_t mgmtGetShowSuperTableMeta(STableMetaMsg *pMeta, SShowObj *pShow,
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create
time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create
_
time"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
06e89a5e
...
...
@@ -198,13 +198,13 @@ int32_t mgmtGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"table
name"
);
strcpy
(
pSchema
[
cols
].
name
,
"table
_
name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create
time"
);
strcpy
(
pSchema
[
cols
].
name
,
"create
d_
time"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -216,7 +216,7 @@ int32_t mgmtGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"s
uper table
name"
);
strcpy
(
pSchema
[
cols
].
name
,
"s
table_
name"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
06e89a5e
...
...
@@ -193,7 +193,7 @@ static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCon
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"created
time"
);
strcpy
(
pSchema
[
cols
].
name
,
"created
_
time"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
06e89a5e
...
...
@@ -233,7 +233,7 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
pShow
->
bytes
[
cols
]
=
9
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"vgroup
status"
);
strcpy
(
pSchema
[
cols
].
name
,
"vgroup
_
status"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -273,13 +273,13 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
pShow
->
bytes
[
cols
]
=
9
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"vnode
status"
);
strcpy
(
pSchema
[
cols
].
name
,
"vnode
_
status"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
16
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"public
ip"
);
strcpy
(
pSchema
[
cols
].
name
,
"public
_
ip"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
}
...
...
src/query/CMakeLists.txt
浏览文件 @
06e89a5e
...
...
@@ -9,5 +9,5 @@ INCLUDE_DIRECTORIES(inc)
IF
((
TD_LINUX_64
)
OR
(
TD_LINUX_32 AND TD_ARM
))
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
query
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
query util m rt
)
TARGET_LINK_LIBRARIES
(
query
t
util m rt
)
ENDIF
()
\ No newline at end of file
src/util/src/tcache.c
浏览文件 @
06e89a5e
...
...
@@ -206,9 +206,10 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pObj, SCacheDataNode *p
return
;
}
int32_t
size
=
pNode
->
size
;
taosHashRemove
(
pObj
->
pHashTable
,
pNode
->
key
,
pNode
->
keySize
);
pTrace
(
"key:%s is removed from cache,total:%d,size:%ldbytes"
,
pNode
->
key
,
pObj
->
totalSize
,
pObj
->
totalSize
);
pTrace
(
"key:%s is removed from cache,total:%d,size:%ldbytes"
,
pNode
->
key
,
pObj
->
totalSize
,
size
);
free
(
pNode
);
}
...
...
@@ -418,10 +419,10 @@ void *taosCachePut(void *handle, char *key, char *pData, int dataSize, int durat
if
(
pOld
==
NULL
)
{
// do addedTime to cache
pNode
=
taosAddToCacheImpl
(
pObj
,
key
,
keyLen
,
pData
,
dataSize
,
duration
*
1000L
);
if
(
NULL
!=
pNode
)
{
p
Trace
(
"key:%s %p added into cache, addedTime:%"
PRIu64
", expireTime:%"
PRIu64
", cache total:%d, size:%"
PRId64
" bytes, collision:%d"
,
key
,
pNode
,
pNode
->
addedTime
,
pNode
->
expiredTime
,
dataSize
,
pObj
->
totalSize
,
pObj
->
statistics
.
numOfCollision
);
p
Obj
->
totalSize
+=
pNode
->
size
;
pTrace
(
"key:%s %p added into cache, added:%"
PRIu64
", expire:%"
PRIu64
", total:%d, size:%"
PRId64
" bytes"
,
key
,
pNode
,
pNode
->
addedTime
,
pNode
->
expiredTime
,
pObj
->
totalSize
,
dataSize
);
}
}
else
{
// old data exists, update the node
pNode
=
taosUpdateCacheImpl
(
pObj
,
pOld
,
key
,
keyLen
,
pData
,
dataSize
,
duration
*
1000L
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录