Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
33af9c27
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
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看板
提交
33af9c27
编写于
10月 21, 2020
作者:
Y
yihaoDeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-1589
上级
f9e1ca94
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
67 addition
and
14 deletion
+67
-14
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+42
-8
src/client/src/tscServer.c
src/client/src/tscServer.c
+8
-4
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+2
-2
src/inc/taosmsg.h
src/inc/taosmsg.h
+9
-0
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+6
-0
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
33af9c27
...
@@ -3710,7 +3710,7 @@ int32_t handleExprInDelCond(SSqlCmd* pCmd, SQueryInfo *pQueryInfo, tSQLExpr* pEx
...
@@ -3710,7 +3710,7 @@ int32_t handleExprInDelCond(SSqlCmd* pCmd, SQueryInfo *pQueryInfo, tSQLExpr* pEx
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
getDelCond
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSQLExpr
*
pExpr
)
{
int32_t
getDelCond
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSQLExpr
*
pExpr
,
int64_t
**
tsBuf
,
int32_t
*
sz
)
{
if
(
pExpr
==
NULL
)
{
if
(
pExpr
==
NULL
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -3731,24 +3731,29 @@ int32_t getDelCond(SSqlCmd* pCmd, SQueryInfo *pQueryInfo, tSQLExpr* pExpr) {
...
@@ -3731,24 +3731,29 @@ int32_t getDelCond(SSqlCmd* pCmd, SQueryInfo *pQueryInfo, tSQLExpr* pExpr) {
if
(
pRight
==
NULL
||
pRight
->
nSQLOptr
!=
TK_SET
||
pRight
->
pParam
==
NULL
)
{
if
(
pRight
==
NULL
||
pRight
->
nSQLOptr
!=
TK_SET
||
pRight
->
pParam
==
NULL
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
int32_t
nParam
=
pRight
->
pParam
->
nExpr
;
int32_t
nParam
=
pRight
->
pParam
->
nExpr
;
int64_t
*
tsBuf
=
malloc
(
sizeof
(
int64_t
)
*
nParam
);
*
tsBuf
=
malloc
(
sizeof
(
int64_t
)
*
nParam
);
*
sz
=
nParam
;
if
(
*
tsBuf
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
for
(
int
i
=
0
;
i
<
nParam
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nParam
;
i
++
)
{
int64_t
ts
;
int64_t
ts
;
if
(
getTimeFromExpr
(
pRight
->
pParam
->
a
[
i
].
pNode
,
timePrecision
,
&
ts
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getTimeFromExpr
(
pRight
->
pParam
->
a
[
i
].
pNode
,
timePrecision
,
&
ts
)
!=
TSDB_CODE_SUCCESS
)
{
free
(
tsBuf
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
else
{
}
else
{
tsBuf
[
i
]
=
ts
;
(
*
tsBuf
)
[
i
]
=
ts
;
}
}
}
}
qsort
(
tsBuf
,
nParam
,
sizeof
(
tsBuf
[
0
]),
compareInt64Val
);
qsort
(
*
tsBuf
,
nParam
,
sizeof
((
*
tsBuf
)[
0
]),
getComparFunc
(
TSDB_DATA_TYPE_TIMESTAMP
,
0
)
);
}
else
{
}
else
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
}
else
{
}
else
{
return
TSDB_CODE_TSC_INVALID_SQL
;
return
TSDB_CODE_TSC_INVALID_SQL
;
}
}
return
TSDB_CODE_SUCCESS
;
//const char* msg1 = "del condition must use 'or'";
//const char* msg1 = "del condition must use 'or'";
//tSQLExpr* pLeft = pExpr->pLeft;
//tSQLExpr* pLeft = pExpr->pLeft;
//tSQLExpr* pRight = pExpr->pRight;
//tSQLExpr* pRight = pExpr->pRight;
...
@@ -4643,6 +4648,7 @@ int32_t setDelInfo(SSqlObj *pSql, struct SSqlInfo* pInfo) {
...
@@ -4643,6 +4648,7 @@ int32_t setDelInfo(SSqlObj *pSql, struct SSqlInfo* pInfo) {
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg1
=
"invalid table name"
;
const
char
*
msg2
=
"invalid delete sql"
;
const
char
*
msg2
=
"invalid delete sql"
;
const
char
*
msg3
=
"delete can not be supported by super table"
;
const
char
*
msg3
=
"delete can not be supported by super table"
;
const
char
*
msg4
=
"delete only supported by record"
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
...
@@ -4674,15 +4680,43 @@ int32_t setDelInfo(SSqlObj *pSql, struct SSqlInfo* pInfo) {
...
@@ -4674,15 +4680,43 @@ int32_t setDelInfo(SSqlObj *pSql, struct SSqlInfo* pInfo) {
return
code
;
return
code
;
}
}
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
if
(
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
}
}
int64_t
*
tsBuf
=
NULL
;
int32_t
sz
=
0
;
if
(
pDelSql
->
pWhere
!=
NULL
)
{
if
(
pDelSql
->
pWhere
!=
NULL
)
{
if
(
getDelCond
(
pCmd
,
pQueryInfo
,
pDelSql
->
pWhere
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
getDelCond
(
pCmd
,
pQueryInfo
,
pDelSql
->
pWhere
,
&
tsBuf
,
&
sz
)
!=
TSDB_CODE_SUCCESS
)
{
free
(
tsBuf
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
}
}
}
else
{
return
TSDB_CODE_SUCCESS
;
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg4
);
}
if
((
code
=
tscAllocPayload
(
pCmd
,
sizeof
(
SDeleteMsg
)
+
sz
*
sizeof
(
tsBuf
[
0
])
+
64
))
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
SDeleteMsg
*
pDelMsg
=
(
SDeleteMsg
*
)
pCmd
->
payload
;
pDelMsg
->
head
.
contLen
=
htonl
(
sizeof
(
SDeleteMsg
)
+
sz
*
sizeof
(
tsBuf
[
0
]));
pDelMsg
->
head
.
vgId
=
htonl
(
pTableMeta
->
vgroupInfo
.
vgId
);
pDelMsg
->
uid
=
htobe64
(
pTableMeta
->
id
.
uid
);
pDelMsg
->
tid
=
htonl
(
pTableMeta
->
id
.
tid
);
pDelMsg
->
tversion
=
htons
(
pTableMeta
->
tversion
);
pDelMsg
->
delValLen
=
htonl
(
sz
);
int64_t
*
data
=
(
int64_t
*
)(
pDelMsg
->
data
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
*
data
=
htobe64
(
*
data
);
data
+=
1
;
}
pCmd
->
payloadLen
=
sizeof
(
SDeleteMsg
)
+
sz
*
sizeof
(
tsBuf
[
0
]);
free
(
tsBuf
);
return
code
;
}
}
int32_t
setAlterTableInfo
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
)
{
int32_t
setAlterTableInfo
(
SSqlObj
*
pSql
,
struct
SSqlInfo
*
pInfo
)
{
const
int32_t
DEFAULT_TABLE_INDEX
=
0
;
const
int32_t
DEFAULT_TABLE_INDEX
=
0
;
...
...
src/client/src/tscServer.c
浏览文件 @
33af9c27
...
@@ -409,6 +409,7 @@ int doProcessSql(SSqlObj *pSql) {
...
@@ -409,6 +409,7 @@ int doProcessSql(SSqlObj *pSql) {
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
||
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
||
pCmd
->
command
==
TSDB_SQL_FETCH
||
pCmd
->
command
==
TSDB_SQL_FETCH
||
pCmd
->
command
==
TSDB_SQL_DELETE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_INSERT
||
pCmd
->
command
==
TSDB_SQL_INSERT
||
pCmd
->
command
==
TSDB_SQL_DELETE
||
pCmd
->
command
==
TSDB_SQL_DELETE
||
...
@@ -521,6 +522,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -521,6 +522,7 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pShellMsg
->
numOfBlocks
=
htonl
(
pSql
->
cmd
.
numOfTablesInSubmit
);
// number of tables to be inserted
pShellMsg
->
numOfBlocks
=
htonl
(
pSql
->
cmd
.
numOfTablesInSubmit
);
// number of tables to be inserted
// pSql->cmd.payloadLen is set during copying data into payload
// pSql->cmd.payloadLen is set during copying data into payload
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
tscDumpEpSetFromVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pSql
->
epSet
);
tscDumpEpSetFromVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pSql
->
epSet
);
...
@@ -533,12 +535,14 @@ int tscBuildDelMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -533,12 +535,14 @@ int tscBuildDelMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMeta
*
pTableMeta
=
tscGetMetaInfo
(
pQueryInfo
,
0
)
->
pTableMeta
;
STableMeta
*
pTableMeta
=
tscGetMetaInfo
(
pQueryInfo
,
0
)
->
pTableMeta
;
char
*
pMsg
=
pSql
->
cmd
.
payload
;
//char* pMsg = pSql->cmd.payload;
// NOTE: shell message size should not include SMsgDesc
// NOTE: shell message size should not include SMsgDesc
int32_t
size
=
pSql
->
cmd
.
payloadLen
-
sizeof
(
SMsgDesc
);
//
int32_t size = pSql->cmd.payloadLen - sizeof(SMsgDesc);
int32_t
vgId
=
pTableMeta
->
vgroupInfo
.
vgId
;
int32_t
vgId
=
pTableMeta
->
vgroupInfo
.
vgId
;
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_DELETE
;
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_DELETE
;
tscDumpEpSetFromVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pSql
->
epSet
);
tscDebug
(
"%p build delete msg, vgId:%d numberOfEP:%d"
,
pSql
,
vgId
,
pSql
->
epSet
.
numOfEps
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
/*
/*
...
...
src/dnode/src/dnodeVWrite.c
浏览文件 @
33af9c27
...
@@ -98,11 +98,11 @@ void dnodeCleanupVnodeWrite() {
...
@@ -98,11 +98,11 @@ void dnodeCleanupVnodeWrite() {
void
dnodeDispatchToVnodeWriteQueue
(
SRpcMsg
*
pMsg
)
{
void
dnodeDispatchToVnodeWriteQueue
(
SRpcMsg
*
pMsg
)
{
char
*
pCont
=
(
char
*
)
pMsg
->
pCont
;
char
*
pCont
=
(
char
*
)
pMsg
->
pCont
;
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_SUBMIT
)
{
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_SUBMIT
||
pMsg
->
msgType
==
TSDB_MSG_TYPE_DELETE
)
{
SMsgDesc
*
pDesc
=
(
SMsgDesc
*
)
pCont
;
SMsgDesc
*
pDesc
=
(
SMsgDesc
*
)
pCont
;
pDesc
->
numOfVnodes
=
htonl
(
pDesc
->
numOfVnodes
);
pDesc
->
numOfVnodes
=
htonl
(
pDesc
->
numOfVnodes
);
pCont
+=
sizeof
(
SMsgDesc
);
pCont
+=
sizeof
(
SMsgDesc
);
}
}
SMsgHead
*
pHead
=
(
SMsgHead
*
)
pCont
;
SMsgHead
*
pHead
=
(
SMsgHead
*
)
pCont
;
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
...
...
src/inc/taosmsg.h
浏览文件 @
33af9c27
...
@@ -302,6 +302,15 @@ typedef struct {
...
@@ -302,6 +302,15 @@ typedef struct {
char
data
[];
char
data
[];
}
SUpdateTableTagValMsg
;
}
SUpdateTableTagValMsg
;
typedef
struct
{
SMsgHead
head
;
int64_t
uid
;
int32_t
tid
;
int16_t
tversion
;
int32_t
delValLen
;
char
data
[];
}
SDeleteMsg
;
typedef
struct
{
typedef
struct
{
char
clientVersion
[
TSDB_VERSION_LEN
];
char
clientVersion
[
TSDB_VERSION_LEN
];
char
msgVersion
[
TSDB_VERSION_LEN
];
char
msgVersion
[
TSDB_VERSION_LEN
];
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
33af9c27
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
static
int32_t
(
*
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SVnodeObj
*
,
void
*
,
SRspRet
*
);
static
int32_t
(
*
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SVnodeObj
*
,
void
*
,
SRspRet
*
);
static
int32_t
vnodeProcessSubmitMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessSubmitMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessDeleteMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessCreateTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessCreateTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessDropTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessDropTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessAlterTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessAlterTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
...
@@ -39,6 +40,7 @@ static int32_t vnodeProcessUpdateTagValMsg(SVnodeObj *pVnode, void *pCont, SRspR
...
@@ -39,6 +40,7 @@ static int32_t vnodeProcessUpdateTagValMsg(SVnodeObj *pVnode, void *pCont, SRspR
void
vnodeInitWriteFp
(
void
)
{
void
vnodeInitWriteFp
(
void
)
{
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_SUBMIT
]
=
vnodeProcessSubmitMsg
;
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_SUBMIT
]
=
vnodeProcessSubmitMsg
;
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_DELETE
]
=
vnodeProcessDeleteMsg
;
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_TABLE
]
=
vnodeProcessCreateTableMsg
;
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MD_CREATE_TABLE
]
=
vnodeProcessCreateTableMsg
;
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MD_DROP_TABLE
]
=
vnodeProcessDropTableMsg
;
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MD_DROP_TABLE
]
=
vnodeProcessDropTableMsg
;
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_TABLE
]
=
vnodeProcessAlterTableMsg
;
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MD_ALTER_TABLE
]
=
vnodeProcessAlterTableMsg
;
...
@@ -127,6 +129,10 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR
...
@@ -127,6 +129,10 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR
return
code
;
return
code
;
}
}
static
int32_t
vnodeProcessDeleteMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
pRet
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
return
code
;
}
static
int32_t
vnodeProcessCreateTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
pRet
)
{
static
int32_t
vnodeProcessCreateTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
pRet
)
{
int
code
=
TSDB_CODE_SUCCESS
;
int
code
=
TSDB_CODE_SUCCESS
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录