Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
~笨蛋陪你哭
TDengine
提交
05325532
T
TDengine
项目概览
~笨蛋陪你哭
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
05325532
编写于
10月 20, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-1747]
上级
67ffdd17
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
56 addition
and
82 deletion
+56
-82
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+0
-20
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+8
-6
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+0
-9
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+7
-7
src/inc/dnode.h
src/inc/dnode.h
+1
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+4
-4
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+1
-1
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+27
-26
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+5
-5
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+1
-1
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+1
-1
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
05325532
...
...
@@ -5259,26 +5259,6 @@ int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDBInfo* pCreateDbSql) {
return
TSDB_CODE_SUCCESS
;
}
//void tscAddTimestampColumn(SQueryInfo* pQueryInfo, int16_t functionId, int16_t tableIndex) {
// // the first column not timestamp column, add it
// SSqlExpr* pExpr = NULL;
// if (tscSqlExprNumOfExprs(pQueryInfo) > 0) {
// pExpr = tscSqlExprGet(pQueryInfo, 0);
// }
//
// if (pExpr == NULL || pExpr->colInfo.colId != PRIMARYKEY_TIMESTAMP_COL_INDEX || pExpr->functionId != functionId) {
// SColumnIndex index = {tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX};
//
// pExpr = tscSqlExprInsert(pQueryInfo, 0, functionId, &index, TSDB_DATA_TYPE_TIMESTAMP, TSDB_KEYSIZE, TSDB_KEYSIZE, false);
// pExpr->colInfo.flag = TSDB_COL_NORMAL;
//
// // NOTE: tag column does not add to source column list
// SColumnList ids = getColumnList(1, tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX);
//
// insertResultField(pQueryInfo, 0, &ids, TSDB_KEYSIZE, TSDB_DATA_TYPE_TIMESTAMP, "ts", pExpr);
// }
//}
void
addGroupInfoForSubquery
(
SSqlObj
*
pParentObj
,
SSqlObj
*
pSql
,
int32_t
subClauseIndex
,
int32_t
tableIndex
)
{
SQueryInfo
*
pParentQueryInfo
=
tscGetQueryInfoDetail
(
&
pParentObj
->
cmd
,
subClauseIndex
);
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
05325532
...
...
@@ -163,7 +163,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size
.
numOfColumns
=
pTableMetaMsg
->
numOfColumns
,
};
pTableMeta
->
id
.
tid
=
pTableMetaMsg
->
s
id
;
pTableMeta
->
id
.
tid
=
pTableMetaMsg
->
t
id
;
pTableMeta
->
id
.
uid
=
pTableMetaMsg
->
uid
;
SCMVgroupInfo
*
pVgroupInfo
=
&
pTableMeta
->
vgroupInfo
;
...
...
src/client/src/tscServer.c
浏览文件 @
05325532
...
...
@@ -1650,7 +1650,7 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int
tscProcessTableMetaRsp
(
SSqlObj
*
pSql
)
{
STableMetaMsg
*
pMetaMsg
=
(
STableMetaMsg
*
)
pSql
->
res
.
pRsp
;
pMetaMsg
->
sid
=
htonl
(
pMetaMsg
->
s
id
);
pMetaMsg
->
tid
=
htonl
(
pMetaMsg
->
t
id
);
pMetaMsg
->
sversion
=
htons
(
pMetaMsg
->
sversion
);
pMetaMsg
->
tversion
=
htons
(
pMetaMsg
->
tversion
);
pMetaMsg
->
vgroup
.
vgId
=
htonl
(
pMetaMsg
->
vgroup
.
vgId
);
...
...
@@ -1660,9 +1660,9 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
pMetaMsg
->
numOfColumns
=
htons
(
pMetaMsg
->
numOfColumns
);
if
((
pMetaMsg
->
tableType
!=
TSDB_SUPER_TABLE
)
&&
(
pMetaMsg
->
s
id
<=
0
||
pMetaMsg
->
vgroup
.
vgId
<
2
||
pMetaMsg
->
vgroup
.
numOfEps
<=
0
))
{
(
pMetaMsg
->
t
id
<=
0
||
pMetaMsg
->
vgroup
.
vgId
<
2
||
pMetaMsg
->
vgroup
.
numOfEps
<=
0
))
{
tscError
(
"invalid value in table numOfEps:%d, vgId:%d tid:%d, name:%s"
,
pMetaMsg
->
vgroup
.
numOfEps
,
pMetaMsg
->
vgroup
.
vgId
,
pMetaMsg
->
s
id
,
pMetaMsg
->
tableId
);
pMetaMsg
->
t
id
,
pMetaMsg
->
tableId
);
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
...
...
@@ -1845,8 +1845,10 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
SVgroupsMsg
*
pVgroupMsg
=
(
SVgroupsMsg
*
)
pMsg
;
pVgroupMsg
->
numOfVgroups
=
htonl
(
pVgroupMsg
->
numOfVgroups
);
size_t
size
=
sizeof
(
SCMVgroupInfo
)
*
pVgroupMsg
->
numOfVgroups
+
sizeof
(
SVgroupsInfo
);
pInfo
->
vgroupList
=
calloc
(
1
,
size
);
size_t
size
=
sizeof
(
SCMVgroupMsg
)
*
pVgroupMsg
->
numOfVgroups
+
sizeof
(
SVgroupsMsg
);
size_t
vgroupsz
=
sizeof
(
SCMVgroupInfo
)
*
pVgroupMsg
->
numOfVgroups
+
sizeof
(
SVgroupsInfo
);
pInfo
->
vgroupList
=
calloc
(
1
,
vgroupsz
);
assert
(
pInfo
->
vgroupList
!=
NULL
);
pInfo
->
vgroupList
->
numOfVgroups
=
pVgroupMsg
->
numOfVgroups
;
...
...
@@ -1898,7 +1900,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
pMetaMsg
->
numOfColumns
=
ntohs
(
pMetaMsg
->
numOfColumns
);
pSchema
=
pMetaMsg
->
schema
;
pMetaMsg
->
sid
=
ntohs
(
pMetaMsg
->
s
id
);
pMetaMsg
->
tid
=
ntohs
(
pMetaMsg
->
t
id
);
for
(
int
i
=
0
;
i
<
pMetaMsg
->
numOfColumns
;
++
i
)
{
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
pSchema
++
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
05325532
...
...
@@ -1142,7 +1142,6 @@ static void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code);
static
SSqlObj
*
tscCreateSTableSubquery
(
SSqlObj
*
pSql
,
SRetrieveSupport
*
trsupport
,
SSqlObj
*
prevSqlObj
);
// TODO
int32_t
tscCreateJoinSubquery
(
SSqlObj
*
pSql
,
int16_t
tableIndex
,
SJoinSupporter
*
pSupporter
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
...
...
@@ -1298,14 +1297,6 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
assert
((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_SUBQUERY
)
==
0
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
// todo add test
// SSubqueryState *pState = calloc(1, sizeof(SSubqueryState));
// if (pState == NULL) {
// code = TSDB_CODE_TSC_OUT_OF_MEMORY;
// goto _error;
// }
pSql
->
subState
.
numOfSub
=
pQueryInfo
->
numOfTables
;
bool
hasEmptySub
=
false
;
...
...
src/dnode/src/dnodeShell.c
浏览文件 @
05325532
...
...
@@ -173,15 +173,15 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
return
rpcRsp
.
code
;
}
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
s
id
)
{
dDebug
(
"vgId:%d,
sid:%d send config table msg to mnode"
,
vgId
,
s
id
);
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
t
id
)
{
dDebug
(
"vgId:%d,
tid:%d send config table msg to mnode"
,
vgId
,
t
id
);
int32_t
contLen
=
sizeof
(
SDMConfigTableMsg
);
SDMConfigTableMsg
*
pMsg
=
rpcMallocCont
(
contLen
);
pMsg
->
dnodeId
=
htonl
(
dnodeGetDnodeId
());
pMsg
->
vgId
=
htonl
(
vgId
);
pMsg
->
sid
=
htonl
(
s
id
);
pMsg
->
tid
=
htonl
(
t
id
);
SRpcMsg
rpcMsg
=
{
0
};
rpcMsg
.
pCont
=
pMsg
;
...
...
@@ -194,18 +194,18 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) {
if
(
rpcRsp
.
code
!=
0
)
{
rpcFreeCont
(
rpcRsp
.
pCont
);
dError
(
"vgId:%d,
sid:%d failed to config table from mnode"
,
vgId
,
s
id
);
dError
(
"vgId:%d,
tid:%d failed to config table from mnode"
,
vgId
,
t
id
);
return
NULL
;
}
else
{
dInfo
(
"vgId:%d,
sid:%d config table msg is received"
,
vgId
,
s
id
);
dInfo
(
"vgId:%d,
tid:%d config table msg is received"
,
vgId
,
t
id
);
// delete this after debug finished
SMDCreateTableMsg
*
pTable
=
rpcRsp
.
pCont
;
int16_t
numOfColumns
=
htons
(
pTable
->
numOfColumns
);
int16_t
numOfTags
=
htons
(
pTable
->
numOfTags
);
int32_t
sid
=
htonl
(
pTable
->
s
id
);
int32_t
tableId
=
htonl
(
pTable
->
t
id
);
uint64_t
uid
=
htobe64
(
pTable
->
uid
);
dInfo
(
"table:%s, numOfColumns:%d numOfTags:%d
sid:%d uid:%"
PRIu64
,
pTable
->
tableId
,
numOfColumns
,
numOfTags
,
si
d
,
uid
);
dInfo
(
"table:%s, numOfColumns:%d numOfTags:%d
tid:%d uid:%"
PRIu64
,
pTable
->
tableId
,
numOfColumns
,
numOfTags
,
tableI
d
,
uid
);
return
rpcRsp
.
pCont
;
}
...
...
src/inc/dnode.h
浏览文件 @
05325532
...
...
@@ -49,7 +49,7 @@ void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg));
void
dnodeSendMsgToDnode
(
SRpcEpSet
*
epSet
,
SRpcMsg
*
rpcMsg
);
void
dnodeSendMsgToMnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
);
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
,
SRpcEpSet
*
epSet
);
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
s
id
);
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
t
id
);
void
*
dnodeAllocateVnodeWqueue
(
void
*
pVnode
);
void
dnodeFreeVnodeWqueue
(
void
*
queue
);
...
...
src/inc/taosmsg.h
浏览文件 @
05325532
...
...
@@ -251,7 +251,7 @@ typedef struct {
int8_t
tableType
;
int16_t
numOfColumns
;
int16_t
numOfTags
;
int32_t
s
id
;
int32_t
t
id
;
int32_t
sversion
;
int32_t
tversion
;
int32_t
tagDataLen
;
...
...
@@ -360,7 +360,7 @@ typedef struct {
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
int32_t
s
id
;
int32_t
t
id
;
uint64_t
uid
;
char
tableId
[
TSDB_TABLE_FNAME_LEN
];
}
SMDDropTableMsg
;
...
...
@@ -699,7 +699,7 @@ typedef struct STableMetaMsg {
int16_t
numOfColumns
;
int16_t
sversion
;
int16_t
tversion
;
int32_t
s
id
;
int32_t
t
id
;
uint64_t
uid
;
SCMVgroupMsg
vgroup
;
SSchema
schema
[];
...
...
@@ -747,7 +747,7 @@ typedef struct {
typedef
struct
{
int32_t
dnodeId
;
int32_t
vgId
;
int32_t
s
id
;
int32_t
t
id
;
}
SDMConfigTableMsg
;
typedef
struct
{
...
...
src/mnode/inc/mnodeDef.h
浏览文件 @
05325532
...
...
@@ -115,7 +115,7 @@ typedef struct {
uint64_t
suid
;
int64_t
createdTime
;
int32_t
numOfColumns
;
//used by normal table
int32_t
s
id
;
int32_t
t
id
;
int32_t
vgId
;
int32_t
sqlLen
;
int8_t
updateEnd
[
4
];
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
05325532
...
...
@@ -303,7 +303,7 @@ static int32_t mnodeChildTableActionRestored() {
SVgObj
*
pVgroup
=
mnodeGetVgroup
(
pTable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
mError
(
"ctable:%s, failed to get vgId:%d
sid:%d, discard it"
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
s
id
);
mError
(
"ctable:%s, failed to get vgId:%d
tid:%d, discard it"
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
t
id
);
pTable
->
vgId
=
0
;
SSdbOper
desc
=
{.
type
=
SDB_OPER_LOCAL
,
.
pObj
=
pTable
,
.
table
=
tsChildTableSdb
};
sdbDeleteRow
(
&
desc
);
...
...
@@ -314,7 +314,7 @@ static int32_t mnodeChildTableActionRestored() {
if
(
strcmp
(
pVgroup
->
dbName
,
pDb
->
name
)
!=
0
)
{
mError
(
"ctable:%s, db:%s not match with vgId:%d db:%s sid:%d, discard it"
,
pTable
->
info
.
tableId
,
pDb
->
name
,
pTable
->
vgId
,
pVgroup
->
dbName
,
pTable
->
s
id
);
pTable
->
info
.
tableId
,
pDb
->
name
,
pTable
->
vgId
,
pVgroup
->
dbName
,
pTable
->
t
id
);
pTable
->
vgId
=
0
;
SSdbOper
desc
=
{.
type
=
SDB_OPER_LOCAL
,
.
pObj
=
pTable
,
.
table
=
tsChildTableSdb
};
sdbDeleteRow
(
&
desc
);
...
...
@@ -771,8 +771,8 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
return
mnodeProcessDropSuperTableMsg
(
pMsg
);
}
else
{
SChildTableObj
*
pCTable
=
(
SChildTableObj
*
)
pMsg
->
pTable
;
mInfo
(
"app:%p:%p, table:%s, start to drop ctable, vgId:%d
s
id:%d uid:%"
PRIu64
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pDrop
->
tableId
,
pCTable
->
vgId
,
pCTable
->
s
id
,
pCTable
->
uid
);
mInfo
(
"app:%p:%p, table:%s, start to drop ctable, vgId:%d
t
id:%d uid:%"
PRIu64
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pDrop
->
tableId
,
pCTable
->
vgId
,
pCTable
->
t
id
,
pCTable
->
uid
);
return
mnodeProcessDropChildTableMsg
(
pMsg
);
}
}
...
...
@@ -1479,6 +1479,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
if
(
pTable
!=
NULL
&&
pTable
->
vgHash
!=
NULL
)
{
contLen
+=
(
taosHashGetSize
(
pTable
->
vgHash
)
*
sizeof
(
SCMVgroupMsg
)
+
sizeof
(
SVgroupsMsg
));
}
mnodeDecTableRef
(
pTable
);
}
...
...
@@ -1593,7 +1594,7 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableO
pCreate
->
vgId
=
htonl
(
pTable
->
vgId
);
pCreate
->
tableType
=
pTable
->
info
.
type
;
pCreate
->
createdTime
=
htobe64
(
pTable
->
createdTime
);
pCreate
->
sid
=
htonl
(
pTable
->
s
id
);
pCreate
->
tid
=
htonl
(
pTable
->
t
id
);
pCreate
->
sqlDataLen
=
htonl
(
pTable
->
sqlLen
);
pCreate
->
uid
=
htobe64
(
pTable
->
uid
);
...
...
@@ -1642,7 +1643,7 @@ static int32_t mnodeDoCreateChildTableFp(SMnodeMsg *pMsg) {
assert
(
pTable
);
mDebug
(
"app:%p:%p, table:%s, created in mnode, vgId:%d sid:%d, uid:%"
PRIu64
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
s
id
,
pTable
->
uid
);
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
t
id
,
pTable
->
uid
);
SCMCreateTableMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SMDCreateTableMsg
*
pMDCreate
=
mnodeBuildCreateChildTableMsg
(
pCreate
,
pTable
);
...
...
@@ -1684,7 +1685,7 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
else
{
mError
(
"app:%p:%p, table:%s, failed to create table sid:%d, uid:%"
PRIu64
", reason:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
pTable
->
s
id
,
pTable
->
uid
,
tstrerror
(
code
));
pTable
->
info
.
tableId
,
pTable
->
t
id
,
pTable
->
uid
,
tstrerror
(
code
));
SSdbOper
desc
=
{.
type
=
SDB_OPER_GLOBAL
,
.
pObj
=
pTable
,
.
table
=
tsChildTableSdb
};
sdbDeleteRow
(
&
desc
);
return
code
;
...
...
@@ -1708,7 +1709,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
pTable
->
info
.
tableId
=
strdup
(
pCreate
->
tableId
);
pTable
->
createdTime
=
taosGetTimestampMs
();
pTable
->
s
id
=
tid
;
pTable
->
t
id
=
tid
;
pTable
->
vgId
=
pVgroup
->
vgId
;
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
...
...
@@ -1722,7 +1723,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
}
pTable
->
suid
=
pMsg
->
pSTable
->
uid
;
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
48
)
+
((((
uint64_t
)
pTable
->
s
id
)
&
((
1ul
<<
24
)
-
1ul
))
<<
24
)
+
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
48
)
+
((((
uint64_t
)
pTable
->
t
id
)
&
((
1ul
<<
24
)
-
1ul
))
<<
24
)
+
((
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
))
<<
8
)
+
(
taosRand
()
&
((
1ul
<<
8
)
-
1ul
));
pTable
->
superTable
=
pMsg
->
pSTable
;
}
else
{
...
...
@@ -1730,7 +1731,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
int64_t
us
=
taosGetTimestampUs
();
pTable
->
uid
=
(
us
<<
24
)
+
((
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
))
<<
8
)
+
(
taosRand
()
&
((
1ul
<<
8
)
-
1ul
));
}
else
{
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
48
)
+
((((
uint64_t
)
pTable
->
s
id
)
&
((
1ul
<<
24
)
-
1ul
))
<<
24
)
+
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
48
)
+
((((
uint64_t
)
pTable
->
t
id
)
&
((
1ul
<<
24
)
-
1ul
))
<<
24
)
+
((
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
))
<<
8
)
+
(
taosRand
()
&
((
1ul
<<
8
)
-
1ul
));
}
...
...
@@ -1787,7 +1788,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
tstrerror
(
code
));
}
else
{
mDebug
(
"app:%p:%p, table:%s, allocated in vgroup, vgId:%d sid:%d uid:%"
PRIu64
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
pVgroup
->
vgId
,
pTable
->
s
id
,
pTable
->
uid
);
pTable
->
info
.
tableId
,
pVgroup
->
vgId
,
pTable
->
t
id
,
pTable
->
uid
);
}
return
code
;
...
...
@@ -1805,8 +1806,8 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
if
(
pMsg
->
retry
==
0
)
{
if
(
pMsg
->
pTable
==
NULL
)
{
SVgObj
*
pVgroup
=
NULL
;
int32_t
s
id
=
0
;
code
=
mnodeGetAvailableVgroup
(
pMsg
,
&
pVgroup
,
&
s
id
);
int32_t
t
id
=
0
;
code
=
mnodeGetAvailableVgroup
(
pMsg
,
&
pVgroup
,
&
t
id
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mDebug
(
"app:%p:%p, table:%s, failed to get available vgroup, reason:%s"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pCreate
->
tableId
,
tstrerror
(
code
));
...
...
@@ -1820,7 +1821,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
pMsg
->
pVgroup
=
pVgroup
;
mnodeIncVgroupRef
(
pVgroup
);
return
mnodeDoCreateChildTable
(
pMsg
,
s
id
);
return
mnodeDoCreateChildTable
(
pMsg
,
t
id
);
}
}
else
{
if
(
pMsg
->
pTable
==
NULL
)
pMsg
->
pTable
=
mnodeGetTable
(
pCreate
->
tableId
);
...
...
@@ -1850,13 +1851,13 @@ static int32_t mnodeSendDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) {
tstrncpy
(
pDrop
->
tableId
,
pTable
->
info
.
tableId
,
TSDB_TABLE_FNAME_LEN
);
pDrop
->
vgId
=
htonl
(
pTable
->
vgId
);
pDrop
->
contLen
=
htonl
(
sizeof
(
SMDDropTableMsg
));
pDrop
->
sid
=
htonl
(
pTable
->
s
id
);
pDrop
->
tid
=
htonl
(
pTable
->
t
id
);
pDrop
->
uid
=
htobe64
(
pTable
->
uid
);
SRpcEpSet
epSet
=
mnodeGetEpSetFromVgroup
(
pMsg
->
pVgroup
);
mInfo
(
"app:%p:%p, ctable:%s, send drop ctable msg, vgId:%d sid:%d uid:%"
PRIu64
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pDrop
->
tableId
,
pTable
->
vgId
,
pTable
->
s
id
,
pTable
->
uid
);
pDrop
->
tableId
,
pTable
->
vgId
,
pTable
->
t
id
,
pTable
->
uid
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
pMsg
,
...
...
@@ -2095,7 +2096,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
SChildTableObj
*
pTable
=
(
SChildTableObj
*
)
pMsg
->
pTable
;
pMeta
->
uid
=
htobe64
(
pTable
->
uid
);
pMeta
->
sid
=
htonl
(
pTable
->
s
id
);
pMeta
->
tid
=
htonl
(
pTable
->
t
id
);
pMeta
->
precision
=
pDb
->
cfg
.
precision
;
pMeta
->
tableType
=
pTable
->
info
.
type
;
tstrncpy
(
pMeta
->
tableId
,
pTable
->
info
.
tableId
,
TSDB_TABLE_FNAME_LEN
);
...
...
@@ -2135,7 +2136,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
pMeta
->
vgroup
.
vgId
=
htonl
(
pMsg
->
pVgroup
->
vgId
);
mDebug
(
"app:%p:%p, table:%s, uid:%"
PRIu64
" table meta is retrieved, vgId:%d sid:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
pTable
->
uid
,
pTable
->
vgId
,
pTable
->
s
id
);
pTable
->
info
.
tableId
,
pTable
->
uid
,
pTable
->
vgId
,
pTable
->
t
id
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -2283,11 +2284,11 @@ static void mnodeDropAllChildTablesInStable(SSuperTableObj *pStable) {
}
#if 0
static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t
s
id) {
static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t
t
id) {
SVgObj *pVgroup = mnodeGetVgroup(vnode);
if (pVgroup == NULL) return NULL;
SChildTableObj *pTable = pVgroup->tableList[
s
id - 1];
SChildTableObj *pTable = pVgroup->tableList[
t
id - 1];
mnodeIncTableRef((STableObj *)pTable);
mnodeDecVgroupRef(pVgroup);
...
...
@@ -2335,12 +2336,12 @@ static void mnodeProcessDropChildTableRsp(SRpcMsg *rpcMsg) {
assert
(
pTable
);
mInfo
(
"app:%p:%p, table:%s, drop table rsp received, vgId:%d sid:%d uid:%"
PRIu64
", thandle:%p result:%s"
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
s
id
,
pTable
->
uid
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
t
id
,
pTable
->
uid
,
mnodeMsg
->
rpcMsg
.
handle
,
tstrerror
(
rpcMsg
->
code
));
if
(
rpcMsg
->
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"app:%p:%p, table:%s, failed to drop in dnode, vgId:%d sid:%d uid:%"
PRIu64
", reason:%s"
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
s
id
,
pTable
->
uid
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
t
id
,
pTable
->
uid
,
tstrerror
(
rpcMsg
->
code
));
dnodeSendRpcMnodeWriteRsp
(
mnodeMsg
,
rpcMsg
->
code
);
return
;
...
...
@@ -2378,7 +2379,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
// If the table is deleted by another thread during creation, stop creating and send drop msg to vnode
if
(
sdbCheckRowDeleted
(
tsChildTableSdb
,
pTable
))
{
mDebug
(
"app:%p:%p, table:%s, create table rsp received, but a deleting opertion incoming, vgId:%d sid:%d uid:%"
PRIu64
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
s
id
,
pTable
->
uid
);
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
t
id
,
pTable
->
uid
);
// if the vgroup is already dropped from hash, it can't be accquired by pTable->vgId
// so the refCount of vgroup can not be decreased
...
...
@@ -2413,13 +2414,13 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
if
(
mnodeMsg
->
retry
++
<
10
)
{
mDebug
(
"app:%p:%p, table:%s, create table rsp received, need retry, times:%d vgId:%d sid:%d uid:%"
PRIu64
" result:%s thandle:%p"
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
mnodeMsg
->
retry
,
pTable
->
vgId
,
pTable
->
s
id
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
mnodeMsg
->
retry
,
pTable
->
vgId
,
pTable
->
t
id
,
pTable
->
uid
,
tstrerror
(
rpcMsg
->
code
),
mnodeMsg
->
rpcMsg
.
handle
);
dnodeDelayReprocessMnodeWriteMsg
(
mnodeMsg
);
}
else
{
mError
(
"app:%p:%p, table:%s, failed to create in dnode, vgId:%d sid:%d uid:%"
PRIu64
", result:%s thandle:%p"
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
s
id
,
pTable
->
uid
,
mnodeMsg
->
rpcMsg
.
ahandle
,
mnodeMsg
,
pTable
->
info
.
tableId
,
pTable
->
vgId
,
pTable
->
t
id
,
pTable
->
uid
,
tstrerror
(
rpcMsg
->
code
),
mnodeMsg
->
rpcMsg
.
handle
);
SSdbOper
oper
=
{.
type
=
SDB_OPER_GLOBAL
,
.
table
=
tsChildTableSdb
,
.
pObj
=
pTable
};
...
...
@@ -2674,7 +2675,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
// tid
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
pTable
->
s
id
;
*
(
int32_t
*
)
pWrite
=
pTable
->
t
id
;
cols
++
;
//vgid
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
05325532
...
...
@@ -793,12 +793,12 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v
void
mnodeAddTableIntoVgroup
(
SVgObj
*
pVgroup
,
SChildTableObj
*
pTable
)
{
int32_t
idPoolSize
=
taosIdPoolMaxSize
(
pVgroup
->
idPool
);
if
(
pTable
->
s
id
>
idPoolSize
)
{
if
(
pTable
->
t
id
>
idPoolSize
)
{
mnodeAllocVgroupIdPool
(
pVgroup
);
}
if
(
pTable
->
s
id
>=
1
)
{
taosIdPoolMarkStatus
(
pVgroup
->
idPool
,
pTable
->
s
id
);
if
(
pTable
->
t
id
>=
1
)
{
taosIdPoolMarkStatus
(
pVgroup
->
idPool
,
pTable
->
t
id
);
pVgroup
->
numOfTables
++
;
// The create vgroup message may be received later than the create table message
// and the writing order in sdb is therefore uncertain
...
...
@@ -808,8 +808,8 @@ void mnodeAddTableIntoVgroup(SVgObj *pVgroup, SChildTableObj *pTable) {
}
void
mnodeRemoveTableFromVgroup
(
SVgObj
*
pVgroup
,
SChildTableObj
*
pTable
)
{
if
(
pTable
->
s
id
>=
1
)
{
taosFreeId
(
pVgroup
->
idPool
,
pTable
->
s
id
);
if
(
pTable
->
t
id
>=
1
)
{
taosFreeId
(
pVgroup
->
idPool
,
pTable
->
t
id
);
pVgroup
->
numOfTables
--
;
// The create vgroup message may be received later than the create table message
// and the writing order in sdb is therefore uncertain
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
05325532
...
...
@@ -239,7 +239,7 @@ STableCfg *tsdbCreateTableCfgFromMsg(SMDCreateTableMsg *pMsg) {
return
NULL
;
}
if
(
tsdbInitTableCfg
(
pCfg
,
pMsg
->
tableType
,
htobe64
(
pMsg
->
uid
),
htonl
(
pMsg
->
s
id
))
<
0
)
goto
_err
;
if
(
tsdbInitTableCfg
(
pCfg
,
pMsg
->
tableType
,
htobe64
(
pMsg
->
uid
),
htonl
(
pMsg
->
t
id
))
<
0
)
goto
_err
;
if
(
tdInitTSchemaBuilder
(
&
schemaBuilder
,
htonl
(
pMsg
->
sversion
))
<
0
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
goto
_err
;
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
05325532
...
...
@@ -149,7 +149,7 @@ static int32_t vnodeProcessDropTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet
int32_t
code
=
TSDB_CODE_SUCCESS
;
vDebug
(
"vgId:%d, table:%s, start to drop"
,
pVnode
->
vgId
,
pTable
->
tableId
);
STableId
tableId
=
{.
uid
=
htobe64
(
pTable
->
uid
),
.
tid
=
htonl
(
pTable
->
s
id
)};
STableId
tableId
=
{.
uid
=
htobe64
(
pTable
->
uid
),
.
tid
=
htonl
(
pTable
->
t
id
)};
if
(
tsdbDropTable
(
pVnode
->
tsdb
,
tableId
)
<
0
)
code
=
terrno
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录