Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7cedf4af
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
7cedf4af
编写于
4年前
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename meter to table
上级
03da5549
变更
49
展开全部
隐藏空白更改
内联
并排
Showing
49 changed file
with
303 addition
and
335 deletion
+303
-335
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+6
-6
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+4
-4
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+3
-3
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+8
-8
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+8
-8
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+16
-16
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+14
-14
src/client/src/tscServer.c
src/client/src/tscServer.c
+75
-75
src/client/src/tscSub.c
src/client/src/tscSub.c
+23
-23
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+14
-14
src/dnode/inc/dnodeRead.h
src/dnode/inc/dnodeRead.h
+3
-3
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+2
-2
src/dnode/src/dnodeRead.c
src/dnode/src/dnodeRead.c
+6
-6
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+5
-5
src/inc/mnode.h
src/inc/mnode.h
+2
-2
src/inc/taosmsg.h
src/inc/taosmsg.h
+24
-56
src/inc/trpc.h
src/inc/trpc.h
+1
-1
src/mnode/inc/mgmtAcct.h
src/mnode/inc/mgmtAcct.h
+1
-1
src/mnode/inc/mgmtChildTable.h
src/mnode/inc/mgmtChildTable.h
+1
-1
src/mnode/inc/mgmtConn.h
src/mnode/inc/mgmtConn.h
+1
-1
src/mnode/inc/mgmtDb.h
src/mnode/inc/mgmtDb.h
+1
-1
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+5
-5
src/mnode/inc/mgmtGrant.h
src/mnode/inc/mgmtGrant.h
+1
-1
src/mnode/inc/mgmtMnode.h
src/mnode/inc/mgmtMnode.h
+1
-1
src/mnode/inc/mgmtNormalTable.h
src/mnode/inc/mgmtNormalTable.h
+1
-1
src/mnode/inc/mgmtProfile.h
src/mnode/inc/mgmtProfile.h
+2
-2
src/mnode/inc/mgmtStreamTable.h
src/mnode/inc/mgmtStreamTable.h
+1
-1
src/mnode/inc/mgmtSuperTable.h
src/mnode/inc/mgmtSuperTable.h
+2
-2
src/mnode/inc/mgmtTable.h
src/mnode/inc/mgmtTable.h
+3
-3
src/mnode/inc/mgmtUser.h
src/mnode/inc/mgmtUser.h
+1
-1
src/mnode/inc/mgmtVgroup.h
src/mnode/inc/mgmtVgroup.h
+1
-1
src/mnode/src/mgmtAcct.c
src/mnode/src/mgmtAcct.c
+2
-2
src/mnode/src/mgmtChildTable.c
src/mnode/src/mgmtChildTable.c
+4
-4
src/mnode/src/mgmtConn.c
src/mnode/src/mgmtConn.c
+1
-1
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+12
-12
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+6
-6
src/mnode/src/mgmtDnodeInt.c
src/mnode/src/mgmtDnodeInt.c
+3
-3
src/mnode/src/mgmtGrant.c
src/mnode/src/mgmtGrant.c
+2
-2
src/mnode/src/mgmtMnode.c
src/mnode/src/mgmtMnode.c
+2
-2
src/mnode/src/mgmtNormalTable.c
src/mnode/src/mgmtNormalTable.c
+2
-2
src/mnode/src/mgmtProfile.c
src/mnode/src/mgmtProfile.c
+2
-2
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+14
-14
src/mnode/src/mgmtStreamTable.c
src/mnode/src/mgmtStreamTable.c
+2
-2
src/mnode/src/mgmtSuperTable.c
src/mnode/src/mgmtSuperTable.c
+3
-3
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+2
-2
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+1
-1
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+1
-1
src/util/inc/textbuffer.h
src/util/inc/textbuffer.h
+1
-1
src/util/inc/tschemautil.h
src/util/inc/tschemautil.h
+7
-7
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
7cedf4af
...
...
@@ -67,7 +67,7 @@ typedef struct SJoinSubquerySupporter {
}
SJoinSubquerySupporter
;
int32_t
tscCreateDataBlock
(
size_t
initialSize
,
int32_t
rowSize
,
int32_t
startOffset
,
const
char
*
name
,
S
Meter
Meta
*
pMeterMeta
,
STableDataBlocks
**
dataBlocks
);
S
Table
Meta
*
pMeterMeta
,
STableDataBlocks
**
dataBlocks
);
void
tscAppendDataBlock
(
SDataBlockList
*
pList
,
STableDataBlocks
*
pBlocks
);
void
tscDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
);
...
...
@@ -81,11 +81,11 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock);
void
tscFreeUnusedDataBlocks
(
SDataBlockList
*
pList
);
int32_t
tscMergeTableDataBlocks
(
SSqlObj
*
pSql
,
SDataBlockList
*
pDataList
);
int32_t
tscGetDataBlockFromList
(
void
*
pHashList
,
SDataBlockList
*
pDataBlockList
,
int64_t
id
,
int32_t
size
,
int32_t
startOffset
,
int32_t
rowSize
,
const
char
*
tableId
,
S
Meter
Meta
*
pMeterMeta
,
int32_t
startOffset
,
int32_t
rowSize
,
const
char
*
tableId
,
S
Table
Meta
*
pMeterMeta
,
STableDataBlocks
**
dataBlocks
);
SVnodeSidList
*
tscGetVnodeSidList
(
S
Metric
Meta
*
pMetricmeta
,
int32_t
vnodeIdx
);
S
Meter
SidExtInfo
*
tscGetMeterSidInfo
(
SVnodeSidList
*
pSidList
,
int32_t
idx
);
SVnodeSidList
*
tscGetVnodeSidList
(
S
SuperTable
Meta
*
pMetricmeta
,
int32_t
vnodeIdx
);
S
Table
SidExtInfo
*
tscGetMeterSidInfo
(
SVnodeSidList
*
pSidList
,
int32_t
idx
);
/**
*
...
...
@@ -120,7 +120,7 @@ void tscClearInterpInfo(SQueryInfo* pQueryInfo);
bool
tscIsInsertOrImportData
(
char
*
sqlstr
);
/* use for keep current db info temporarily, for handle table with db prefix */
void
tscGetDBInfoFromMeterId
(
char
*
meter
Id
,
char
*
db
);
void
tscGetDBInfoFromMeterId
(
char
*
table
Id
,
char
*
db
);
int
tscAllocPayload
(
SSqlCmd
*
pCmd
,
int
size
);
...
...
@@ -196,7 +196,7 @@ int32_t tscGetQueryInfoDetailSafely(SSqlCmd *pCmd, int32_t subClauseIndex, SQuer
SMeterMetaInfo
*
tscGetMeterMetaInfoByUid
(
SQueryInfo
*
pQueryInfo
,
uint64_t
uid
,
int32_t
*
index
);
void
tscClearMeterMetaInfo
(
SMeterMetaInfo
*
pMeterMetaInfo
,
bool
removeFromCache
);
SMeterMetaInfo
*
tscAddMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
S
MeterMeta
*
pMeterMeta
,
SMetric
Meta
*
pMetricMeta
,
SMeterMetaInfo
*
tscAddMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
S
TableMeta
*
pMeterMeta
,
SSuperTable
Meta
*
pMetricMeta
,
int16_t
numOfTags
,
int16_t
*
tags
);
SMeterMetaInfo
*
tscAddEmptyMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
);
int32_t
tscAddSubqueryInfo
(
SSqlCmd
*
pCmd
);
...
...
This diff is collapsed.
Click to expand it.
src/client/inc/tsclient.h
浏览文件 @
7cedf4af
...
...
@@ -47,8 +47,8 @@ typedef struct SSqlGroupbyExpr {
}
SSqlGroupbyExpr
;
typedef
struct
SMeterMetaInfo
{
S
Meter
Meta
*
pMeterMeta
;
// metermeta
S
Metric
Meta
*
pMetricMeta
;
// metricmeta
S
Table
Meta
*
pMeterMeta
;
// metermeta
S
SuperTable
Meta
*
pMetricMeta
;
// metricmeta
/*
* 1. keep the vnode index during the multi-vnode super table projection query
...
...
@@ -160,7 +160,7 @@ typedef struct STableDataBlocks {
bool
ordered
;
// if current rows are ordered or not
int64_t
vgid
;
// virtual group id
int64_t
prevTS
;
// previous timestamp, recorded to decide if the records array is ts ascending
int32_t
numOf
Meter
s
;
// number of tables in current submit block
int32_t
numOf
Table
s
;
// number of tables in current submit block
int32_t
rowSize
;
// row size for current table
uint32_t
nAllocSize
;
...
...
@@ -171,7 +171,7 @@ typedef struct STableDataBlocks {
* the metermeta for current table, the metermeta will be used during submit stage, keep a ref
* to avoid it to be removed from cache
*/
S
Meter
Meta
*
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
;
union
{
char
*
filename
;
...
...
This diff is collapsed.
Click to expand it.
src/client/src/tscAsync.c
浏览文件 @
7cedf4af
...
...
@@ -444,10 +444,10 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
if
(
code
!=
0
)
{
code
=
abs
(
code
);
pRes
->
code
=
code
;
tscTrace
(
"%p failed to renew
meter
Meta"
,
pSql
);
tscTrace
(
"%p failed to renew
table
Meta"
,
pSql
);
tsem_post
(
&
pSql
->
rspSem
);
}
else
{
tscTrace
(
"%p renew
meter
Meta successfully, command:%d, code:%d, retry:%d"
,
tscTrace
(
"%p renew
table
Meta successfully, command:%d, code:%d, retry:%d"
,
pSql
,
pSql
->
cmd
.
command
,
pSql
->
res
.
code
,
pSql
->
retry
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
&
pSql
->
cmd
,
0
,
0
);
...
...
@@ -546,7 +546,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
tscTansformSQLFunctionForSTableQuery
(
pQueryInfo
);
tscIncStreamExecutionCount
(
pSql
->
pStream
);
}
else
{
tscTrace
(
"%p get
meter
Meta/metricMeta successfully"
,
pSql
);
tscTrace
(
"%p get
table
Meta/metricMeta successfully"
,
pSql
);
}
tscDoQuery
(
pSql
);
...
...
This diff is collapsed.
Click to expand it.
src/client/src/tscLocal.c
浏览文件 @
7cedf4af
...
...
@@ -77,7 +77,7 @@ static int32_t getToStringLength(const char *pData, int32_t length, int32_t type
* length((uint64_t) 123456789011) > 12, greater than sizsof(uint64_t)
*/
static
int32_t
tscMaxLengthOfTagsFields
(
SSqlObj
*
pSql
)
{
S
Meter
Meta
*
pMeta
=
tscGetMeterMetaInfo
(
&
pSql
->
cmd
,
0
,
0
)
->
pMeterMeta
;
S
Table
Meta
*
pMeta
=
tscGetMeterMetaInfo
(
&
pSql
->
cmd
,
0
,
0
)
->
pMeterMeta
;
if
(
pMeta
->
tableType
==
TSDB_TABLE_TYPE_SUPER_TABLE
||
pMeta
->
tableType
==
TSDB_TABLE_TYPE_NORMAL_TABLE
||
pMeta
->
tableType
==
TSDB_TABLE_TYPE_STREAM_TABLE
)
{
...
...
@@ -109,7 +109,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
0
);
S
Meter
Meta
*
pMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeta
=
pMeterMetaInfo
->
pMeterMeta
;
/*
* tagValueCnt is to denote the number of tags columns for meter, not metric. and is to show the column data.
...
...
@@ -285,7 +285,7 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) {
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
0
);
S
Metric
Meta
*
pMetricMeta
=
pMeterMetaInfo
->
pMetricMeta
;
S
SuperTable
Meta
*
pMetricMeta
=
pMeterMetaInfo
->
pMetricMeta
;
SSchema
*
pSchema
=
tsGetTagSchema
(
pMeterMetaInfo
->
pMeterMeta
);
int32_t
vOffset
[
TSDB_MAX_COLUMNS
]
=
{
0
};
...
...
@@ -299,7 +299,7 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) {
}
}
int32_t
totalNumOfResults
=
pMetricMeta
->
numOf
Meter
s
;
int32_t
totalNumOfResults
=
pMetricMeta
->
numOf
Table
s
;
int32_t
rowLen
=
tscGetResRowLength
(
pQueryInfo
);
tscInitResObjForLocalQuery
(
pSql
,
totalNumOfResults
,
rowLen
);
...
...
@@ -309,7 +309,7 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) {
SVnodeSidList
*
pSidList
=
(
SVnodeSidList
*
)((
char
*
)
pMetricMeta
+
pMetricMeta
->
list
[
i
]);
for
(
int32_t
j
=
0
;
j
<
pSidList
->
numOfSids
;
++
j
)
{
S
Meter
SidExtInfo
*
pSidExt
=
tscGetMeterSidInfo
(
pSidList
,
j
);
S
Table
SidExtInfo
*
pSidExt
=
tscGetMeterSidInfo
(
pSidList
,
j
);
for
(
int32_t
k
=
0
;
k
<
pQueryInfo
->
fieldsInfo
.
numOfOutputCols
;
++
k
)
{
SColIndexEx
*
pColIndex
=
&
tscSqlExprGet
(
pQueryInfo
,
k
)
->
colInfo
;
...
...
@@ -336,7 +336,7 @@ static int tscBuildMetricTagSqlFunctionResult(SSqlObj *pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
S
Metric
Meta
*
pMetricMeta
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
0
)
->
pMetricMeta
;
S
SuperTable
Meta
*
pMetricMeta
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
0
)
->
pMetricMeta
;
int32_t
totalNumOfResults
=
1
;
// count function only produce one result
int32_t
rowLen
=
tscGetResRowLength
(
pQueryInfo
);
...
...
@@ -351,7 +351,7 @@ static int tscBuildMetricTagSqlFunctionResult(SSqlObj *pSql) {
TAOS_FIELD
*
pField
=
tscFieldInfoGetField
(
pQueryInfo
,
k
);
memcpy
(
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
i
)
*
totalNumOfResults
+
pField
->
bytes
*
rowIdx
,
&
pMetricMeta
->
numOf
Meters
,
sizeof
(
pMetricMeta
->
numOfMeter
s
));
&
pMetricMeta
->
numOf
Tables
,
sizeof
(
pMetricMeta
->
numOfTable
s
));
}
else
{
tscError
(
"not support operations"
);
continue
;
...
...
@@ -368,7 +368,7 @@ static int tscProcessQueryTags(SSqlObj *pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
S
Meter
Meta
*
pMeterMeta
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
0
)
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
0
)
->
pMeterMeta
;
if
(
pMeterMeta
==
NULL
||
pMeterMeta
->
numOfTags
==
0
||
pMeterMeta
->
numOfColumns
==
0
)
{
strcpy
(
pCmd
->
payload
,
"invalid table"
);
pSql
->
res
.
code
=
TSDB_CODE_INVALID_TABLE
;
...
...
This diff is collapsed.
Click to expand it.
src/client/src/tscParseInsert.c
浏览文件 @
7cedf4af
...
...
@@ -496,7 +496,7 @@ static int32_t rowDataCompar(const void *lhs, const void *rhs) {
}
}
int
tsParseValues
(
char
**
str
,
STableDataBlocks
*
pDataBlock
,
S
Meter
Meta
*
pMeterMeta
,
int
maxRows
,
int
tsParseValues
(
char
**
str
,
STableDataBlocks
*
pDataBlock
,
S
Table
Meta
*
pMeterMeta
,
int
maxRows
,
SParsedDataColInfo
*
spd
,
char
*
error
,
int32_t
*
code
,
char
*
tmpTokenBuf
)
{
int32_t
index
=
0
;
SSQLToken
sToken
;
...
...
@@ -601,7 +601,7 @@ int32_t tscAllocateMemIfNeed(STableDataBlocks *pDataBlock, int32_t rowSize, int3
return
TSDB_CODE_SUCCESS
;
}
static
void
tsSetBlockInfo
(
SShellSubmitBlock
*
pBlocks
,
const
S
Meter
Meta
*
pMeterMeta
,
int32_t
numOfRows
)
{
static
void
tsSetBlockInfo
(
SShellSubmitBlock
*
pBlocks
,
const
S
Table
Meta
*
pMeterMeta
,
int32_t
numOfRows
)
{
pBlocks
->
sid
=
pMeterMeta
->
sid
;
pBlocks
->
uid
=
pMeterMeta
->
uid
;
pBlocks
->
sversion
=
pMeterMeta
->
sversion
;
...
...
@@ -655,7 +655,7 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableHashList, char
int32_t
*
totalNum
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
STableDataBlocks
*
dataBuf
=
NULL
;
int32_t
ret
=
tscGetDataBlockFromList
(
pTableHashList
,
pCmd
->
pDataBlocks
,
pMeterMeta
->
uid
,
TSDB_DEFAULT_PAYLOAD_SIZE
,
...
...
@@ -695,7 +695,7 @@ static int32_t doParseInsertStatement(SSqlObj *pSql, void *pTableHashList, char
tsSetBlockInfo
(
pBlocks
,
pMeterMeta
,
numOfRows
);
dataBuf
->
vgid
=
pMeterMeta
->
vgid
;
dataBuf
->
numOf
Meter
s
=
1
;
dataBuf
->
numOf
Table
s
=
1
;
/*
* the value of pRes->numOfRows does not affect the true result of AFFECTED ROWS,
...
...
@@ -1136,7 +1136,7 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
wordfree
(
&
full_path
);
STableDataBlocks
*
pDataBlock
=
NULL
;
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
int32_t
ret
=
tscCreateDataBlock
(
PATH_MAX
,
pMeterMeta
->
rowSize
,
sizeof
(
SShellSubmitBlock
),
pMeterMetaInfo
->
name
,
pMeterMeta
,
&
pDataBlock
);
...
...
@@ -1148,7 +1148,7 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
strcpy
(
pDataBlock
->
filename
,
fname
);
}
else
if
(
sToken
.
type
==
TK_LP
)
{
/* insert into tablename(col1, col2,..., coln) values(v1, v2,... vn); */
S
Meter
Meta
*
pMeterMeta
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
)
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
)
->
pMeterMeta
;
SSchema
*
pSchema
=
tsGetSchema
(
pMeterMeta
);
if
(
validateDataSource
(
pCmd
,
DATA_FROM_SQL_STRING
,
sToken
.
z
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -1349,7 +1349,7 @@ static int doPackSendDataBlock(SSqlObj *pSql, int32_t numOfRows, STableDataBlock
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
assert
(
pCmd
->
numOfClause
==
1
);
S
Meter
Meta
*
pMeterMeta
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
)
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
)
->
pMeterMeta
;
SShellSubmitBlock
*
pBlocks
=
(
SShellSubmitBlock
*
)(
pTableDataBlocks
->
pData
);
tsSetBlockInfo
(
pBlocks
,
pMeterMeta
,
numOfRows
);
...
...
@@ -1383,7 +1383,7 @@ static int tscInsertDataFromFile(SSqlObj *pSql, FILE *fp, char *tmpTokenBuf) {
int
nrows
=
0
;
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
assert
(
pCmd
->
numOfClause
==
1
);
int32_t
rowSize
=
pMeterMeta
->
rowSize
;
...
...
This diff is collapsed.
Click to expand it.
src/client/src/tscSQLParser.c
浏览文件 @
7cedf4af
...
...
@@ -883,7 +883,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
assert
(
pCmd
->
numOfClause
==
1
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
// no more than 6 tags
if
(
pMeterMeta
->
numOfTags
==
TSDB_MAX_TAGS
)
{
...
...
@@ -953,7 +953,7 @@ bool validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) {
assert
(
pCmd
->
numOfClause
==
1
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
// no more max columns
if
(
pMeterMeta
->
numOfColumns
>=
TSDB_MAX_COLUMNS
||
...
...
@@ -1215,7 +1215,7 @@ int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnLi
SSqlExpr
*
doAddProjectCol
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputIndex
,
int32_t
colIdx
,
int32_t
tableIndex
)
{
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
tableIndex
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
SSchema
*
pSchema
=
tsGetColumnSchema
(
pMeterMeta
,
colIdx
);
int32_t
numOfCols
=
pMeterMeta
->
numOfColumns
;
...
...
@@ -1267,7 +1267,7 @@ static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumn
SSqlExpr
*
pExpr
=
doAddProjectCol
(
pQueryInfo
,
startPos
,
pIndex
->
columnIndex
,
pIndex
->
tableIndex
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
pIndex
->
tableIndex
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
SSchema
*
pSchema
=
tsGetColumnSchema
(
pMeterMeta
,
pIndex
->
columnIndex
);
...
...
@@ -1306,7 +1306,7 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
pIndex
->
tableIndex
);
int32_t
numOfTotalColumns
=
0
;
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
SSchema
*
pSchema
=
tsGetSchema
(
pMeterMeta
);
if
(
UTIL_METER_IS_SUPERTABLE
(
pMeterMetaInfo
))
{
...
...
@@ -1368,7 +1368,7 @@ int32_t addProjectionExprAndResultField(SQueryInfo* pQueryInfo, tSQLExprItem* pI
tscAddSpecialColumnForSelect
(
pQueryInfo
,
startPos
,
TSDB_FUNC_TAGPRJ
,
&
index
,
&
colSchema
,
true
);
}
else
{
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
index
.
tableIndex
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
if
(
index
.
columnIndex
>=
pMeterMeta
->
numOfColumns
&&
UTIL_METER_IS_NOMRAL_METER
(
pMeterMetaInfo
))
{
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg1
);
...
...
@@ -1835,7 +1835,7 @@ static bool isTablenameToken(SSQLToken* token) {
}
static
int16_t
doGetColumnIndex
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
SSQLToken
*
pToken
)
{
S
Meter
Meta
*
pMeterMeta
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
index
)
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
index
)
->
pMeterMeta
;
int32_t
numOfCols
=
pMeterMeta
->
numOfColumns
+
pMeterMeta
->
numOfTags
;
SSchema
*
pSchema
=
tsGetSchema
(
pMeterMeta
);
...
...
@@ -2360,7 +2360,7 @@ int32_t parseGroupbyClause(SQueryInfo* pQueryInfo, tVariantList* pList, SSqlCmd*
return
invalidSqlErrMsg
(
pQueryInfo
->
msg
,
msg1
);
}
S
Meter
Meta
*
pMeterMeta
=
NULL
;
S
Table
Meta
*
pMeterMeta
=
NULL
;
SSchema
*
pSchema
=
NULL
;
SSchema
s
=
tsGetTbnameColumnSchema
();
...
...
@@ -2704,7 +2704,7 @@ enum {
static
int32_t
extractColumnFilterInfo
(
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
,
tSQLExpr
*
pExpr
,
int32_t
sqlOptr
)
{
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
pIndex
->
tableIndex
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
SSchema
*
pSchema
=
tsGetColumnSchema
(
pMeterMeta
,
pIndex
->
columnIndex
);
const
char
*
msg1
=
"non binary column not support like operator"
;
...
...
@@ -2927,7 +2927,7 @@ static int32_t validateSQLExpr(tSQLExpr* pExpr, SQueryInfo* pQueryInfo, SColumnL
}
// if column is timestamp, bool, binary, nchar, not support arithmetic, so return invalid sql
S
Meter
Meta
*
pMeterMeta
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
index
.
tableIndex
)
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
index
.
tableIndex
)
->
pMeterMeta
;
SSchema
*
pSchema
=
tsGetSchema
(
pMeterMeta
)
+
index
.
columnIndex
;
if
((
pSchema
->
type
==
TSDB_DATA_TYPE_TIMESTAMP
)
||
(
pSchema
->
type
==
TSDB_DATA_TYPE_BOOL
)
||
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
)
||
(
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)){
...
...
@@ -3140,7 +3140,7 @@ static int32_t handleExprInQueryCond(SQueryInfo* pQueryInfo, tSQLExpr** pExpr, S
assert
(
isExprDirectParentOfLeaftNode
(
*
pExpr
));
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
index
.
tableIndex
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
if
(
index
.
columnIndex
==
PRIMARYKEY_TIMESTAMP_COL_INDEX
)
{
// query on time range
if
(
!
validateJoinExprNode
(
pQueryInfo
,
*
pExpr
,
&
index
))
{
...
...
@@ -3485,7 +3485,7 @@ static int32_t getTimeRangeFromExpr(SQueryInfo* pQueryInfo, tSQLExpr* pExpr) {
}
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfoFromQueryInfo
(
pQueryInfo
,
index
.
tableIndex
);
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
tSQLExpr
*
pRight
=
pExpr
->
pRight
;
...
...
@@ -4086,7 +4086,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return
ret
;
}
S
Meter
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
S
Table
Meta
*
pMeterMeta
=
pMeterMetaInfo
->
pMeterMeta
;
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_ADD_TAG_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_DROP_TAG_COLUMN
||
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN
)
{
...
...
@@ -4534,8 +4534,8 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
}
// No tables included. No results generated. Query results are empty.
S
Metric
Meta
*
pMetricMeta
=
pMeterMetaInfo
->
pMetricMeta
;
if
(
pMeterMetaInfo
->
pMeterMeta
==
NULL
||
pMetricMeta
==
NULL
||
pMetricMeta
->
numOf
Meter
s
==
0
)
{
S
SuperTable
Meta
*
pMetricMeta
=
pMeterMetaInfo
->
pMetricMeta
;
if
(
pMeterMetaInfo
->
pMeterMeta
==
NULL
||
pMetricMeta
==
NULL
||
pMetricMeta
->
numOf
Table
s
==
0
)
{
tscTrace
(
"%p no table in metricmeta, no output result"
,
pSql
);
pQueryInfo
->
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
}
...
...
@@ -4629,7 +4629,7 @@ static int32_t setTimePrecisionOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreate
}
static
void
setCreateDBOption
(
SCreateDbMsg
*
pMsg
,
SCreateDBInfo
*
pCreateDb
)
{
pMsg
->
blocksPer
Meter
=
htons
(
pCreateDb
->
numOfBlocksPerTable
);
pMsg
->
blocksPer
Table
=
htons
(
pCreateDb
->
numOfBlocksPerTable
);
pMsg
->
compression
=
pCreateDb
->
compressionLevel
;
pMsg
->
commitLog
=
(
char
)
pCreateDb
->
commitLog
;
...
...
This diff is collapsed.
Click to expand it.
src/client/src/tscSchemaUtil.c
浏览文件 @
7cedf4af
...
...
@@ -64,14 +64,14 @@ bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols) {
return
(
rowLen
<=
TSDB_MAX_BYTES_PER_ROW
);
}
struct
SSchema
*
tsGetSchema
(
S
Meter
Meta
*
pMeta
)
{
struct
SSchema
*
tsGetSchema
(
S
Table
Meta
*
pMeta
)
{
if
(
pMeta
==
NULL
)
{
return
NULL
;
}
return
tsGetColumnSchema
(
pMeta
,
0
);
}
struct
SSchema
*
tsGetTagSchema
(
S
Meter
Meta
*
pMeta
)
{
struct
SSchema
*
tsGetTagSchema
(
S
Table
Meta
*
pMeta
)
{
if
(
pMeta
==
NULL
||
pMeta
->
numOfTags
==
0
)
{
return
NULL
;
}
...
...
@@ -79,8 +79,8 @@ struct SSchema* tsGetTagSchema(SMeterMeta* pMeta) {
return
tsGetColumnSchema
(
pMeta
,
pMeta
->
numOfColumns
);
}
struct
SSchema
*
tsGetColumnSchema
(
S
Meter
Meta
*
pMeta
,
int32_t
startCol
)
{
return
(
SSchema
*
)(((
char
*
)
pMeta
+
sizeof
(
S
Meter
Meta
))
+
startCol
*
sizeof
(
SSchema
));
struct
SSchema
*
tsGetColumnSchema
(
S
Table
Meta
*
pMeta
,
int32_t
startCol
)
{
return
(
SSchema
*
)(((
char
*
)
pMeta
+
sizeof
(
S
Table
Meta
))
+
startCol
*
sizeof
(
SSchema
));
}
struct
SSchema
tsGetTbnameColumnSchema
()
{
...
...
@@ -94,7 +94,7 @@ struct SSchema tsGetTbnameColumnSchema() {
* the MeterMeta data format in memory is as follows:
*
* +--------------------+
* |S
MeterMeta Body data| sizeof(SMeter
Meta)
* |S
TableMeta Body data| sizeof(STable
Meta)
* +--------------------+
* |Schema data | numOfTotalColumns * sizeof(SSchema)
* +--------------------+
...
...
@@ -104,14 +104,14 @@ struct SSchema tsGetTbnameColumnSchema() {
* @param pMeta
* @return
*/
char
*
tsGetTagsValue
(
S
Meter
Meta
*
pMeta
)
{
char
*
tsGetTagsValue
(
S
Table
Meta
*
pMeta
)
{
int32_t
numOfTotalCols
=
pMeta
->
numOfColumns
+
pMeta
->
numOfTags
;
uint32_t
offset
=
sizeof
(
S
Meter
Meta
)
+
numOfTotalCols
*
sizeof
(
SSchema
);
uint32_t
offset
=
sizeof
(
S
Table
Meta
)
+
numOfTotalCols
*
sizeof
(
SSchema
);
return
((
char
*
)
pMeta
+
offset
);
}
bool
tsMeterMetaIdentical
(
S
MeterMeta
*
p1
,
SMeter
Meta
*
p2
)
{
bool
tsMeterMetaIdentical
(
S
TableMeta
*
p1
,
STable
Meta
*
p2
)
{
if
(
p1
==
NULL
||
p2
==
NULL
||
p1
->
uid
!=
p2
->
uid
||
p1
->
sversion
!=
p2
->
sversion
)
{
return
false
;
}
...
...
@@ -120,7 +120,7 @@ bool tsMeterMetaIdentical(SMeterMeta* p1, SMeterMeta* p2) {
return
true
;
}
size_t
size
=
sizeof
(
S
Meter
Meta
)
+
p1
->
numOfColumns
*
sizeof
(
SSchema
);
size_t
size
=
sizeof
(
S
Table
Meta
)
+
p1
->
numOfColumns
*
sizeof
(
SSchema
);
for
(
int32_t
i
=
0
;
i
<
p1
->
numOfTags
;
++
i
)
{
SSchema
*
pColSchema
=
tsGetColumnSchema
(
p1
,
i
+
p1
->
numOfColumns
);
...
...
@@ -151,16 +151,16 @@ static FORCE_INLINE size_t copy(char* dst, const char* src, char delimiter) {
/**
* extract table name from meterid, which the format of userid.dbname.metername
* @param
meter
Id
* @param
table
Id
* @return
*/
void
extractTableName
(
char
*
meter
Id
,
char
*
name
)
{
char
*
r
=
skipSegments
(
meter
Id
,
TS_PATH_DELIMITER
[
0
],
2
);
void
extractTableName
(
char
*
table
Id
,
char
*
name
)
{
char
*
r
=
skipSegments
(
table
Id
,
TS_PATH_DELIMITER
[
0
],
2
);
copy
(
name
,
r
,
TS_PATH_DELIMITER
[
0
]);
}
SSQLToken
extractDBName
(
char
*
meter
Id
,
char
*
name
)
{
char
*
r
=
skipSegments
(
meter
Id
,
TS_PATH_DELIMITER
[
0
],
1
);
SSQLToken
extractDBName
(
char
*
table
Id
,
char
*
name
)
{
char
*
r
=
skipSegments
(
table
Id
,
TS_PATH_DELIMITER
[
0
],
1
);
size_t
len
=
copy
(
name
,
r
,
TS_PATH_DELIMITER
[
0
]);
SSQLToken
token
=
{.
z
=
name
,
.
n
=
len
,
.
type
=
TK_STRING
};
...
...
This diff is collapsed.
Click to expand it.
src/client/src/tscServer.c
浏览文件 @
7cedf4af
此差异已折叠。
点击以展开。
src/client/src/tscSub.c
浏览文件 @
7cedf4af
...
...
@@ -44,7 +44,7 @@ typedef struct SSub {
int
interval
;
TAOS_SUBSCRIBE_CALLBACK
fp
;
void
*
param
;
int
numOf
Meter
s
;
int
numOf
Table
s
;
SSubscriptionProgress
*
progress
;
}
SSub
;
...
...
@@ -62,7 +62,7 @@ TSKEY tscGetSubscriptionProgress(void* sub, int64_t uid) {
return
0
;
SSub
*
pSub
=
(
SSub
*
)
sub
;
for
(
int
s
=
0
,
e
=
pSub
->
numOf
Meter
s
;
s
<
e
;)
{
for
(
int
s
=
0
,
e
=
pSub
->
numOf
Table
s
;
s
<
e
;)
{
int
m
=
(
s
+
e
)
/
2
;
SSubscriptionProgress
*
p
=
pSub
->
progress
+
m
;
if
(
p
->
uid
>
uid
)
...
...
@@ -81,7 +81,7 @@ void tscUpdateSubscriptionProgress(void* sub, int64_t uid, TSKEY ts) {
return
;
SSub
*
pSub
=
(
SSub
*
)
sub
;
for
(
int
s
=
0
,
e
=
pSub
->
numOf
Meter
s
;
s
<
e
;)
{
for
(
int
s
=
0
,
e
=
pSub
->
numOf
Table
s
;
s
<
e
;)
{
int
m
=
(
s
+
e
)
/
2
;
SSubscriptionProgress
*
p
=
pSub
->
progress
+
m
;
if
(
p
->
uid
>
uid
)
...
...
@@ -176,43 +176,43 @@ int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
}
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
0
,
0
);
int
numOf
Meter
s
=
0
;
int
numOf
Table
s
=
0
;
if
(
!
UTIL_METER_IS_NOMRAL_METER
(
pMeterMetaInfo
))
{
S
Metric
Meta
*
pMetricMeta
=
pMeterMetaInfo
->
pMetricMeta
;
S
SuperTable
Meta
*
pMetricMeta
=
pMeterMetaInfo
->
pMetricMeta
;
for
(
int32_t
i
=
0
;
i
<
pMetricMeta
->
numOfVnodes
;
i
++
)
{
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
i
);
numOf
Meter
s
+=
pVnodeSidList
->
numOfSids
;
numOf
Table
s
+=
pVnodeSidList
->
numOfSids
;
}
}
SSubscriptionProgress
*
progress
=
(
SSubscriptionProgress
*
)
calloc
(
numOf
Meter
s
,
sizeof
(
SSubscriptionProgress
));
SSubscriptionProgress
*
progress
=
(
SSubscriptionProgress
*
)
calloc
(
numOf
Table
s
,
sizeof
(
SSubscriptionProgress
));
if
(
progress
==
NULL
)
{
tscError
(
"failed to allocate memory for progress: %s"
,
pSub
->
topic
);
return
0
;
}
if
(
UTIL_METER_IS_NOMRAL_METER
(
pMeterMetaInfo
))
{
numOf
Meter
s
=
1
;
numOf
Table
s
=
1
;
int64_t
uid
=
pMeterMetaInfo
->
pMeterMeta
->
uid
;
progress
[
0
].
uid
=
uid
;
progress
[
0
].
key
=
tscGetSubscriptionProgress
(
pSub
,
uid
);
}
else
{
S
Metric
Meta
*
pMetricMeta
=
pMeterMetaInfo
->
pMetricMeta
;
numOf
Meter
s
=
0
;
S
SuperTable
Meta
*
pMetricMeta
=
pMeterMetaInfo
->
pMetricMeta
;
numOf
Table
s
=
0
;
for
(
int32_t
i
=
0
;
i
<
pMetricMeta
->
numOfVnodes
;
i
++
)
{
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
i
);
for
(
int32_t
j
=
0
;
j
<
pVnodeSidList
->
numOfSids
;
j
++
)
{
S
Meter
SidExtInfo
*
pMeterInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
j
);
S
Table
SidExtInfo
*
pMeterInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
j
);
int64_t
uid
=
pMeterInfo
->
uid
;
progress
[
numOf
Meter
s
].
uid
=
uid
;
progress
[
numOf
Meter
s
++
].
key
=
tscGetSubscriptionProgress
(
pSub
,
uid
);
progress
[
numOf
Table
s
].
uid
=
uid
;
progress
[
numOf
Table
s
++
].
key
=
tscGetSubscriptionProgress
(
pSub
,
uid
);
}
}
qsort
(
progress
,
numOf
Meter
s
,
sizeof
(
SSubscriptionProgress
),
tscCompareSubscriptionProgress
);
qsort
(
progress
,
numOf
Table
s
,
sizeof
(
SSubscriptionProgress
),
tscCompareSubscriptionProgress
);
}
free
(
pSub
->
progress
);
pSub
->
numOf
Meters
=
numOfMeter
s
;
pSub
->
numOf
Tables
=
numOfTable
s
;
pSub
->
progress
=
progress
;
pSub
->
lastSyncTime
=
taosGetTimestampMs
();
...
...
@@ -257,9 +257,9 @@ static int tscLoadSubscriptionProgress(SSub* pSub) {
return
0
;
}
int
numOf
Meter
s
=
atoi
(
buf
);
SSubscriptionProgress
*
progress
=
calloc
(
numOf
Meter
s
,
sizeof
(
SSubscriptionProgress
));
for
(
int
i
=
0
;
i
<
numOf
Meter
s
;
i
++
)
{
int
numOf
Table
s
=
atoi
(
buf
);
SSubscriptionProgress
*
progress
=
calloc
(
numOf
Table
s
,
sizeof
(
SSubscriptionProgress
));
for
(
int
i
=
0
;
i
<
numOf
Table
s
;
i
++
)
{
if
(
fgets
(
buf
,
sizeof
(
buf
),
fp
)
==
NULL
)
{
fclose
(
fp
);
free
(
progress
);
...
...
@@ -273,10 +273,10 @@ static int tscLoadSubscriptionProgress(SSub* pSub) {
fclose
(
fp
);
qsort
(
progress
,
numOf
Meter
s
,
sizeof
(
SSubscriptionProgress
),
tscCompareSubscriptionProgress
);
pSub
->
numOf
Meters
=
numOfMeter
s
;
qsort
(
progress
,
numOf
Table
s
,
sizeof
(
SSubscriptionProgress
),
tscCompareSubscriptionProgress
);
pSub
->
numOf
Tables
=
numOfTable
s
;
pSub
->
progress
=
progress
;
tscTrace
(
"subscription progress loaded, %d tables: %s"
,
numOf
Meter
s
,
pSub
->
topic
);
tscTrace
(
"subscription progress loaded, %d tables: %s"
,
numOf
Table
s
,
pSub
->
topic
);
return
1
;
}
...
...
@@ -297,8 +297,8 @@ void tscSaveSubscriptionProgress(void* sub) {
}
fputs
(
pSub
->
pSql
->
sqlstr
,
fp
);
fprintf
(
fp
,
"
\n
%d
\n
"
,
pSub
->
numOf
Meter
s
);
for
(
int
i
=
0
;
i
<
pSub
->
numOf
Meter
s
;
i
++
)
{
fprintf
(
fp
,
"
\n
%d
\n
"
,
pSub
->
numOf
Table
s
);
for
(
int
i
=
0
;
i
<
pSub
->
numOf
Table
s
;
i
++
)
{
int64_t
uid
=
pSub
->
progress
[
i
].
uid
;
TSKEY
key
=
pSub
->
progress
[
i
].
key
;
fprintf
(
fp
,
"%"
PRId64
":%"
PRId64
"
\n
"
,
uid
,
key
);
...
...
This diff is collapsed.
Click to expand it.
src/client/src/tscUtil.c
浏览文件 @
7cedf4af
...
...
@@ -170,13 +170,13 @@ void tscGetDBInfoFromMeterId(char* tableId, char* db) {
db
[
0
]
=
0
;
}
SVnodeSidList
*
tscGetVnodeSidList
(
S
Metric
Meta
*
pMetricmeta
,
int32_t
vnodeIdx
)
{
SVnodeSidList
*
tscGetVnodeSidList
(
S
SuperTable
Meta
*
pMetricmeta
,
int32_t
vnodeIdx
)
{
if
(
pMetricmeta
==
NULL
)
{
tscError
(
"illegal metricmeta"
);
return
0
;
}
if
(
pMetricmeta
->
numOfVnodes
==
0
||
pMetricmeta
->
numOf
Meter
s
==
0
)
{
if
(
pMetricmeta
->
numOfVnodes
==
0
||
pMetricmeta
->
numOf
Table
s
==
0
)
{
return
0
;
}
...
...
@@ -190,7 +190,7 @@ SVnodeSidList* tscGetVnodeSidList(SMetricMeta* pMetricmeta, int32_t vnodeIdx) {
return
(
SVnodeSidList
*
)(
pMetricmeta
->
list
[
vnodeIdx
]
+
(
char
*
)
pMetricmeta
);
}
S
Meter
SidExtInfo
*
tscGetMeterSidInfo
(
SVnodeSidList
*
pSidList
,
int32_t
idx
)
{
S
Table
SidExtInfo
*
tscGetMeterSidInfo
(
SVnodeSidList
*
pSidList
,
int32_t
idx
)
{
if
(
pSidList
==
NULL
)
{
tscError
(
"illegal sidlist"
);
return
0
;
...
...
@@ -202,7 +202,7 @@ SMeterSidExtInfo* tscGetMeterSidInfo(SVnodeSidList* pSidList, int32_t idx) {
tscError
(
"illegal sidIdx:%d, reset to 0, sidIdx range:%d-%d"
,
idx
,
0
,
sidRange
);
idx
=
0
;
}
return
(
S
Meter
SidExtInfo
*
)(
pSidList
->
pSidExtInfoList
[
idx
]
+
(
char
*
)
pSidList
);
return
(
S
Table
SidExtInfo
*
)(
pSidList
->
pSidExtInfoList
[
idx
]
+
(
char
*
)
pSidList
);
}
bool
tscIsTwoStageMergeMetricQuery
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
...
...
@@ -583,7 +583,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
assert
(
pDataBlock
->
pMeterMeta
!=
NULL
);
pCmd
->
numOfTablesInSubmit
=
pDataBlock
->
numOf
Meter
s
;
pCmd
->
numOfTablesInSubmit
=
pDataBlock
->
numOf
Table
s
;
assert
(
pCmd
->
numOfClause
==
1
);
SMeterMetaInfo
*
pMeterMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
...
...
@@ -639,7 +639,7 @@ void tscFreeUnusedDataBlocks(SDataBlockList* pList) {
* @return
*/
int32_t
tscCreateDataBlock
(
size_t
initialSize
,
int32_t
rowSize
,
int32_t
startOffset
,
const
char
*
name
,
S
Meter
Meta
*
pMeterMeta
,
STableDataBlocks
**
dataBlocks
)
{
S
Table
Meta
*
pMeterMeta
,
STableDataBlocks
**
dataBlocks
)
{
STableDataBlocks
*
dataBuf
=
(
STableDataBlocks
*
)
calloc
(
1
,
sizeof
(
STableDataBlocks
));
if
(
dataBuf
==
NULL
)
{
tscError
(
"failed to allocated memory, reason:%s"
,
strerror
(
errno
));
...
...
@@ -675,7 +675,7 @@ int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOff
}
int32_t
tscGetDataBlockFromList
(
void
*
pHashList
,
SDataBlockList
*
pDataBlockList
,
int64_t
id
,
int32_t
size
,
int32_t
startOffset
,
int32_t
rowSize
,
const
char
*
tableId
,
S
Meter
Meta
*
pMeterMeta
,
int32_t
startOffset
,
int32_t
rowSize
,
const
char
*
tableId
,
S
Table
Meta
*
pMeterMeta
,
STableDataBlocks
**
dataBlocks
)
{
*
dataBlocks
=
NULL
;
...
...
@@ -754,7 +754,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql, SDataBlockList* pTableDataBlockLi
memcpy
(
dataBuf
->
pData
+
dataBuf
->
size
,
pOneTableBlock
->
pData
,
pOneTableBlock
->
size
);
dataBuf
->
size
+=
pOneTableBlock
->
size
;
dataBuf
->
numOf
Meter
s
+=
1
;
dataBuf
->
numOf
Table
s
+=
1
;
}
tscDestroyBlockArrayList
(
pTableDataBlockList
);
...
...
@@ -1799,8 +1799,8 @@ void tscFreeSubqueryInfo(SSqlCmd* pCmd) {
tfree
(
pCmd
->
pQueryInfo
);
}
SMeterMetaInfo
*
tscAddMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
S
Meter
Meta
*
pMeterMeta
,
S
Metric
Meta
*
pMetricMeta
,
int16_t
numOfTags
,
int16_t
*
tags
)
{
SMeterMetaInfo
*
tscAddMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
S
Table
Meta
*
pMeterMeta
,
S
SuperTable
Meta
*
pMetricMeta
,
int16_t
numOfTags
,
int16_t
*
tags
)
{
void
*
pAlloc
=
realloc
(
pQueryInfo
->
pMeterInfo
,
(
pQueryInfo
->
numOfTables
+
1
)
*
POINTER_BYTES
);
if
(
pAlloc
==
NULL
)
{
return
NULL
;
...
...
@@ -1986,16 +1986,16 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
SMeterMetaInfo
*
pFinalInfo
=
NULL
;
if
(
pPrevSql
==
NULL
)
{
S
Meter
Meta
*
pMeterMeta
=
taosGetDataFromCache
(
tscCacheHandle
,
name
);
S
Metric
Meta
*
pMetricMeta
=
taosGetDataFromCache
(
tscCacheHandle
,
key
);
S
Table
Meta
*
pMeterMeta
=
taosGetDataFromCache
(
tscCacheHandle
,
name
);
S
SuperTable
Meta
*
pMetricMeta
=
taosGetDataFromCache
(
tscCacheHandle
,
key
);
pFinalInfo
=
tscAddMeterMetaInfo
(
pNewQueryInfo
,
name
,
pMeterMeta
,
pMetricMeta
,
pMeterMetaInfo
->
numOfTags
,
pMeterMetaInfo
->
tagColumnIndex
);
}
else
{
// transfer the ownership of pMeterMeta/pMetricMeta to the newly create sql object.
SMeterMetaInfo
*
pPrevInfo
=
tscGetMeterMetaInfo
(
&
pPrevSql
->
cmd
,
pPrevSql
->
cmd
.
clauseIndex
,
0
);
S
Meter
Meta
*
pPrevMeterMeta
=
taosTransferDataInCache
(
tscCacheHandle
,
(
void
**
)
&
pPrevInfo
->
pMeterMeta
);
S
Metric
Meta
*
pPrevMetricMeta
=
taosTransferDataInCache
(
tscCacheHandle
,
(
void
**
)
&
pPrevInfo
->
pMetricMeta
);
S
Table
Meta
*
pPrevMeterMeta
=
taosTransferDataInCache
(
tscCacheHandle
,
(
void
**
)
&
pPrevInfo
->
pMeterMeta
);
S
SuperTable
Meta
*
pPrevMetricMeta
=
taosTransferDataInCache
(
tscCacheHandle
,
(
void
**
)
&
pPrevInfo
->
pMetricMeta
);
pFinalInfo
=
tscAddMeterMetaInfo
(
pNewQueryInfo
,
name
,
pPrevMeterMeta
,
pPrevMetricMeta
,
pMeterMetaInfo
->
numOfTags
,
pMeterMetaInfo
->
tagColumnIndex
);
...
...
This diff is collapsed.
Click to expand it.
src/dnode/inc/dnodeRead.h
浏览文件 @
7cedf4af
...
...
@@ -38,18 +38,18 @@ void dnodeFreeQInfos();
/*
* handle query message, and the result is returned by callback function
*/
void
dnodeQueryData
(
SQuery
Meter
Msg
*
pQuery
,
void
*
pConn
,
void
(
*
callback
)(
int32_t
code
,
void
*
pQInfo
,
void
*
pConn
));
void
dnodeQueryData
(
SQuery
Table
Msg
*
pQuery
,
void
*
pConn
,
void
(
*
callback
)(
int32_t
code
,
void
*
pQInfo
,
void
*
pConn
));
/*
* Dispose retrieve msg, and the result will passed through callback function
*/
typedef
void
(
*
SDnodeRetrieveCallbackFp
)(
int32_t
code
,
void
*
pQInfo
,
void
*
pConn
);
void
dnodeRetrieveData
(
SRetrieve
Meter
Msg
*
pRetrieve
,
void
*
pConn
,
SDnodeRetrieveCallbackFp
callbackFp
);
void
dnodeRetrieveData
(
SRetrieve
Table
Msg
*
pRetrieve
,
void
*
pConn
,
SDnodeRetrieveCallbackFp
callbackFp
);
/*
* Fill retrieve result according to query info
*/
int32_t
dnodeGetRetrieveData
(
void
*
pQInfo
,
SRetrieve
Meter
Rsp
*
retrievalRsp
);
int32_t
dnodeGetRetrieveData
(
void
*
pQInfo
,
SRetrieve
Table
Rsp
*
retrievalRsp
);
/*
* Get the size of retrieve result according to query info
...
...
This diff is collapsed.
Click to expand it.
src/dnode/src/dnodeMgmt.c
浏览文件 @
7cedf4af
...
...
@@ -193,13 +193,13 @@ void dnodeSendVpeerCfgMsg(int32_t vnode) {
}
void
dnodeSendMeterCfgMsg
(
int32_t
vnode
,
int32_t
sid
)
{
S
MeterCfgMsg
*
cfg
=
(
SMeterCfgMsg
*
)
rpcMallocCont
(
sizeof
(
SMeter
CfgMsg
));
S
TableCfgMsg
*
cfg
=
(
STableCfgMsg
*
)
rpcMallocCont
(
sizeof
(
STable
CfgMsg
));
if
(
cfg
==
NULL
)
{
return
;
}
cfg
->
vnode
=
htonl
(
vnode
);
dnodeSendMsgToMnode
((
int8_t
*
)
cfg
,
sizeof
(
S
Meter
CfgMsg
),
TSDB_MSG_TYPE_TABLE_CFG
);
dnodeSendMsgToMnode
((
int8_t
*
)
cfg
,
sizeof
(
S
Table
CfgMsg
),
TSDB_MSG_TYPE_TABLE_CFG
);
}
void
dnodeInitProcessShellMsg
()
{
...
...
This diff is collapsed.
Click to expand it.
src/dnode/src/dnodeRead.c
浏览文件 @
7cedf4af
...
...
@@ -26,14 +26,14 @@ void dnodeFreeQInfo(void *pConn) {}
void
dnodeFreeQInfos
()
{}
void
dnodeQueryData
(
SQuery
Meter
Msg
*
pQuery
,
void
*
pConn
,
void
(
*
callback
)(
int32_t
code
,
void
*
pQInfo
,
void
*
pConn
))
{
void
dnodeQueryData
(
SQuery
Table
Msg
*
pQuery
,
void
*
pConn
,
void
(
*
callback
)(
int32_t
code
,
void
*
pQInfo
,
void
*
pConn
))
{
void
*
pQInfo
=
NULL
;
int
code
=
TSDB_CODE_SUCCESS
;
callback
(
code
,
pConn
,
pQInfo
);
}
static
void
dnodeExecuteRetrieveData
(
SSchedMsg
*
pSched
)
{
//SRetrieve
MeterMsg *pRetrieve = (SRetrieveMeter
Msg *)pSched->msg;
//SRetrieve
TableMsg *pRetrieve = (SRetrieveTable
Msg *)pSched->msg;
SDnodeRetrieveCallbackFp
callback
=
(
SDnodeRetrieveCallbackFp
)
pSched
->
thandle
;
void
*
pConn
=
pSched
->
ahandle
;
...
...
@@ -47,9 +47,9 @@ static void dnodeExecuteRetrieveData(SSchedMsg *pSched) {
free
(
pSched
->
msg
);
}
void
dnodeRetrieveData
(
SRetrieve
Meter
Msg
*
pRetrieve
,
void
*
pConn
,
SDnodeRetrieveCallbackFp
callbackFp
)
{
int8_t
*
msg
=
malloc
(
sizeof
(
SRetrieve
Meter
Msg
));
memcpy
(
msg
,
pRetrieve
,
sizeof
(
SRetrieve
Meter
Msg
));
void
dnodeRetrieveData
(
SRetrieve
Table
Msg
*
pRetrieve
,
void
*
pConn
,
SDnodeRetrieveCallbackFp
callbackFp
)
{
int8_t
*
msg
=
malloc
(
sizeof
(
SRetrieve
Table
Msg
));
memcpy
(
msg
,
pRetrieve
,
sizeof
(
SRetrieve
Table
Msg
));
SSchedMsg
schedMsg
;
schedMsg
.
msg
=
msg
;
...
...
@@ -59,7 +59,7 @@ void dnodeRetrieveData(SRetrieveMeterMsg *pRetrieve, void *pConn, SDnodeRetrieve
taosScheduleTask
(
tsQueryQhandle
,
&
schedMsg
);
}
int32_t
dnodeGetRetrieveData
(
void
*
pQInfo
,
SRetrieve
Meter
Rsp
*
retrievalRsp
)
{
int32_t
dnodeGetRetrieveData
(
void
*
pQInfo
,
SRetrieve
Table
Rsp
*
retrievalRsp
)
{
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
src/dnode/src/dnodeShell.c
浏览文件 @
7cedf4af
...
...
@@ -107,8 +107,8 @@ void dnodeCleanupShell() {
}
void
dnodeProcessQueryRequestCb
(
int
code
,
void
*
pQInfo
,
void
*
pConn
)
{
int32_t
contLen
=
sizeof
(
SQuery
Meter
Rsp
);
SQuery
MeterRsp
*
queryRsp
=
(
SQueryMeter
Rsp
*
)
rpcMallocCont
(
contLen
);
int32_t
contLen
=
sizeof
(
SQuery
Table
Rsp
);
SQuery
TableRsp
*
queryRsp
=
(
SQueryTable
Rsp
*
)
rpcMallocCont
(
contLen
);
if
(
queryRsp
==
NULL
)
{
return
;
}
...
...
@@ -125,7 +125,7 @@ static void dnodeProcessQueryRequest(int8_t *pCont, int32_t contLen, void *pConn
atomic_fetch_add_32
(
&
tsDnodeQueryReqNum
,
1
);
dTrace
(
"conn:%p, start to query data"
,
pConn
);
SQuery
MeterMsg
*
pQuery
=
(
SQueryMeter
Msg
*
)
pCont
;
SQuery
TableMsg
*
pQuery
=
(
SQueryTable
Msg
*
)
pCont
;
dnodeQueryData
(
pQuery
,
pConn
,
dnodeProcessQueryRequestCb
);
}
...
...
@@ -140,7 +140,7 @@ void dnodeProcessRetrieveRequestCb(int32_t code, void *pQInfo, void *pConn) {
assert
(
pQInfo
!=
NULL
);
int32_t
contLen
=
dnodeGetRetrieveDataSize
(
pQInfo
);
SRetrieve
MeterRsp
*
retrieveRsp
=
(
SRetrieveMeter
Rsp
*
)
rpcMallocCont
(
contLen
);
SRetrieve
TableRsp
*
retrieveRsp
=
(
SRetrieveTable
Rsp
*
)
rpcMallocCont
(
contLen
);
if
(
retrieveRsp
==
NULL
)
{
rpcSendResponse
(
pConn
,
TSDB_CODE_SERV_OUT_OF_MEMORY
,
0
,
0
);
return
;
...
...
@@ -162,7 +162,7 @@ void dnodeProcessRetrieveRequestCb(int32_t code, void *pQInfo, void *pConn) {
static
void
dnodeProcessRetrieveRequest
(
int8_t
*
pCont
,
int32_t
contLen
,
void
*
pConn
)
{
dTrace
(
"conn:%p, start to retrieve data"
,
pConn
);
SRetrieve
MeterMsg
*
pRetrieve
=
(
SRetrieveMeter
Msg
*
)
pCont
;
SRetrieve
TableMsg
*
pRetrieve
=
(
SRetrieveTable
Msg
*
)
pCont
;
dnodeRetrieveData
(
pRetrieve
,
pConn
,
dnodeProcessRetrieveRequestCb
);
}
...
...
This diff is collapsed.
Click to expand it.
src/inc/mnode.h
浏览文件 @
7cedf4af
...
...
@@ -102,14 +102,14 @@ typedef struct {
}
STableGid
;
typedef
struct
_tab_obj
{
char
meter
Id
[
TSDB_TABLE_ID_LEN
+
1
];
char
table
Id
[
TSDB_TABLE_ID_LEN
+
1
];
uint64_t
uid
;
STableGid
gid
;
int32_t
sversion
;
// schema version
int64_t
createdTime
;
int32_t
numOfTags
;
// for metric
int32_t
numOf
Meter
s
;
// for metric
int32_t
numOf
Table
s
;
// for metric
int32_t
numOfColumns
;
int32_t
schemaSize
;
short
nextColId
;
...
...
This diff is collapsed.
Click to expand it.
src/inc/taosmsg.h
浏览文件 @
7cedf4af
...
...
@@ -190,29 +190,6 @@ extern char *taosMsg[];
#pragma pack(push, 1)
typedef
struct
{
uint32_t
customerId
;
uint32_t
osId
;
uint32_t
appId
;
char
hwId
[
TSDB_UNI_LEN
];
char
hwVersion
[
TSDB_VERSION_LEN
];
char
osVersion
[
TSDB_VERSION_LEN
];
char
appVersion
[
TSDB_VERSION_LEN
];
char
sdkVersion
[
TSDB_VERSION_LEN
];
char
name
[
TSDB_UNI_LEN
];
char
street
[
TSDB_STREET_LEN
];
char
city
[
TSDB_CITY_LEN
];
char
state
[
TSDB_STATE_LEN
];
char
country
[
TSDB_COUNTRY_LEN
];
uint32_t
longitude
;
uint32_t
latitude
;
}
SRegMsg
;
typedef
struct
{
short
numOfRows
;
char
payLoad
[];
}
SSubmitMsg
;
typedef
struct
{
int32_t
vnode
;
int32_t
sid
;
...
...
@@ -226,7 +203,7 @@ typedef struct {
int8_t
import
;
int8_t
reserved
[
3
];
int32_t
numOfSid
;
/* total number of sid */
char
blks
[];
/* numOfSid blocks, each blocks for one
meter
*/
char
blks
[];
/* numOfSid blocks, each blocks for one
table
*/
}
SShellSubmitMsg
;
typedef
struct
{
...
...
@@ -360,7 +337,7 @@ typedef struct SColIndexEx {
/*
* colIdx is the index of column in latest schema of table
* it is available in the client side. Also used to determine
* whether current
meter
schema is up-to-date.
* whether current
table
schema is up-to-date.
*
* colIdxInBuf is used to denote the index of column in pQuery->colList,
* this value is invalid in client side, as well as in cache block of vnode either.
...
...
@@ -438,22 +415,22 @@ typedef struct SColumnInfo {
/*
* enable vnode to understand how to group several tables with different tag;
*/
typedef
struct
S
Meter
SidExtInfo
{
typedef
struct
S
Table
SidExtInfo
{
int32_t
sid
;
int64_t
uid
;
TSKEY
key
;
// key for subscription
char
tags
[];
}
S
Meter
SidExtInfo
;
}
S
Table
SidExtInfo
;
/*
* the outputCols is equalled to or larger than numOfCols
* e.g., select min(colName), max(colName), avg(colName) from
meter_nam
e
* e.g., select min(colName), max(colName), avg(colName) from
tabl
e
* the outputCols will be 3 while the numOfCols is 1.
*/
typedef
struct
{
int16_t
vnode
;
int32_t
numOfSids
;
uint64_t
pSidExtInfo
;
//
meter
id & tag info ptr, in windows pointer may
uint64_t
pSidExtInfo
;
//
table
id & tag info ptr, in windows pointer may
uint64_t
uid
;
TSKEY
skey
;
...
...
@@ -498,26 +475,17 @@ typedef struct {
int32_t
tsNumOfBlocks
;
// ts comp block numbers
int32_t
tsOrder
;
// ts comp block order
SColumnInfo
colList
[];
}
SQuery
Meter
Msg
;
}
SQuery
Table
Msg
;
typedef
struct
{
char
code
;
uint64_t
qhandle
;
}
SQueryMeterRsp
;
typedef
struct
{
TSKEY
skey
;
TSKEY
ekey
;
int32_t
num
;
short
order
;
short
numOfCols
;
short
colList
[];
}
SQueryMsg
;
}
SQueryTableRsp
;
typedef
struct
{
uint64_t
qhandle
;
uint16_t
free
;
}
SRetrieve
Meter
Msg
;
}
SRetrieve
Table
Msg
;
typedef
struct
{
int32_t
numOfRows
;
...
...
@@ -525,7 +493,7 @@ typedef struct {
int64_t
offset
;
// updated offset value for multi-vnode projection query
int64_t
useconds
;
char
data
[];
}
SRetrieve
Meter
Rsp
;
}
SRetrieve
Table
Rsp
;
typedef
struct
{
uint32_t
vnode
;
...
...
@@ -564,7 +532,7 @@ typedef struct {
int32_t
daysToKeep
;
int32_t
commitTime
;
int32_t
rowsInFileBlock
;
int16_t
blocksPer
Meter
;
int16_t
blocksPer
Table
;
int8_t
compression
;
int8_t
commitLog
;
int8_t
replications
;
...
...
@@ -678,10 +646,10 @@ typedef struct {
int16_t
numOfGroupCols
;
// num of group by columns
int32_t
groupbyTagColumnList
;
}
S
Metric
MetaElemMsg
;
}
S
SuperTable
MetaElemMsg
;
typedef
struct
{
int32_t
numOf
Meter
s
;
int32_t
numOf
Table
s
;
int32_t
join
;
int32_t
joinCondLen
;
// for join condition
int32_t
metaElem
[
TSDB_MAX_JOIN_TABLE_NUM
];
...
...
@@ -691,17 +659,17 @@ typedef struct {
SVPeerDesc
vpeerDesc
[
TSDB_VNODES_SUPPORT
];
int16_t
index
;
// used locally
int32_t
numOfSids
;
int32_t
pSidExtInfoList
[];
// offset value of S
Meter
SidExtInfo
int32_t
pSidExtInfoList
[];
// offset value of S
Table
SidExtInfo
}
SVnodeSidList
;
typedef
struct
{
int32_t
numOf
Meter
s
;
int32_t
numOf
Table
s
;
int32_t
numOfVnodes
;
uint16_t
tagLen
;
/* tag value length */
int32_t
list
[];
/* offset of SVnodeSidList, compared to the S
Metric
Meta struct */
}
S
Metric
Meta
;
int32_t
list
[];
/* offset of SVnodeSidList, compared to the S
SuperTable
Meta struct */
}
S
SuperTable
Meta
;
typedef
struct
S
Meter
Meta
{
typedef
struct
S
Table
Meta
{
char
tableId
[
TSDB_TABLE_ID_LEN
];
// note: This field must be at the front
int32_t
contLen
;
uint8_t
numOfTags
:
6
;
...
...
@@ -716,13 +684,13 @@ typedef struct SMeterMeta {
int32_t
vgid
;
uint64_t
uid
;
SSchema
schema
[];
}
S
Meter
Meta
;
}
S
Table
Meta
;
typedef
struct
SMulti
Meter
Meta
{
typedef
struct
SMulti
Table
Meta
{
int32_t
numOfTables
;
int32_t
contLen
;
S
Meter
Meta
metas
[];
}
SMulti
Meter
Meta
;
S
Table
Meta
metas
[];
}
SMulti
Table
Meta
;
typedef
struct
{
char
name
[
TSDB_TABLE_ID_LEN
];
...
...
@@ -743,7 +711,7 @@ typedef struct {
typedef
struct
{
uint64_t
qhandle
;
S
MeterMeta
meter
Meta
;
S
TableMeta
table
Meta
;
}
SShowRsp
;
typedef
struct
{
...
...
@@ -753,7 +721,7 @@ typedef struct {
typedef
struct
{
int32_t
vnode
;
int32_t
sid
;
}
S
Meter
CfgMsg
;
}
S
Table
CfgMsg
;
typedef
struct
{
int32_t
vnode
;
...
...
This diff is collapsed.
Click to expand it.
src/inc/trpc.h
浏览文件 @
7cedf4af
...
...
@@ -65,7 +65,7 @@ typedef struct {
void
(
*
ufp
)(
void
*
ahandle
,
SRpcIpSet
*
pIpSet
);
// call back to retrieve the client auth info, for server app only
int
(
*
afp
)(
char
*
meterId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
int
(
*
afp
)(
char
*
tableId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
}
SRpcInit
;
void
*
rpcOpen
(
SRpcInit
*
pRpc
);
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtAcct.h
浏览文件 @
7cedf4af
...
...
@@ -33,7 +33,7 @@ extern SAcctObj* (*mgmtGetAcct)(char *acctName);
extern
int32_t
(
*
mgmtCheckUserLimit
)(
SAcctObj
*
pAcct
);
extern
int32_t
(
*
mgmtCheckDbLimit
)(
SAcctObj
*
pAcct
);
extern
int32_t
(
*
mgmtCheckTableLimit
)(
SAcctObj
*
pAcct
,
SCreateTableMsg
*
pCreate
);
extern
int32_t
(
*
mgmtGetAcctMeta
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
extern
int32_t
(
*
mgmtGetAcctMeta
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
extern
int32_t
(
*
mgmtRetrieveAccts
)(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
#ifdef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtChildTable.h
浏览文件 @
7cedf4af
...
...
@@ -37,7 +37,7 @@ int32_t mgmtAlterChildTable(SDbObj *pDb, SAlterTableMsg *pAlter);
int32_t
mgmtModifyChildTableTagValueByName
(
SChildTableObj
*
pTable
,
char
*
tagName
,
char
*
nContent
);
int8_t
*
mgmtBuildCreateChildTableMsg
(
SChildTableObj
*
pTable
,
SVgObj
*
pVgroup
);
int32_t
mgmtGetChildTableMeta
(
SDbObj
*
pDb
,
SChildTableObj
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
);
int32_t
mgmtGetChildTableMeta
(
SDbObj
*
pDb
,
SChildTableObj
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
);
#ifdef __cplusplus
}
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtConn.h
浏览文件 @
7cedf4af
...
...
@@ -22,7 +22,7 @@ extern "C" {
#include "mnode.h"
int
mgmtGetConnsMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int
mgmtGetConnsMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int
mgmtRetrieveConns
(
SShowObj
*
pShow
,
char
*
data
,
int
rows
,
void
*
pConn
);
bool
mgmtCheckQhandle
(
uint64_t
qhandle
);
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtDb.h
浏览文件 @
7cedf4af
...
...
@@ -29,7 +29,7 @@ int32_t mgmtAddVgroupIntoDbTail(SDbObj *pDb, SVgObj *pVgroup);
int32_t
mgmtRemoveVgroupFromDb
(
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
int32_t
mgmtMoveVgroupToTail
(
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
int32_t
mgmtMoveVgroupToHead
(
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
int32_t
mgmtGetDbMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetDbMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveDbs
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
void
mgmtCleanUpDbs
();
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtDnode.h
浏览文件 @
7cedf4af
...
...
@@ -30,18 +30,18 @@ int32_t mgmtDropDnodeByIp(uint32_t ip);
int32_t
mgmtGetNextVnode
(
SVnodeGid
*
pVnodeGid
);
void
mgmtSetDnodeVgid
(
SVnodeGid
vnodeGid
[],
int32_t
numOfVnodes
,
int32_t
vgId
);
void
mgmtUnSetDnodeVgid
(
SVnodeGid
vnodeGid
[],
int32_t
numOfVnodes
);
int32_t
mgmtGetDnodeMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetDnodeMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveDnodes
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
int32_t
mgmtSendCfgDnodeMsg
(
char
*
cont
);
void
mgmtSetDnodeMaxVnodes
(
SDnodeObj
*
pDnode
);
int32_t
mgmtGetConfigMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetConfigMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveConfigs
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
int32_t
mgmtGetModuleMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetModuleMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveModules
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
int32_t
mgmtGetVnodeMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetVnodeMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveVnodes
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
extern
int32_t
(
*
mgmtInitDnodes
)();
...
...
@@ -51,7 +51,7 @@ extern int32_t (*mgmtGetDnodesNum)();
extern
void
*
(
*
mgmtGetNextDnode
)(
SShowObj
*
pShow
,
SDnodeObj
**
pDnode
);
extern
int32_t
(
*
mgmtUpdateDnode
)(
SDnodeObj
*
pDnode
);
extern
void
(
*
mgmtSetDnodeUnRemove
)(
SDnodeObj
*
pDnode
);
extern
int32_t
(
*
mgmtGetScoresMeta
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
extern
int32_t
(
*
mgmtGetScoresMeta
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
extern
int32_t
(
*
mgmtRetrieveScores
)(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
extern
bool
(
*
mgmtCheckConfigShow
)(
SGlobalConfig
*
cfg
);
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtGrant.h
浏览文件 @
7cedf4af
...
...
@@ -30,7 +30,7 @@ extern void (*mgmtRestoreTimeSeries)(uint32_t timeseries);
extern
int32_t
(
*
mgmtCheckTimeSeries
)(
uint32_t
timeseries
);
extern
int32_t
(
*
mgmtCheckUserGrant
)();
extern
int32_t
(
*
mgmtCheckDbGrant
)();
extern
int32_t
(
*
mgmtGetGrantsMeta
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
extern
int32_t
(
*
mgmtGetGrantsMeta
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
extern
int32_t
(
*
mgmtRetrieveGrants
)(
SShowObj
*
pShow
,
char
*
data
,
int
rows
,
void
*
pConn
);
#ifdef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtMnode.h
浏览文件 @
7cedf4af
...
...
@@ -24,7 +24,7 @@ extern "C" {
#include <stdbool.h>
#include "mnode.h"
extern
int32_t
(
*
mgmtGetMnodeMeta
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
extern
int32_t
(
*
mgmtGetMnodeMeta
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
extern
int32_t
(
*
mgmtRetrieveMnodes
)(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
#ifdef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtNormalTable.h
浏览文件 @
7cedf4af
...
...
@@ -35,7 +35,7 @@ int32_t mgmtAddNormalTableColumn(SNormalTableObj *pTable, SSchema schema[], int3
int32_t
mgmtDropNormalTableColumnByName
(
SNormalTableObj
*
pTable
,
char
*
colName
);
int8_t
*
mgmtBuildCreateNormalTableMsg
(
SNormalTableObj
*
pTable
);
int32_t
mgmtGetNormalTableMeta
(
SDbObj
*
pDb
,
SNormalTableObj
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
);
int32_t
mgmtGetNormalTableMeta
(
SDbObj
*
pDb
,
SNormalTableObj
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
);
#ifdef __cplusplus
}
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtProfile.h
浏览文件 @
7cedf4af
...
...
@@ -22,9 +22,9 @@ extern "C" {
#include "mnode.h"
int32_t
mgmtGetQueryMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetQueryMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetStreamMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetStreamMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveQueries
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtStreamTable.h
浏览文件 @
7cedf4af
...
...
@@ -34,7 +34,7 @@ int32_t mgmtDropStreamTable(SDbObj *pDb, SStreamTableObj *pTable);
int32_t
mgmtAlterStreamTable
(
SDbObj
*
pDb
,
SAlterTableMsg
*
pAlter
);
int8_t
*
mgmtBuildCreateStreamTableMsg
(
SStreamTableObj
*
pTable
,
SVgObj
*
pVgroup
);
int32_t
mgmtGetStreamTableMeta
(
SDbObj
*
pDb
,
SStreamTableObj
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
);
int32_t
mgmtGetStreamTableMeta
(
SDbObj
*
pDb
,
SStreamTableObj
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
);
#ifdef __cplusplus
}
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtSuperTable.h
浏览文件 @
7cedf4af
...
...
@@ -30,7 +30,7 @@ int32_t mgmtInitSuperTables();
void
mgmtCleanUpSuperTables
();
void
*
mgmtGetSuperTable
(
char
*
tableId
);
int32_t
mgmtGetShowSuperTableMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetShowSuperTableMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveShowSuperTables
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
int32_t
mgmtCreateSuperTable
(
SDbObj
*
pDb
,
SCreateTableMsg
*
pCreate
);
...
...
@@ -41,7 +41,7 @@ int32_t mgmtModifySuperTableTagNameByName(SSuperTableObj *pTable, char *oldTagNa
int32_t
mgmtAddSuperTableColumn
(
SSuperTableObj
*
pTable
,
SSchema
schema
[],
int32_t
ncols
);
int32_t
mgmtDropSuperTableColumnByName
(
SSuperTableObj
*
pTable
,
char
*
colName
);
int32_t
mgmtGetSuperTableMeta
(
SDbObj
*
pDb
,
SSuperTableObj
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
);
int32_t
mgmtGetSuperTableMeta
(
SDbObj
*
pDb
,
SSuperTableObj
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
);
int32_t
mgmtFindSuperTableTagIndex
(
SSuperTableObj
*
pTable
,
const
char
*
tagName
);
int32_t
mgmtSetSchemaFromSuperTable
(
SSchema
*
pSchema
,
SSuperTableObj
*
pTable
);
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtTable.h
浏览文件 @
7cedf4af
...
...
@@ -28,13 +28,13 @@ extern "C" {
int32_t
mgmtInitTables
();
STableInfo
*
mgmtGetTable
(
char
*
tableId
);
STableInfo
*
mgmtGetTableByPos
(
uint32_t
dnodeIp
,
int32_t
vnode
,
int32_t
sid
);
int32_t
mgmtGetTableMeta
(
SDbObj
*
pDb
,
STableInfo
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
);
int32_t
mgmtGetTableMeta
(
SDbObj
*
pDb
,
STableInfo
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
);
int32_t
mgmtRetrieveMetricMeta
(
void
*
pConn
,
char
**
pStart
,
SSuperTableMetaMsg
*
pInfo
);
int32_t
mgmtCreateTable
(
SDbObj
*
pDb
,
SCreateTableMsg
*
pCreate
);
int32_t
mgmtDropTable
(
SDbObj
*
pDb
,
char
*
meter
Id
,
int32_t
ignore
);
int32_t
mgmtDropTable
(
SDbObj
*
pDb
,
char
*
table
Id
,
int32_t
ignore
);
int32_t
mgmtAlterTable
(
SDbObj
*
pDb
,
SAlterTableMsg
*
pAlter
);
int32_t
mgmtGetShowTableMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetShowTableMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveShowTables
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
void
mgmtCleanUpMeters
();
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtUser.h
浏览文件 @
7cedf4af
...
...
@@ -29,7 +29,7 @@ SUserObj *mgmtGetUser(char *name);
int32_t
mgmtCreateUser
(
SAcctObj
*
pAcct
,
char
*
name
,
char
*
pass
);
int32_t
mgmtDropUser
(
SAcctObj
*
pAcct
,
char
*
name
);
int32_t
mgmtUpdateUser
(
SUserObj
*
pUser
);
int32_t
mgmtGetUserMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetUserMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveUsers
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
void
mgmtCleanUpUsers
();
SUserObj
*
mgmtGetUserFromConn
(
void
*
pConn
);
...
...
This diff is collapsed.
Click to expand it.
src/mnode/inc/mgmtVgroup.h
浏览文件 @
7cedf4af
...
...
@@ -29,7 +29,7 @@ SVgObj *mgmtGetVgroup(int32_t vgId);
SVgObj
*
mgmtCreateVgroup
(
SDbObj
*
pDb
);
int32_t
mgmtDropVgroup
(
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
void
mgmtSetVgroupIdPool
();
int32_t
mgmtGetVgroupMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtGetVgroupMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
int32_t
mgmtRetrieveVgroups
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
void
mgmtCleanUpVgroups
();
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtAcct.c
浏览文件 @
7cedf4af
...
...
@@ -144,11 +144,11 @@ static void mgmtCleanUpAcctsImp() {
void
(
*
mgmtCleanUpAccts
)()
=
mgmtCleanUpAcctsImp
;
static
int32_t
mgmtGetAcctMetaImp
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
static
int32_t
mgmtGetAcctMetaImp
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
int32_t
(
*
mgmtGetAcctMeta
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
mgmtGetAcctMetaImp
;
int32_t
(
*
mgmtGetAcctMeta
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
mgmtGetAcctMetaImp
;
static
int32_t
mgmtRetrieveAcctsImp
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
{
return
0
;
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtChildTable.c
浏览文件 @
7cedf4af
...
...
@@ -383,16 +383,16 @@ int32_t mgmtModifyChildTableTagValueByName(SChildTableObj *pTable, char *tagName
// if (pTable->isDirty) pTable->isDirty = 0;
//
// if (ret < 0) {
// mError("Failed to modify tag column %d of table %s", col, pTable->
meter
Id);
// mError("Failed to modify tag column %d of table %s", col, pTable->
table
Id);
// return TSDB_CODE_APP_ERROR;
// }
//
// mTrace("Succeed to modify tag column %d of table %s", col, pTable->
meter
Id);
// mTrace("Succeed to modify tag column %d of table %s", col, pTable->
table
Id);
// return TSDB_CODE_SUCCESS;
return
0
;
}
int32_t
mgmtGetChildTableMeta
(
SDbObj
*
pDb
,
SChildTableObj
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
)
{
int32_t
mgmtGetChildTableMeta
(
SDbObj
*
pDb
,
SChildTableObj
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
)
{
pMeta
->
uid
=
htobe64
(
pTable
->
uid
);
pMeta
->
sid
=
htonl
(
pTable
->
sid
);
pMeta
->
vgid
=
htonl
(
pTable
->
vgId
);
...
...
@@ -401,7 +401,7 @@ int32_t mgmtGetChildTableMeta(SDbObj *pDb, SChildTableObj *pTable, SMeterMeta *p
pMeta
->
numOfTags
=
pTable
->
superTable
->
numOfTags
;
pMeta
->
numOfColumns
=
htons
(
pTable
->
superTable
->
numOfColumns
);
pMeta
->
tableType
=
pTable
->
type
;
pMeta
->
contLen
=
sizeof
(
S
Meter
Meta
)
+
mgmtSetSchemaFromSuperTable
(
pMeta
->
schema
,
pTable
->
superTable
);
pMeta
->
contLen
=
sizeof
(
S
Table
Meta
)
+
mgmtSetSchemaFromSuperTable
(
pMeta
->
schema
,
pTable
->
superTable
);
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtConn.c
浏览文件 @
7cedf4af
...
...
@@ -67,7 +67,7 @@ int mgmtGetConns(SShowObj *pShow, void *pConn) {
return
0
;
}
int
mgmtGetConnsMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int
mgmtGetConnsMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int
cols
=
0
;
pShow
->
bytes
[
cols
]
=
TSDB_METER_NAME_LEN
;
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtDb.c
浏览文件 @
7cedf4af
...
...
@@ -105,13 +105,13 @@ SDbObj *mgmtGetDb(char *db) {
return
(
SDbObj
*
)
sdbGetRow
(
tsDbSdb
,
db
);
}
SDbObj
*
mgmtGetDbByTableId
(
char
*
meter
Id
)
{
SDbObj
*
mgmtGetDbByTableId
(
char
*
table
Id
)
{
char
db
[
TSDB_TABLE_ID_LEN
],
*
pos
;
pos
=
strstr
(
meter
Id
,
TS_PATH_DELIMITER
);
pos
=
strstr
(
table
Id
,
TS_PATH_DELIMITER
);
pos
=
strstr
(
pos
+
1
,
TS_PATH_DELIMITER
);
memset
(
db
,
0
,
sizeof
(
db
));
strncpy
(
db
,
meterId
,
pos
-
meter
Id
);
strncpy
(
db
,
tableId
,
pos
-
table
Id
);
return
(
SDbObj
*
)
sdbGetRow
(
tsDbSdb
,
db
);
}
...
...
@@ -217,16 +217,16 @@ int32_t mgmtCheckDbParams(SCreateDbMsg *pCreate) {
}
// calculate the blocks per table
if
(
pCreate
->
blocksPer
Meter
<
0
)
{
pCreate
->
blocksPer
Meter
=
pCreate
->
cacheNumOfBlocks
.
totalBlocks
/
4
;
if
(
pCreate
->
blocksPer
Table
<
0
)
{
pCreate
->
blocksPer
Table
=
pCreate
->
cacheNumOfBlocks
.
totalBlocks
/
4
;
}
if
(
pCreate
->
blocksPer
Meter
>
pCreate
->
cacheNumOfBlocks
.
totalBlocks
*
3
/
4
)
{
pCreate
->
blocksPer
Meter
=
pCreate
->
cacheNumOfBlocks
.
totalBlocks
*
3
/
4
;
if
(
pCreate
->
blocksPer
Table
>
pCreate
->
cacheNumOfBlocks
.
totalBlocks
*
3
/
4
)
{
pCreate
->
blocksPer
Table
=
pCreate
->
cacheNumOfBlocks
.
totalBlocks
*
3
/
4
;
}
if
(
pCreate
->
blocksPer
Meter
<
TSDB_MIN_AVG_BLOCKS
)
{
pCreate
->
blocksPer
Meter
=
TSDB_MIN_AVG_BLOCKS
;
if
(
pCreate
->
blocksPer
Table
<
TSDB_MIN_AVG_BLOCKS
)
{
pCreate
->
blocksPer
Table
=
TSDB_MIN_AVG_BLOCKS
;
}
pCreate
->
maxSessions
++
;
...
...
@@ -340,7 +340,7 @@ void mgmtDropDbFromSdb(SDbObj *pDb) {
// SSuperTableObj *pMetric = pDb->pSTable;
// while (pMetric) {
// SSuperTableObj *pNext = pMetric->next;
// mgmtDropTable(pDb, pMetric->
meter
Id, 0);
// mgmtDropTable(pDb, pMetric->
table
Id, 0);
// pMetric = pNext;
// }
...
...
@@ -527,7 +527,7 @@ void mgmtCleanUpDbs() {
sdbCloseTable
(
tsDbSdb
);
}
int32_t
mgmtGetDbMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetDbMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
cols
=
0
;
SSchema
*
pSchema
=
tsGetSchema
(
pMeta
);
...
...
@@ -760,7 +760,7 @@ int32_t mgmtRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void *pConn)
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
pDb
->
cfg
.
blocksPer
Meter
;
*
(
int16_t
*
)
pWrite
=
pDb
->
cfg
.
blocksPer
Table
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtDnode.c
浏览文件 @
7cedf4af
...
...
@@ -97,7 +97,7 @@ void mgmtUnSetDnodeVgid(SVnodeGid vnodeGid[], int32_t numOfVnodes) {
}
}
int32_t
mgmtGetDnodeMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetDnodeMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
cols
=
0
;
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
pConn
);
...
...
@@ -212,7 +212,7 @@ int32_t mgmtRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, void *pCon
return
numOfRows
;
}
int32_t
mgmtGetModuleMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetModuleMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
cols
=
0
;
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
pConn
);
...
...
@@ -305,7 +305,7 @@ int32_t mgmtRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pCo
return
numOfRows
;
}
int32_t
mgmtGetConfigMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetConfigMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
cols
=
0
;
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
pConn
);
...
...
@@ -393,7 +393,7 @@ int32_t mgmtRetrieveConfigs(SShowObj *pShow, char *data, int32_t rows, void *pCo
return
numOfRows
;
}
int32_t
mgmtGetVnodeMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetVnodeMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
cols
=
0
;
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
pConn
);
if
(
pUser
==
NULL
)
return
0
;
...
...
@@ -571,11 +571,11 @@ void *mgmtGetNextDnodeImp(SShowObj *pShow, SDnodeObj **pDnode) {
void
*
(
*
mgmtGetNextDnode
)(
SShowObj
*
pShow
,
SDnodeObj
**
pDnode
)
=
mgmtGetNextDnodeImp
;
int32_t
mgmtGetScoresMetaImp
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetScoresMetaImp
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
int32_t
(
*
mgmtGetScoresMeta
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
mgmtGetScoresMetaImp
;
int32_t
(
*
mgmtGetScoresMeta
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
mgmtGetScoresMetaImp
;
int32_t
mgmtRetrieveScoresImp
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
{
return
0
;
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtDnodeInt.c
浏览文件 @
7cedf4af
...
...
@@ -83,7 +83,7 @@ int32_t mgmtProcessMeterCfgMsg(int8_t *pCont, int32_t contLen, void *pConn) {
return
TSDB_CODE_REDIRECT
;
}
S
MeterCfgMsg
*
cfg
=
(
SMeter
CfgMsg
*
)
pConn
;
S
TableCfgMsg
*
cfg
=
(
STable
CfgMsg
*
)
pConn
;
int32_t
vnode
=
htonl
(
cfg
->
vnode
);
int32_t
sid
=
htonl
(
cfg
->
sid
);
...
...
@@ -306,7 +306,7 @@ int mgmtSendRemoveMeterMsgToDnode(STableInfo *pTable, SVgObj *pVgroup) {
// pRemove = (SDRemoveTableMsg *)pMsg;
// pRemove->vnode = htons(pVgroup->vnodeGid[i].vnode);
// pRemove->sid = htonl(pTable->gid.sid);
// memcpy(pRemove->
meterId, pTable->meter
Id, TSDB_TABLE_ID_LEN);
// memcpy(pRemove->
tableId, pTable->table
Id, TSDB_TABLE_ID_LEN);
//
// pMsg += sizeof(SDRemoveTableMsg);
// msgLen = pMsg - pStart;
...
...
@@ -372,7 +372,7 @@ char *mgmtBuildVpeersIe(char *pMsg, SVgObj *pVgroup, int vnode) {
pCfg
->
daysToKeep2
=
htonl
(
pCfg
->
daysToKeep2
);
pCfg
->
daysToKeep
=
htonl
(
pCfg
->
daysToKeep
);
pCfg
->
commitTime
=
htonl
(
pCfg
->
commitTime
);
pCfg
->
blocksPer
Meter
=
htons
(
pCfg
->
blocksPerMeter
);
pCfg
->
blocksPer
Table
=
htons
(
pCfg
->
blocksPerTable
);
pCfg
->
replications
=
(
char
)
pVgroup
->
numOfVnodes
;
pCfg
->
rowsInFileBlock
=
htonl
(
pCfg
->
rowsInFileBlock
);
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtGrant.c
浏览文件 @
7cedf4af
...
...
@@ -37,8 +37,8 @@ int32_t (*mgmtCheckTimeSeries)(uint32_t timeseries) = mgmtCheckTimeSeriesImp;
bool
mgmtCheckExpiredImp
()
{
return
false
;
}
bool
(
*
mgmtCheckExpired
)()
=
mgmtCheckExpiredImp
;
int32_t
mgmtGetGrantsMetaImp
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
int32_t
(
*
mgmtGetGrantsMeta
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
mgmtGetGrantsMetaImp
;
int32_t
mgmtGetGrantsMetaImp
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
int32_t
(
*
mgmtGetGrantsMeta
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
mgmtGetGrantsMetaImp
;
int32_t
mgmtRetrieveGrantsImp
(
SShowObj
*
pShow
,
char
*
data
,
int
rows
,
void
*
pConn
)
{
return
0
;
}
int32_t
(
*
mgmtRetrieveGrants
)(
SShowObj
*
pShow
,
char
*
data
,
int
rows
,
void
*
pConn
)
=
mgmtRetrieveGrantsImp
;
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtMnode.c
浏览文件 @
7cedf4af
...
...
@@ -16,11 +16,11 @@
#define _DEFAULT_SOURCE
#include "mgmtMnode.h"
int32_t
mgmtGetMnodeMetaImp
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetMnodeMetaImp
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
int32_t
(
*
mgmtGetMnodeMeta
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
mgmtGetMnodeMetaImp
;
int32_t
(
*
mgmtGetMnodeMeta
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
=
mgmtGetMnodeMetaImp
;
int32_t
mgmtRetrieveMnodesImp
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
{
return
0
;
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtNormalTable.c
浏览文件 @
7cedf4af
...
...
@@ -456,7 +456,7 @@ static int32_t mgmtSetSchemaFromNormalTable(SSchema *pSchema, SNormalTableObj *p
return
numOfCols
*
sizeof
(
SSchema
);
}
int32_t
mgmtGetNormalTableMeta
(
SDbObj
*
pDb
,
SNormalTableObj
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
)
{
int32_t
mgmtGetNormalTableMeta
(
SDbObj
*
pDb
,
SNormalTableObj
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
)
{
pMeta
->
uid
=
htobe64
(
pTable
->
uid
);
pMeta
->
sid
=
htonl
(
pTable
->
sid
);
pMeta
->
vgid
=
htonl
(
pTable
->
vgId
);
...
...
@@ -465,7 +465,7 @@ int32_t mgmtGetNormalTableMeta(SDbObj *pDb, SNormalTableObj *pTable, SMeterMeta
pMeta
->
numOfTags
=
0
;
pMeta
->
numOfColumns
=
htons
(
pTable
->
numOfColumns
);
pMeta
->
tableType
=
pTable
->
type
;
pMeta
->
contLen
=
sizeof
(
S
Meter
Meta
)
+
mgmtSetSchemaFromNormalTable
(
pMeta
->
schema
,
pTable
);
pMeta
->
contLen
=
sizeof
(
S
Table
Meta
)
+
mgmtSetSchemaFromNormalTable
(
pMeta
->
schema
,
pTable
);
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtProfile.c
浏览文件 @
7cedf4af
...
...
@@ -117,7 +117,7 @@ int32_t mgmtGetQueries(SShowObj *pShow, void *pConn) {
return
0
;
}
int32_t
mgmtGetQueryMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetQueryMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
cols
=
0
;
SSchema
*
pSchema
=
tsGetSchema
(
pMeta
);
...
...
@@ -316,7 +316,7 @@ int32_t mgmtGetStreams(SShowObj *pShow, void *pConn) {
return
0
;
}
int32_t
mgmtGetStreamMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetStreamMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
cols
=
0
;
SSchema
*
pSchema
=
tsGetSchema
(
pMeta
);
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtShell.c
浏览文件 @
7cedf4af
...
...
@@ -40,9 +40,9 @@
#include "mgmtVgroup.h"
#define MAX_LEN_OF_METER_META (sizeof(SMulti
Meter
Meta) + sizeof(SSchema) * TSDB_MAX_COLUMNS + sizeof(SSchema) * TSDB_MAX_TAGS + TSDB_MAX_TAGS_LEN)
#define MAX_LEN_OF_METER_META (sizeof(SMulti
Table
Meta) + sizeof(SSchema) * TSDB_MAX_COLUMNS + sizeof(SSchema) * TSDB_MAX_TAGS + TSDB_MAX_TAGS_LEN)
typedef
int32_t
(
*
GetMateFp
)(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
typedef
int32_t
(
*
GetMateFp
)(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
typedef
int32_t
(
*
RetrieveMetaFp
)(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
static
GetMateFp
*
mgmtGetMetaFp
;
static
RetrieveMetaFp
*
mgmtRetrieveFp
;
...
...
@@ -118,7 +118,7 @@ void mgmtCleanUpShell() {
}
}
int32_t
mgmtProcess
Meter
MetaMsg
(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
{
int32_t
mgmtProcess
Table
MetaMsg
(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
)
{
SRpcConnInfo
connInfo
;
rpcGetConnInfo
(
ahandle
,
&
connInfo
);
...
...
@@ -177,7 +177,7 @@ int32_t mgmtProcessMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
return
TSDB_CODE_INVALID_TABLE
;
}
S
MeterMeta
*
pMeta
=
rpcMallocCont
(
sizeof
(
SMeter
Meta
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
);
S
TableMeta
*
pMeta
=
rpcMallocCont
(
sizeof
(
STable
Meta
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
);
int32_t
code
=
mgmtGetTableMeta
(
pDb
,
pTable
,
pMeta
,
usePublicIp
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
...
...
@@ -206,13 +206,13 @@ int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle
pInfo
->
numOfTables
=
htonl
(
pInfo
->
numOfTables
);
int32_t
totalMallocLen
=
4
*
1024
*
1024
;
// first malloc 4 MB, subsequent reallocation as twice
SMulti
Meter
Meta
*
pMultiMeta
=
rpcMallocCont
(
totalMallocLen
);
SMulti
Table
Meta
*
pMultiMeta
=
rpcMallocCont
(
totalMallocLen
);
if
(
pMultiMeta
==
NULL
)
{
rpcSendResponse
(
ahandle
,
TSDB_CODE_SERV_OUT_OF_MEMORY
,
NULL
,
0
);
return
TSDB_CODE_SERV_OUT_OF_MEMORY
;
}
pMultiMeta
->
contLen
=
sizeof
(
SMulti
Meter
Meta
);
pMultiMeta
->
contLen
=
sizeof
(
SMulti
Table
Meta
);
pMultiMeta
->
numOfTables
=
0
;
for
(
int
t
=
0
;
t
<
pInfo
->
numOfTables
;
++
t
)
{
...
...
@@ -224,7 +224,7 @@ int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle
if
(
pDb
==
NULL
)
continue
;
int
availLen
=
totalMallocLen
-
pMultiMeta
->
contLen
;
if
(
availLen
<=
sizeof
(
S
Meter
Meta
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
)
{
if
(
availLen
<=
sizeof
(
S
Table
Meta
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
)
{
//TODO realloc
//totalMallocLen *= 2;
//pMultiMeta = rpcReMalloc(pMultiMeta, totalMallocLen);
...
...
@@ -237,7 +237,7 @@ int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle
//}
}
S
MeterMeta
*
pMeta
=
(
SMeter
Meta
*
)(
pMultiMeta
->
metas
+
pMultiMeta
->
contLen
);
S
TableMeta
*
pMeta
=
(
STable
Meta
*
)(
pMultiMeta
->
metas
+
pMultiMeta
->
contLen
);
int32_t
code
=
mgmtGetTableMeta
(
pDb
,
pTable
,
pMeta
,
usePublicIp
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
pMultiMeta
->
numOfTables
++
;
...
...
@@ -269,7 +269,7 @@ int32_t mgmtProcessCreateDbMsg(void *pCont, int32_t contLen, void *ahandle) {
pCreate
->
daysToKeep1
=
htonl
(
pCreate
->
daysToKeep1
);
pCreate
->
daysToKeep2
=
htonl
(
pCreate
->
daysToKeep2
);
pCreate
->
commitTime
=
htonl
(
pCreate
->
commitTime
);
pCreate
->
blocksPer
Meter
=
htons
(
pCreate
->
blocksPerMeter
);
pCreate
->
blocksPer
Table
=
htons
(
pCreate
->
blocksPerTable
);
pCreate
->
rowsInFileBlock
=
htonl
(
pCreate
->
rowsInFileBlock
);
// pCreate->cacheNumOfBlocks = htonl(pCreate->cacheNumOfBlocks);
...
...
@@ -673,7 +673,7 @@ int32_t mgmtProcessShowMsg(void *pCont, int32_t contLen, void *ahandle) {
mgmtSaveQhandle
(
pShow
);
pShowRsp
->
qhandle
=
htobe64
((
uint64_t
)
pShow
);
code
=
(
*
mgmtGetMetaFp
[(
uint8_t
)
pShowMsg
->
type
])(
&
pShowRsp
->
meter
Meta
,
pShow
,
ahandle
);
code
=
(
*
mgmtGetMetaFp
[(
uint8_t
)
pShowMsg
->
type
])(
&
pShowRsp
->
table
Meta
,
pShow
,
ahandle
);
if
(
code
==
0
)
{
size
=
sizeof
(
SShowRsp
)
+
sizeof
(
SSchema
)
*
pShow
->
numOfColumns
;
}
else
{
...
...
@@ -691,7 +691,7 @@ int32_t mgmtProcessRetrieveMsg(void *pCont, int32_t contLen, void *ahandle) {
int32_t
rowsToRead
=
0
;
int32_t
size
=
0
;
int32_t
rowsRead
=
0
;
SRetrieve
MeterMsg
*
pRetrieve
=
(
SRetrieveMeter
Msg
*
)
pCont
;
SRetrieve
TableMsg
*
pRetrieve
=
(
SRetrieveTable
Msg
*
)
pCont
;
pRetrieve
->
qhandle
=
htobe64
(
pRetrieve
->
qhandle
);
/*
...
...
@@ -726,7 +726,7 @@ int32_t mgmtProcessRetrieveMsg(void *pCont, int32_t contLen, void *ahandle) {
}
size
+=
100
;
SRetrieve
Meter
Rsp
*
pRsp
=
rpcMallocCont
(
size
);
SRetrieve
Table
Rsp
*
pRsp
=
rpcMallocCont
(
size
);
// if free flag is set, client wants to clean the resources
if
((
pRetrieve
->
free
&
TSDB_QUERY_TYPE_FREE_RESOURCE
)
!=
TSDB_QUERY_TYPE_FREE_RESOURCE
)
...
...
@@ -1040,7 +1040,7 @@ connect_over:
}
/**
* check if we need to add mgmtProcess
Meter
MetaMsg into tranQueue, which will be executed one-by-one.
* check if we need to add mgmtProcess
Table
MetaMsg into tranQueue, which will be executed one-by-one.
*/
static
bool
mgmtCheckMeterMetaMsgType
(
void
*
pMsg
)
{
STableInfoMsg
*
pInfo
=
(
STableInfoMsg
*
)
pMsg
;
...
...
@@ -1114,7 +1114,7 @@ void mgmtInitProcessShellMsg() {
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_KILL_CONNECTION
]
=
mgmtProcessKillConnectionMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_SHOW
]
=
mgmtProcessShowMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_RETRIEVE
]
=
mgmtProcessRetrieveMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_TABLE_META
]
=
mgmtProcess
Meter
MetaMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_TABLE_META
]
=
mgmtProcess
Table
MetaMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_MULTI_TABLE_META
]
=
mgmtProcessMultiMeterMetaMsg
;
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_STABLE_META
]
=
mgmtProcessUnSupportMsg
;
}
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtStreamTable.c
浏览文件 @
7cedf4af
...
...
@@ -396,7 +396,7 @@ static int32_t mgmtSetSchemaFromStreamTable(SSchema *pSchema, SStreamTableObj *p
return
numOfCols
*
sizeof
(
SSchema
);
}
int32_t
mgmtGetStreamTableMeta
(
SDbObj
*
pDb
,
SStreamTableObj
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
)
{
int32_t
mgmtGetStreamTableMeta
(
SDbObj
*
pDb
,
SStreamTableObj
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
)
{
pMeta
->
uid
=
htobe64
(
pTable
->
uid
);
pMeta
->
sid
=
htonl
(
pTable
->
sid
);
pMeta
->
vgid
=
htonl
(
pTable
->
vgId
);
...
...
@@ -405,7 +405,7 @@ int32_t mgmtGetStreamTableMeta(SDbObj *pDb, SStreamTableObj *pTable, SMeterMeta
pMeta
->
numOfTags
=
0
;
pMeta
->
numOfColumns
=
htons
(
pTable
->
numOfColumns
);
pMeta
->
tableType
=
pTable
->
type
;
pMeta
->
contLen
=
sizeof
(
S
Meter
Meta
)
+
mgmtSetSchemaFromStreamTable
(
pMeta
->
schema
,
pTable
);
pMeta
->
contLen
=
sizeof
(
S
Table
Meta
)
+
mgmtSetSchemaFromStreamTable
(
pMeta
->
schema
,
pTable
);
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtSuperTable.c
浏览文件 @
7cedf4af
...
...
@@ -457,7 +457,7 @@ int32_t mgmtDropSuperTableColumnByName(SSuperTableObj *pStable, char *colName) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
mgmtGetShowSuperTableMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetShowSuperTableMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
// int32_t cols = 0;
//
// SDbObj *pDb = NULL;
...
...
@@ -616,7 +616,7 @@ int32_t mgmtSetSchemaFromSuperTable(SSchema *pSchema, SSuperTableObj *pTable) {
return
(
pTable
->
numOfColumns
+
pTable
->
numOfTags
)
*
sizeof
(
SSchema
);
}
int32_t
mgmtGetSuperTableMeta
(
SDbObj
*
pDb
,
SSuperTableObj
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
)
{
int32_t
mgmtGetSuperTableMeta
(
SDbObj
*
pDb
,
SSuperTableObj
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
)
{
pMeta
->
uid
=
htobe64
(
pTable
->
uid
);
pMeta
->
sid
=
htonl
(
pTable
->
sid
);
pMeta
->
vgid
=
htonl
(
pTable
->
vgId
);
...
...
@@ -625,7 +625,7 @@ int32_t mgmtGetSuperTableMeta(SDbObj *pDb, SSuperTableObj *pTable, SMeterMeta *p
pMeta
->
numOfTags
=
pTable
->
numOfTags
;
pMeta
->
numOfColumns
=
htons
(
pTable
->
numOfColumns
);
pMeta
->
tableType
=
pTable
->
type
;
pMeta
->
contLen
=
sizeof
(
S
Meter
Meta
)
+
mgmtSetSchemaFromSuperTable
(
pMeta
->
schema
,
pTable
);
pMeta
->
contLen
=
sizeof
(
S
Table
Meta
)
+
mgmtSetSchemaFromSuperTable
(
pMeta
->
schema
,
pTable
);
SVgObj
*
pVgroup
=
mgmtGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtTable.c
浏览文件 @
7cedf4af
...
...
@@ -99,7 +99,7 @@ STableInfo* mgmtGetTableByPos(uint32_t dnodeIp, int32_t vnode, int32_t sid) {
return
NULL
;
}
int32_t
mgmtGetTableMeta
(
SDbObj
*
pDb
,
STableInfo
*
pTable
,
S
Meter
Meta
*
pMeta
,
bool
usePublicIp
)
{
int32_t
mgmtGetTableMeta
(
SDbObj
*
pDb
,
STableInfo
*
pTable
,
S
Table
Meta
*
pMeta
,
bool
usePublicIp
)
{
if
(
pTable
->
type
==
TSDB_TABLE_TYPE_CHILD_TABLE
)
{
mgmtGetChildTableMeta
(
pDb
,
(
SChildTableObj
*
)
pTable
,
pMeta
,
usePublicIp
);
}
else
if
(
pTable
->
type
==
TSDB_TABLE_TYPE_STREAM_TABLE
)
{
...
...
@@ -247,7 +247,7 @@ void mgmtCleanUpMeters() {
mgmtCleanUpSuperTables
();
}
int32_t
mgmtGetShowTableMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetShowTableMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
// int32_t cols = 0;
//
// SDbObj *pDb = NULL;
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtUser.c
浏览文件 @
7cedf4af
...
...
@@ -158,7 +158,7 @@ void mgmtCleanUpUsers() {
sdbCloseTable
(
tsUserSdb
);
}
int32_t
mgmtGetUserMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetUserMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
// int32_t cols = 0;
// SSchema *pSchema = tsGetSchema(pMeta);
//
...
...
This diff is collapsed.
Click to expand it.
src/mnode/src/mgmtVgroup.c
浏览文件 @
7cedf4af
...
...
@@ -248,7 +248,7 @@ void mgmtSetVgroupIdPool() {
void
mgmtCleanUpVgroups
()
{
sdbCloseTable
(
tsVgroupSdb
);
}
int32_t
mgmtGetVgroupMeta
(
S
Meter
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
int32_t
mgmtGetVgroupMeta
(
S
Table
Meta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
// int32_t cols = 0;
//
// SDbObj *pDb = NULL;
...
...
This diff is collapsed.
Click to expand it.
src/util/inc/textbuffer.h
浏览文件 @
7cedf4af
...
...
@@ -124,7 +124,7 @@ typedef struct tTagSchema {
typedef
struct
tSidSet
{
int32_t
numOfSids
;
int32_t
numOfSubSet
;
S
Meter
SidExtInfo
**
pSids
;
S
Table
SidExtInfo
**
pSids
;
int32_t
*
starterPos
;
// position of each subgroup, generated according to
SColumnModel
*
pColumnModel
;
...
...
This diff is collapsed.
Click to expand it.
src/util/inc/tschemautil.h
浏览文件 @
7cedf4af
...
...
@@ -42,20 +42,20 @@ struct SSchema;
*/
bool
isValidSchema
(
struct
SSchema
*
pSchema
,
int32_t
numOfCols
);
struct
SSchema
*
tsGetSchema
(
S
Meter
Meta
*
pMeta
);
struct
SSchema
*
tsGetSchema
(
S
Table
Meta
*
pMeta
);
struct
SSchema
*
tsGetTagSchema
(
S
Meter
Meta
*
pMeta
);
struct
SSchema
*
tsGetTagSchema
(
S
Table
Meta
*
pMeta
);
struct
SSchema
*
tsGetColumnSchema
(
S
Meter
Meta
*
pMeta
,
int32_t
startCol
);
struct
SSchema
*
tsGetColumnSchema
(
S
Table
Meta
*
pMeta
,
int32_t
startCol
);
struct
SSchema
tsGetTbnameColumnSchema
();
char
*
tsGetTagsValue
(
S
Meter
Meta
*
pMeta
);
char
*
tsGetTagsValue
(
S
Table
Meta
*
pMeta
);
bool
tsMeterMetaIdentical
(
S
MeterMeta
*
p1
,
SMeter
Meta
*
p2
);
bool
tsMeterMetaIdentical
(
S
TableMeta
*
p1
,
STable
Meta
*
p2
);
void
extractTableName
(
char
*
meter
Id
,
char
*
name
);
void
extractTableName
(
char
*
table
Id
,
char
*
name
);
SSQLToken
extractDBName
(
char
*
meter
Id
,
char
*
name
);
SSQLToken
extractDBName
(
char
*
table
Id
,
char
*
name
);
void
extractTableNameFromToken
(
SSQLToken
*
pToken
,
SSQLToken
*
pTable
);
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
新手
引导
客服
返回
顶部