Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
17b7b81c
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
17b7b81c
编写于
2月 04, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt index
上级
cc4558ff
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
49 deletion
+42
-49
source/dnode/mnode/impl/src/mndIndex.c
source/dnode/mnode/impl/src/mndIndex.c
+35
-48
source/dnode/mnode/sdb/src/sdbHash.c
source/dnode/mnode/sdb/src/sdbHash.c
+2
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+5
-1
未找到文件。
source/dnode/mnode/impl/src/mndIndex.c
浏览文件 @
17b7b81c
...
...
@@ -155,12 +155,12 @@ static SSdbRaw *mndIdxActionEncode(SIdxObj *pIdx) {
_OVER:
if
(
terrno
!=
0
)
{
mError
(
"
sma
:%s, failed to encode to raw:%p since %s"
,
pIdx
->
name
,
pRaw
,
terrstr
());
mError
(
"
idx
:%s, failed to encode to raw:%p since %s"
,
pIdx
->
name
,
pRaw
,
terrstr
());
sdbFreeRaw
(
pRaw
);
return
NULL
;
}
mTrace
(
"
sma
:%s, encode to raw:%p, row:%p"
,
pIdx
->
name
,
pRaw
,
pIdx
);
mTrace
(
"
idx
:%s, encode to raw:%p, row:%p"
,
pIdx
->
name
,
pRaw
,
pIdx
);
return
pRaw
;
}
...
...
@@ -329,7 +329,7 @@ static int32_t mndProcessCreateIdxReq(SRpcMsg *pReq) {
// goto _OVER;
// }
pDb
=
mndAcquireDbByStb
(
pMnode
,
createReq
.
dbF
Name
);
pDb
=
mndAcquireDbByStb
(
pMnode
,
createReq
.
stb
Name
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_DB
;
goto
_OVER
;
...
...
@@ -343,43 +343,31 @@ static int32_t mndProcessCreateIdxReq(SRpcMsg *pReq) {
pIdx
=
mndAcquireIdx
(
pMnode
,
createReq
.
idxName
);
if
(
pIdx
!=
NULL
)
{
// if (createReq.igExists) {
// mInfo("sma:%s, already exist in sma:%s, ignore exist is set", createReq.name, pSma->name);
// code = 0;
// goto _OVER;
// } else {
terrno
=
TSDB_CODE_MND_SMA_ALREADY_EXIST
;
goto
_OVER
;
//}
}
// pDb = mndAcquireDbByIdx(pMnode, createReq.idxName);
// if (pDb == NULL) {
// terrno = TSDB_CODE_MND_DB_NOT_SELECTED;
// goto _OVER;
/
e
}
if
(
mndCheckDbPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
goto
_OVER
;
}
if
(
mndCheckDbPrivilege
(
pMnode
,
pReq
->
info
.
conn
.
user
,
MND_OPER_WRITE_DB
,
pDb
)
!=
0
)
{
goto
_OVER
;
}
code
=
mndAddIndex
(
pMnode
,
pReq
,
&
createReq
,
pDb
,
pStb
);
if
(
terrno
==
TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST
||
terrno
==
TSDB_CODE_MND_TAG_NOT_EXIST
)
{
return
terrno
;
}
else
{
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
}
code
=
mndAddIndex
(
pMnode
,
pReq
,
&
createReq
,
pDb
,
pStb
);
if
(
terrno
==
TSDB_CODE_MND_TAG_INDEX_ALREADY_EXIST
||
terrno
==
TSDB_CODE_MND_TAG_NOT_EXIST
)
{
return
terrno
;
}
else
{
if
(
code
==
0
)
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
}
_OVER
:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"stb:%s, failed to create since %s"
,
createReq
.
idxName
,
terrstr
());
}
_OVER:
if
(
code
!=
0
&&
code
!=
TSDB_CODE_ACTION_IN_PROGRESS
)
{
mError
(
"stb:%s, failed to create since %s"
,
createReq
.
idxName
,
terrstr
());
}
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseIdx
(
pMnode
,
pIdx
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseStb
(
pMnode
,
pStb
);
mndReleaseIdx
(
pMnode
,
pIdx
);
mndReleaseDb
(
pMnode
,
pDb
);
return
code
;
return
code
;
}
static
int32_t
mndSetDropIdxRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SIdxObj
*
pIdx
)
{
...
...
@@ -387,7 +375,7 @@ static int32_t mndSetDropIdxRedoLogs(SMnode *pMnode, STrans *pTrans, SIdxObj *pI
if
(
pRedoRaw
==
NULL
)
return
-
1
;
if
(
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
return
-
1
;
if
(
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_DROPPING
)
!=
0
)
return
-
1
;
return
0
;
}
...
...
@@ -641,22 +629,20 @@ static int32_t mndCheckIndexReq(SCreateTagIndexReq *pReq) {
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndSetUpdateIdxStbCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStbObj
*
pOld
,
char
*
tagName
)
{
SStbObj
stbObj
=
{
0
};
SStbObj
*
pNew
=
&
stbObj
;
static
int32_t
mndSetUpdateIdxStbCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStbObj
*
pOld
,
SStbObj
*
pNew
,
char
*
tagName
)
{
taosRLockLatch
(
&
pOld
->
lock
);
memcpy
(
&
stbObj
,
pOld
,
sizeof
(
SStbObj
));
memcpy
(
pNew
,
pOld
,
sizeof
(
SStbObj
));
taosRUnLockLatch
(
&
pOld
->
lock
);
stbObj
.
numOfColumns
=
0
;
stbObj
.
pColumns
=
NULL
;
stbObj
.
numOfTags
=
0
;
stbObj
.
pTags
=
NULL
;
stbObj
.
numOfFuncs
=
0
;
stbObj
.
pFuncs
=
NULL
;
stbObj
.
updateTime
=
taosGetTimestampMs
();
stbObj
.
lock
=
0
;
// pNew->
numOfColumns = 0;
// pNew->
pColumns = NULL;
// pNew->
numOfTags = 0;
pNew
->
pTags
=
NULL
;
// pNew->
numOfFuncs = 0;
// pNew->
pFuncs = NULL;
pNew
->
updateTime
=
taosGetTimestampMs
();
pNew
->
lock
=
0
;
int32_t
tag
=
mndFindSuperTableTagId
(
pOld
,
tagName
);
if
(
tag
<
0
)
{
...
...
@@ -690,6 +676,7 @@ static int32_t mndSetUpdateIdxStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb
int32_t
mndAddIndexImpl
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pDb
,
SStbObj
*
pStb
,
SIdxObj
*
pIdx
)
{
// impl later
int32_t
code
=
0
;
SStbObj
newStb
=
{
0
};
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB_INSIDE
,
pReq
,
"create-stb-index"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
...
...
@@ -702,8 +689,8 @@ int32_t mndAddIndexImpl(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pSt
if
(
mndSetCreateIdxRedoLogs
(
pMnode
,
pTrans
,
pIdx
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateIdxCommitLogs
(
pMnode
,
pTrans
,
pIdx
)
!=
0
)
goto
_OVER
;
if
(
mndSetUpdateIdxStbCommitLogs
(
pMnode
,
pTrans
,
pStb
,
pIdx
->
colName
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateIdxRedoActions
(
pMnode
,
pTrans
,
pDb
,
p
Stb
,
pIdx
)
!=
0
)
goto
_OVER
;
if
(
mndSetUpdateIdxStbCommitLogs
(
pMnode
,
pTrans
,
pStb
,
&
newStb
,
pIdx
->
colName
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateIdxRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
new
Stb
,
pIdx
)
!=
0
)
goto
_OVER
;
// if (mndSetAlterStbRedoLogs(pMnode, pTrans, pDb, pStb) != 0) goto _OVER;
// if (mndSetAlterStbCommitLogs(pMnode, pTrans, pDb, pStb) != 0) goto _OVER;
...
...
source/dnode/mnode/sdb/src/sdbHash.c
浏览文件 @
17b7b81c
...
...
@@ -60,6 +60,8 @@ const char *sdbTableName(ESdbType type) {
return
"db"
;
case
SDB_FUNC
:
return
"func"
;
case
SDB_IDX
:
return
"idx"
;
default:
return
"undefine"
;
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
17b7b81c
...
...
@@ -5340,10 +5340,14 @@ static int32_t buildCreateFullTextReq(STranslateContext* pCxt, SCreateIndexStmt*
static
int32_t
buildCreateTagIndexReq
(
STranslateContext
*
pCxt
,
SCreateIndexStmt
*
pStmt
,
SCreateTagIndexReq
*
pReq
)
{
SName
name
;
tNameExtractFullName
(
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
indexDbName
,
pStmt
->
indexName
,
&
name
),
pReq
->
dbF
Name
);
tNameExtractFullName
(
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
indexDbName
,
pStmt
->
indexName
,
&
name
),
pReq
->
idx
Name
);
memset
(
&
name
,
0
,
sizeof
(
SName
));
tNameExtractFullName
(
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
name
),
pReq
->
stbName
);
memset
(
&
name
,
0
,
sizeof
(
SName
));
tNameSetDbName
(
&
name
,
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
strlen
(
pStmt
->
dbName
));
tNameGetFullDbName
(
&
name
,
pReq
->
dbFName
);
SNode
*
pNode
=
NULL
;
ASSERT
(
LIST_LENGTH
(
pStmt
->
pCols
)
==
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录