Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2ba6ac5f
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,发现更多精彩内容 >>
提交
2ba6ac5f
编写于
7月 27, 2022
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:add ts,table name from SDeleterRes
上级
0952c986
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
51 addition
and
47 deletion
+51
-47
include/common/tmsg.h
include/common/tmsg.h
+2
-1
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+2
-1
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+3
-3
source/client/src/tmq.c
source/client/src/tmq.c
+31
-31
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/libs/executor/src/dataDeleter.c
source/libs/executor/src/dataDeleter.c
+2
-1
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+1
-1
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+2
-2
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+2
-4
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+2
-2
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+2
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
2ba6ac5f
...
...
@@ -3044,7 +3044,8 @@ typedef struct SDeleteRes {
int64_t
skey
;
int64_t
ekey
;
int64_t
affectedRows
;
char
tableFName
[
TSDB_TABLE_FNAME_LEN
];
char
tableFName
[
TSDB_TABLE_NAME_LEN
];
char
tsColName
[
TSDB_COL_NAME_LEN
];
}
SDeleteRes
;
int32_t
tEncodeDeleteRes
(
SEncoder
*
pCoder
,
const
SDeleteRes
*
pRes
);
...
...
include/libs/executor/dataSinkMgt.h
浏览文件 @
2ba6ac5f
...
...
@@ -38,7 +38,8 @@ typedef struct SDeleterRes {
int64_t
skey
;
int64_t
ekey
;
int64_t
affectedRows
;
char
tableFName
[
TSDB_TABLE_FNAME_LEN
];
char
tableName
[
TSDB_TABLE_NAME_LEN
];
char
tsColName
[
TSDB_COL_NAME_LEN
];
}
SDeleterRes
;
typedef
struct
SDeleterParam
{
...
...
include/libs/nodes/plannodes.h
浏览文件 @
2ba6ac5f
...
...
@@ -151,7 +151,7 @@ typedef struct SVnodeModifyLogicNode {
uint64_t
tableId
;
uint64_t
stableId
;
int8_t
tableType
;
// table type
char
table
FName
[
TSDB_TABLE_F
NAME_LEN
];
char
table
Name
[
TSDB_TABLE_
NAME_LEN
];
char
tsColName
[
TSDB_COL_NAME_LEN
];
STimeWindow
deleteTimeRange
;
SVgroupsInfo
*
pVgroupList
;
...
...
@@ -494,7 +494,7 @@ typedef struct SQueryInserterNode {
uint64_t
tableId
;
uint64_t
stableId
;
int8_t
tableType
;
// table type
char
table
FName
[
TSDB_TABLE_F
NAME_LEN
];
char
table
Name
[
TSDB_TABLE_
NAME_LEN
];
int32_t
vgId
;
SEpSet
epSet
;
}
SQueryInserterNode
;
...
...
@@ -503,7 +503,7 @@ typedef struct SDataDeleterNode {
SDataSinkNode
sink
;
uint64_t
tableId
;
int8_t
tableType
;
// table type
char
tableFName
[
TSDB_TABLE_
F
NAME_LEN
];
char
tableFName
[
TSDB_TABLE_NAME_LEN
];
char
tsColName
[
TSDB_COL_NAME_LEN
];
STimeWindow
deleteTimeRange
;
SNode
*
pAffectedRows
;
...
...
source/client/src/tmq.c
浏览文件 @
2ba6ac5f
...
...
@@ -2823,35 +2823,35 @@ end:
// delete from db.tabl where .. -> delete from tabl where ..
// delete from db .tabl where .. -> delete from tabl where ..
static
void
getTbName
(
char
*
sql
){
char
*
ch
=
sql
;
bool
inBackQuote
=
false
;
int8_t
dotIndex
=
0
;
while
(
*
ch
!=
'\0'
){
if
(
!
inBackQuote
&&
*
ch
==
'`'
){
inBackQuote
=
true
;
ch
++
;
continue
;
}
if
(
inBackQuote
&&
*
ch
==
'`'
){
inBackQuote
=
false
;
ch
++
;
continue
;
}
if
(
!
inBackQuote
&&
*
ch
==
'.'
){
dotIndex
++
;
if
(
dotIndex
==
2
){
memmove
(
sql
,
ch
+
1
,
strlen
(
ch
+
1
)
+
1
);
break
;
}
}
ch
++
;
}
}
//
static void getTbName(char *sql){
//
char *ch = sql;
//
//
bool inBackQuote = false;
//
int8_t dotIndex = 0;
//
while(*ch != '\0'){
//
if(!inBackQuote && *ch == '`'){
//
inBackQuote = true;
//
ch++;
//
continue;
//
}
//
//
if(inBackQuote && *ch == '`'){
//
inBackQuote = false;
//
ch++;
//
//
continue;
//
}
//
//
if(!inBackQuote && *ch == '.'){
//
dotIndex ++;
//
if(dotIndex == 2){
//
memmove(sql, ch + 1, strlen(ch + 1) + 1);
//
break;
//
}
//
}
//
ch++;
//
}
//
}
static
int32_t
taosDeleteData
(
TAOS
*
taos
,
void
*
meta
,
int32_t
metaLen
)
{
SDeleteRes
req
=
{
0
};
...
...
@@ -2867,9 +2867,9 @@ static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) {
goto
end
;
}
getTbName
(
req
.
tableFName
);
//
getTbName(req.tableFName);
char
sql
[
256
]
=
{
0
};
sprintf
(
sql
,
"delete from `%s` where `%s` >= %"
PRId64
" and `%s` <= %"
PRId64
,
req
.
tableFName
,
"ts"
,
req
.
skey
,
"ts"
,
req
.
ekey
);
sprintf
(
sql
,
"delete from `%s` where `%s` >= %"
PRId64
" and `%s` <= %"
PRId64
,
req
.
tableFName
,
req
.
tsColName
,
req
.
skey
,
req
.
tsColName
,
req
.
ekey
);
printf
(
"delete sql:%s
\n
"
,
sql
);
TAOS_RES
*
res
=
taos_query
(
taos
,
sql
);
...
...
source/common/src/tmsg.c
浏览文件 @
2ba6ac5f
...
...
@@ -5682,6 +5682,7 @@ int32_t tEncodeDeleteRes(SEncoder *pCoder, const SDeleteRes *pRes) {
if
(
tEncodeI64v
(
pCoder
,
pRes
->
affectedRows
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pRes
->
tableFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pRes
->
tsColName
)
<
0
)
return
-
1
;
return
0
;
}
...
...
@@ -5700,6 +5701,7 @@ int32_t tDecodeDeleteRes(SDecoder *pCoder, SDeleteRes *pRes) {
if
(
tDecodeI64v
(
pCoder
,
&
pRes
->
affectedRows
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pCoder
,
pRes
->
tableFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
pCoder
,
pRes
->
tsColName
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tEncodeSMqDataRsp
(
SEncoder
*
pEncoder
,
const
SMqDataRsp
*
pRsp
)
{
...
...
source/libs/executor/src/dataDeleter.c
浏览文件 @
2ba6ac5f
...
...
@@ -90,7 +90,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp
pRes
->
uidList
=
pHandle
->
pParam
->
pUidList
;
pRes
->
skey
=
pHandle
->
pDeleter
->
deleteTimeRange
.
skey
;
pRes
->
ekey
=
pHandle
->
pDeleter
->
deleteTimeRange
.
ekey
;
strcpy
(
pRes
->
tableFName
,
pHandle
->
pDeleter
->
tableFName
);
strcpy
(
pRes
->
tableName
,
pHandle
->
pDeleter
->
tableFName
);
strcpy
(
pRes
->
tsColName
,
pHandle
->
pDeleter
->
tsColName
);
pRes
->
affectedRows
=
*
(
int64_t
*
)
pColRes
->
pData
;
pBuf
->
useSize
+=
pEntry
->
dataLen
;
...
...
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
2ba6ac5f
...
...
@@ -401,7 +401,7 @@ static int32_t logicVnodeModifCopy(const SVnodeModifyLogicNode* pSrc, SVnodeModi
COPY_SCALAR_FIELD
(
tableId
);
COPY_SCALAR_FIELD
(
stableId
);
COPY_SCALAR_FIELD
(
tableType
);
COPY_CHAR_ARRAY_FIELD
(
table
F
Name
);
COPY_CHAR_ARRAY_FIELD
(
tableName
);
COPY_CHAR_ARRAY_FIELD
(
tsColName
);
COPY_OBJECT_FIELD
(
deleteTimeRange
,
sizeof
(
STimeWindow
));
CLONE_OBJECT_FIELD
(
pVgroupList
,
vgroupsInfoClone
);
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
2ba6ac5f
...
...
@@ -2326,7 +2326,7 @@ static int32_t physiQueryInsertNodeToJson(const void* pObj, SJson* pJson) {
code
=
tjsonAddIntegerToObject
(
pJson
,
jkQueryInsertPhysiPlanTableType
,
pNode
->
tableType
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddStringToObject
(
pJson
,
jkQueryInsertPhysiPlanTableFName
,
pNode
->
table
F
Name
);
code
=
tjsonAddStringToObject
(
pJson
,
jkQueryInsertPhysiPlanTableFName
,
pNode
->
tableName
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddIntegerToObject
(
pJson
,
jkQueryInsertPhysiPlanVgId
,
pNode
->
vgId
);
...
...
@@ -2355,7 +2355,7 @@ static int32_t jsonToPhysiQueryInsertNode(const SJson* pJson, void* pObj) {
code
=
tjsonGetTinyIntValue
(
pJson
,
jkQueryInsertPhysiPlanTableType
,
&
pNode
->
tableType
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetStringValue
(
pJson
,
jkQueryInsertPhysiPlanTableFName
,
pNode
->
table
F
Name
);
code
=
tjsonGetStringValue
(
pJson
,
jkQueryInsertPhysiPlanTableFName
,
pNode
->
tableName
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetIntValue
(
pJson
,
jkQueryInsertPhysiPlanVgId
,
&
pNode
->
vgId
);
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
2ba6ac5f
...
...
@@ -1292,8 +1292,7 @@ static int32_t createVnodeModifLogicNodeByDelete(SLogicPlanContext* pCxt, SDelet
pModify
->
modifyType
=
MODIFY_TABLE_TYPE_DELETE
;
pModify
->
tableId
=
pRealTable
->
pMeta
->
uid
;
pModify
->
tableType
=
pRealTable
->
pMeta
->
tableType
;
snprintf
(
pModify
->
tableFName
,
sizeof
(
pModify
->
tableFName
),
"%d.%s.%s"
,
pCxt
->
pPlanCxt
->
acctId
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
);
snprintf
(
pModify
->
tableName
,
sizeof
(
pModify
->
tableName
),
"%s"
,
pRealTable
->
table
.
tableName
);
strcpy
(
pModify
->
tsColName
,
pRealTable
->
pMeta
->
schema
->
name
);
pModify
->
deleteTimeRange
=
pDelete
->
timeRange
;
pModify
->
pAffectedRows
=
nodesCloneNode
(
pDelete
->
pCountFunc
);
...
...
@@ -1343,8 +1342,7 @@ static int32_t createVnodeModifLogicNodeByInsert(SLogicPlanContext* pCxt, SInser
pModify
->
tableId
=
pRealTable
->
pMeta
->
uid
;
pModify
->
stableId
=
pRealTable
->
pMeta
->
suid
;
pModify
->
tableType
=
pRealTable
->
pMeta
->
tableType
;
snprintf
(
pModify
->
tableFName
,
sizeof
(
pModify
->
tableFName
),
"%d.%s.%s"
,
pCxt
->
pPlanCxt
->
acctId
,
pRealTable
->
table
.
dbName
,
pRealTable
->
table
.
tableName
);
snprintf
(
pModify
->
tableName
,
sizeof
(
pModify
->
tableName
),
"%s"
,
pRealTable
->
table
.
tableName
);
TSWAP
(
pModify
->
pVgroupList
,
pRealTable
->
pVgroupList
);
pModify
->
pInsertCols
=
nodesCloneList
(
pInsert
->
pCols
);
if
(
NULL
==
pModify
->
pInsertCols
)
{
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
2ba6ac5f
...
...
@@ -1586,7 +1586,7 @@ static int32_t createQueryInserter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNod
pInserter
->
tableId
=
pModify
->
tableId
;
pInserter
->
stableId
=
pModify
->
stableId
;
pInserter
->
tableType
=
pModify
->
tableType
;
strcpy
(
pInserter
->
table
FName
,
pModify
->
tableF
Name
);
strcpy
(
pInserter
->
table
Name
,
pModify
->
table
Name
);
pInserter
->
vgId
=
pModify
->
pVgroupList
->
vgroups
[
0
].
vgId
;
pInserter
->
epSet
=
pModify
->
pVgroupList
->
vgroups
[
0
].
epSet
;
vgroupInfoToNodeAddr
(
pModify
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
...
...
@@ -1636,7 +1636,7 @@ static int32_t createDataDeleter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNode*
pDeleter
->
tableId
=
pModify
->
tableId
;
pDeleter
->
tableType
=
pModify
->
tableType
;
strcpy
(
pDeleter
->
tableFName
,
pModify
->
table
F
Name
);
strcpy
(
pDeleter
->
tableFName
,
pModify
->
tableName
);
strcpy
(
pDeleter
->
tsColName
,
pModify
->
tsColName
);
pDeleter
->
deleteTimeRange
=
pModify
->
deleteTimeRange
;
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
2ba6ac5f
...
...
@@ -283,7 +283,8 @@ int32_t qwGetDeleteResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SDeleteRes *pRes
pRes
->
skey
=
pDelRes
->
skey
;
pRes
->
ekey
=
pDelRes
->
ekey
;
pRes
->
affectedRows
=
pDelRes
->
affectedRows
;
strcpy
(
pRes
->
tableFName
,
pDelRes
->
tableFName
);
strcpy
(
pRes
->
tableFName
,
pDelRes
->
tableName
);
strcpy
(
pRes
->
tsColName
,
pDelRes
->
tsColName
);
taosMemoryFree
(
output
.
pData
);
return
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录