Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6b68a373
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6b68a373
编写于
4月 11, 2023
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: when update func, set createdtime to original time
上级
765c09d5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
18 deletion
+20
-18
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+20
-18
未找到文件。
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
6b68a373
...
@@ -145,8 +145,8 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) {
...
@@ -145,8 +145,8 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) {
goto
_OVER
;
goto
_OVER
;
}
}
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pFunc
->
pCode
,
pFunc
->
codeSize
,
_OVER
)
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pFunc
->
pCode
,
pFunc
->
codeSize
,
_OVER
)
if
(
sver
>=
2
)
{
if
(
sver
>=
2
)
{
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pFunc
->
funcVersion
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pFunc
->
funcVersion
,
_OVER
)
}
}
...
@@ -181,7 +181,7 @@ static int32_t mndFuncActionDelete(SSdb *pSdb, SFuncObj *pFunc) {
...
@@ -181,7 +181,7 @@ static int32_t mndFuncActionDelete(SSdb *pSdb, SFuncObj *pFunc) {
static
int32_t
mndFuncActionUpdate
(
SSdb
*
pSdb
,
SFuncObj
*
pOld
,
SFuncObj
*
pNew
)
{
static
int32_t
mndFuncActionUpdate
(
SSdb
*
pSdb
,
SFuncObj
*
pOld
,
SFuncObj
*
pNew
)
{
mTrace
(
"func:%s, perform update action, old row:%p new row:%p"
,
pOld
->
name
,
pOld
,
pNew
);
mTrace
(
"func:%s, perform update action, old row:%p new row:%p"
,
pOld
->
name
,
pOld
,
pNew
);
taosWLockLatch
(
&
pOld
->
lock
);
taosWLockLatch
(
&
pOld
->
lock
);
pOld
->
align
=
pNew
->
align
;
pOld
->
align
=
pNew
->
align
;
...
@@ -194,21 +194,21 @@ static int32_t mndFuncActionUpdate(SSdb *pSdb, SFuncObj *pOld, SFuncObj *pNew) {
...
@@ -194,21 +194,21 @@ static int32_t mndFuncActionUpdate(SSdb *pSdb, SFuncObj *pOld, SFuncObj *pNew) {
pOld
->
outputLen
=
pNew
->
outputLen
;
pOld
->
outputLen
=
pNew
->
outputLen
;
pOld
->
outputType
=
pNew
->
outputType
;
pOld
->
outputType
=
pNew
->
outputType
;
if
(
pOld
->
pComment
!=
NULL
)
{
if
(
pOld
->
pComment
!=
NULL
)
{
taosMemoryFree
(
pOld
->
pComment
);
taosMemoryFree
(
pOld
->
pComment
);
pOld
->
pComment
=
NULL
;
pOld
->
pComment
=
NULL
;
}
}
if
(
pNew
->
commentSize
>
0
&&
pNew
->
pComment
!=
NULL
)
{
if
(
pNew
->
commentSize
>
0
&&
pNew
->
pComment
!=
NULL
)
{
pOld
->
commentSize
=
pNew
->
commentSize
;
pOld
->
commentSize
=
pNew
->
commentSize
;
pOld
->
pComment
=
taosMemoryMalloc
(
pOld
->
commentSize
);
pOld
->
pComment
=
taosMemoryMalloc
(
pOld
->
commentSize
);
memcpy
(
pOld
->
pComment
,
pNew
->
pComment
,
pOld
->
commentSize
);
memcpy
(
pOld
->
pComment
,
pNew
->
pComment
,
pOld
->
commentSize
);
}
}
if
(
pOld
->
pCode
!=
NULL
)
{
if
(
pOld
->
pCode
!=
NULL
)
{
taosMemoryFree
(
pOld
->
pCode
);
taosMemoryFree
(
pOld
->
pCode
);
pOld
->
pCode
=
NULL
;
pOld
->
pCode
=
NULL
;
}
}
if
(
pNew
->
codeSize
>
0
&&
pNew
->
pCode
!=
NULL
)
{
if
(
pNew
->
codeSize
>
0
&&
pNew
->
pCode
!=
NULL
)
{
pOld
->
codeSize
=
pNew
->
codeSize
;
pOld
->
codeSize
=
pNew
->
codeSize
;
pOld
->
pCode
=
taosMemoryMalloc
(
pOld
->
codeSize
);
pOld
->
pCode
=
taosMemoryMalloc
(
pOld
->
codeSize
);
memcpy
(
pOld
->
pCode
,
pNew
->
pCode
,
pOld
->
codeSize
);
memcpy
(
pOld
->
pCode
,
pNew
->
pCode
,
pOld
->
codeSize
);
...
@@ -216,7 +216,7 @@ static int32_t mndFuncActionUpdate(SSdb *pSdb, SFuncObj *pOld, SFuncObj *pNew) {
...
@@ -216,7 +216,7 @@ static int32_t mndFuncActionUpdate(SSdb *pSdb, SFuncObj *pOld, SFuncObj *pNew) {
pOld
->
scriptType
=
pNew
->
scriptType
;
pOld
->
scriptType
=
pNew
->
scriptType
;
pOld
->
signature
=
pNew
->
signature
;
pOld
->
signature
=
pNew
->
signature
;
taosWUnLockLatch
(
&
pOld
->
lock
);
taosWUnLockLatch
(
&
pOld
->
lock
);
return
0
;
return
0
;
...
@@ -268,14 +268,15 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
...
@@ -268,14 +268,15 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
memcpy
(
func
.
pComment
,
pCreate
->
pComment
,
func
.
commentSize
);
memcpy
(
func
.
pComment
,
pCreate
->
pComment
,
func
.
commentSize
);
}
}
memcpy
(
func
.
pCode
,
pCreate
->
pCode
,
func
.
codeSize
);
memcpy
(
func
.
pCode
,
pCreate
->
pCode
,
func
.
codeSize
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
,
"create-func"
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pReq
,
"create-func"
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mInfo
(
"trans:%d, used to create func:%s"
,
pTrans
->
id
,
pCreate
->
name
);
mInfo
(
"trans:%d, used to create func:%s"
,
pTrans
->
id
,
pCreate
->
name
);
SFuncObj
*
oldFunc
=
mndAcquireFunc
(
pMnode
,
pCreate
->
name
);
SFuncObj
*
oldFunc
=
mndAcquireFunc
(
pMnode
,
pCreate
->
name
);
if
(
pCreate
->
orReplace
==
1
&&
oldFunc
!=
NULL
)
{
if
(
pCreate
->
orReplace
==
1
&&
oldFunc
!=
NULL
)
{
func
.
funcVersion
=
oldFunc
->
funcVersion
+
1
;
func
.
funcVersion
=
oldFunc
->
funcVersion
+
1
;
func
.
createdTime
=
oldFunc
->
createdTime
;
SSdbRaw
*
pRedoRaw
=
mndFuncActionEncode
(
oldFunc
);
SSdbRaw
*
pRedoRaw
=
mndFuncActionEncode
(
oldFunc
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
goto
_OVER
;
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
goto
_OVER
;
...
@@ -288,8 +289,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
...
@@ -288,8 +289,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
SSdbRaw
*
pCommitRaw
=
mndFuncActionEncode
(
&
func
);
SSdbRaw
*
pCommitRaw
=
mndFuncActionEncode
(
&
func
);
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
goto
_OVER
;
if
(
pCommitRaw
==
NULL
||
mndTransAppendCommitlog
(
pTrans
,
pCommitRaw
)
!=
0
)
goto
_OVER
;
if
(
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_READY
)
!=
0
)
goto
_OVER
;
if
(
sdbSetRawStatus
(
pCommitRaw
,
SDB_STATUS_READY
)
!=
0
)
goto
_OVER
;
}
}
else
{
else
{
SSdbRaw
*
pRedoRaw
=
mndFuncActionEncode
(
&
func
);
SSdbRaw
*
pRedoRaw
=
mndFuncActionEncode
(
&
func
);
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
goto
_OVER
;
if
(
pRedoRaw
==
NULL
||
mndTransAppendRedolog
(
pTrans
,
pRedoRaw
)
!=
0
)
goto
_OVER
;
if
(
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_CREATING
)
!=
0
)
goto
_OVER
;
if
(
sdbSetRawStatus
(
pRedoRaw
,
SDB_STATUS_CREATING
)
!=
0
)
goto
_OVER
;
...
@@ -308,7 +308,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
...
@@ -308,7 +308,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
code
=
0
;
code
=
0
;
_OVER:
_OVER:
if
(
oldFunc
!=
NULL
)
{
if
(
oldFunc
!=
NULL
)
{
mndReleaseFunc
(
pMnode
,
oldFunc
);
mndReleaseFunc
(
pMnode
,
oldFunc
);
}
}
...
@@ -628,7 +628,7 @@ static int32_t mndRetrieveFuncs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
...
@@ -628,7 +628,7 @@ static int32_t mndRetrieveFuncs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pFunc
->
bufSize
,
false
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pFunc
->
bufSize
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
char
*
language
=
""
;
char
*
language
=
""
;
if
(
pFunc
->
scriptType
==
TSDB_FUNC_SCRIPT_BIN_LIB
)
{
if
(
pFunc
->
scriptType
==
TSDB_FUNC_SCRIPT_BIN_LIB
)
{
language
=
"C"
;
language
=
"C"
;
}
else
if
(
pFunc
->
scriptType
==
TSDB_FUNC_SCRIPT_PYTHON
)
{
}
else
if
(
pFunc
->
scriptType
==
TSDB_FUNC_SCRIPT_PYTHON
)
{
...
@@ -640,15 +640,17 @@ static int32_t mndRetrieveFuncs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
...
@@ -640,15 +640,17 @@ static int32_t mndRetrieveFuncs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
varLang
,
false
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
varLang
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
int32_t
varCodeLen
=
(
pFunc
->
codeSize
+
VARSTR_HEADER_SIZE
)
>
TSDB_MAX_BINARY_LEN
?
TSDB_MAX_BINARY_LEN
:
pFunc
->
codeSize
+
VARSTR_HEADER_SIZE
;
int32_t
varCodeLen
=
(
pFunc
->
codeSize
+
VARSTR_HEADER_SIZE
)
>
TSDB_MAX_BINARY_LEN
char
*
b4
=
taosMemoryMalloc
(
varCodeLen
);
?
TSDB_MAX_BINARY_LEN
:
pFunc
->
codeSize
+
VARSTR_HEADER_SIZE
;
char
*
b4
=
taosMemoryMalloc
(
varCodeLen
);
memcpy
(
varDataVal
(
b4
),
pFunc
->
pCode
,
varCodeLen
-
VARSTR_HEADER_SIZE
);
memcpy
(
varDataVal
(
b4
),
pFunc
->
pCode
,
varCodeLen
-
VARSTR_HEADER_SIZE
);
varDataSetLen
(
b4
,
varCodeLen
-
VARSTR_HEADER_SIZE
);
varDataSetLen
(
b4
,
varCodeLen
-
VARSTR_HEADER_SIZE
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b4
,
false
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b4
,
false
);
taosMemoryFree
(
b4
);
taosMemoryFree
(
b4
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pFunc
->
funcVersion
,
false
);
colDataSetVal
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pFunc
->
funcVersion
,
false
);
numOfRows
++
;
numOfRows
++
;
sdbRelease
(
pSdb
,
pFunc
);
sdbRelease
(
pSdb
,
pFunc
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录