Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
cc64e9e4
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
cc64e9e4
编写于
1月 14, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
差异文件
merge topic
上级
17cda76b
2f3a58f8
变更
28
展开全部
隐藏空白更改
内联
并排
Showing
28 changed file
with
563 addition
and
358 deletion
+563
-358
include/client/taos.h
include/client/taos.h
+1
-1
include/common/tmsg.h
include/common/tmsg.h
+4
-1
include/common/tname.h
include/common/tname.h
+0
-2
include/libs/parser/parser.h
include/libs/parser/parser.h
+1
-1
include/libs/planner/planner.h
include/libs/planner/planner.h
+1
-0
include/util/taoserror.h
include/util/taoserror.h
+1
-0
include/util/tcoding.h
include/util/tcoding.h
+1
-0
include/util/tdef.h
include/util/tdef.h
+1
-1
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+8
-8
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+4
-8
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+75
-45
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+147
-92
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+2
-2
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+28
-21
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+1
-12
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+1
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+14
-14
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+23
-23
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+202
-101
source/libs/function/src/tscalarfunction.c
source/libs/function/src/tscalarfunction.c
+0
-1
source/libs/parser/inc/astGenerator.h
source/libs/parser/inc/astGenerator.h
+0
-2
source/libs/parser/src/astValidate.c
source/libs/parser/src/astValidate.c
+2
-0
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+3
-3
source/libs/planner/src/physicalPlan.c
source/libs/planner/src/physicalPlan.c
+3
-2
source/libs/planner/src/physicalPlanJson.c
source/libs/planner/src/physicalPlanJson.c
+30
-14
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+3
-1
source/libs/transport/src/rpcTcp.c
source/libs/transport/src/rpcTcp.c
+5
-2
source/util/src/terror.c
source/util/src/terror.c
+2
-1
未找到文件。
include/client/taos.h
浏览文件 @
cc64e9e4
...
...
@@ -193,7 +193,7 @@ DLL_EXPORT void taos_close_stream(TAOS_STREAM *tstr);
DLL_EXPORT
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
);
DLL_EXPORT
TAOS_RES
*
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
int
precision
);
DLL_EXPORT
TAOS_RES
*
tmq
_create_topic
(
TAOS
*
taos
,
const
char
*
name
,
const
char
*
sql
,
int
sqlLen
);
DLL_EXPORT
TAOS_RES
*
taos
_create_topic
(
TAOS
*
taos
,
const
char
*
name
,
const
char
*
sql
,
int
sqlLen
);
#ifdef __cplusplus
}
...
...
include/common/tmsg.h
浏览文件 @
cc64e9e4
...
...
@@ -1093,6 +1093,7 @@ typedef struct {
typedef
struct
{
int8_t
igExists
;
char
*
name
;
char
*
sql
;
char
*
physicalPlan
;
char
*
logicalPlan
;
}
SCMCreateTopicReq
;
...
...
@@ -1101,6 +1102,7 @@ static FORCE_INLINE int tSerializeSCMCreateTopicReq(void** buf, const SCMCreateT
int
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
igExists
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
name
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
sql
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
physicalPlan
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
logicalPlan
);
return
tlen
;
...
...
@@ -1109,6 +1111,7 @@ static FORCE_INLINE int tSerializeSCMCreateTopicReq(void** buf, const SCMCreateT
static
FORCE_INLINE
void
*
tDeserializeSCMCreateTopicReq
(
void
*
buf
,
SCMCreateTopicReq
*
pReq
)
{
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
igExists
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
name
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
sql
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
physicalPlan
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
logicalPlan
));
return
buf
;
...
...
@@ -1231,7 +1234,7 @@ typedef struct {
}
SMVSubscribeRsp
;
typedef
struct
{
char
name
[
TSDB_TOPIC_
F
NAME_LEN
];
char
name
[
TSDB_TOPIC_NAME_LEN
];
int8_t
igExists
;
int32_t
execLen
;
void
*
executor
;
...
...
include/common/tname.h
浏览文件 @
cc64e9e4
...
...
@@ -25,14 +25,12 @@
#define T_NAME_ACCT 0x1u
#define T_NAME_DB 0x2u
#define T_NAME_TABLE 0x4u
#define T_NAME_TOPIC 0x8u
typedef
struct
SName
{
uint8_t
type
;
//db_name_t, table_name_t
int32_t
acctId
;
char
dbname
[
TSDB_DB_NAME_LEN
];
char
tname
[
TSDB_TABLE_NAME_LEN
];
char
topicName
[
TSDB_TOPIC_NAME_LEN
];
}
SName
;
int32_t
tNameExtractFullName
(
const
SName
*
name
,
char
*
dst
);
...
...
include/libs/parser/parser.h
浏览文件 @
cc64e9e4
...
...
@@ -44,7 +44,7 @@ typedef struct SParseContext {
* @param msg extended error message if exists.
* @return error code
*/
int32_t
qParseQuerySql
(
SParseContext
*
pContext
,
SQueryNode
**
pQuery
);
int32_t
qParseQuerySql
(
SParseContext
*
pContext
,
SQueryNode
**
pQuery
Node
);
/**
* Return true if it is a ddl/dcl sql statement
...
...
include/libs/planner/planner.h
浏览文件 @
cc64e9e4
...
...
@@ -95,6 +95,7 @@ typedef struct SScanPhyNode {
int8_t
tableType
;
int32_t
order
;
// scan order: TSDB_ORDER_ASC|TSDB_ORDER_DESC
int32_t
count
;
// repeat count
int32_t
reverse
;
// reverse scan count
}
SScanPhyNode
;
typedef
SScanPhyNode
SSystemTableScanPhyNode
;
...
...
include/util/taoserror.h
浏览文件 @
cc64e9e4
...
...
@@ -307,6 +307,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512) //"Database write operation denied")
#define TSDB_CODE_VND_IS_SYNCING TAOS_DEF_ERROR_CODE(0, 0x0513) //"Database is syncing")
#define TSDB_CODE_VND_INVALID_TSDB_STATE TAOS_DEF_ERROR_CODE(0, 0x0514) //"Invalid tsdb state")
#define TSDB_CODE_VND_TB_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0515) // "Table not exists")
// tsdb
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600) //"Invalid table ID")
...
...
include/util/tcoding.h
浏览文件 @
cc64e9e4
...
...
@@ -351,6 +351,7 @@ static FORCE_INLINE void *taosDecodeString(void *buf, char **value) {
buf
=
taosDecodeVariantU64
(
buf
,
&
size
);
*
value
=
(
char
*
)
malloc
((
size_t
)
size
+
1
);
if
(
*
value
==
NULL
)
return
NULL
;
memcpy
(
*
value
,
buf
,
(
size_t
)
size
);
...
...
include/util/tdef.h
浏览文件 @
cc64e9e4
...
...
@@ -181,7 +181,7 @@ do { \
#define TSDB_COL_NAME_LEN 65
#define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64
#define TSDB_MAX_SQL_LEN TSDB_PAYLOAD_SIZE
#define TSDB_MAX_SQL_SHOW_LEN
512
#define TSDB_MAX_SQL_SHOW_LEN
1024
#define TSDB_MAX_ALLOWED_SQL_LEN (1*1024*1024u) // sql length should be less than 1mb
#define TSDB_APP_NAME_LEN TSDB_UNI_LEN
...
...
source/client/inc/clientInt.h
浏览文件 @
cc64e9e4
...
...
@@ -118,9 +118,8 @@ typedef struct STscObj {
uint32_t
connId
;
int32_t
connType
;
uint64_t
id
;
// ref ID returned by taosAddRef
void
*
pTransporter
;
pthread_mutex_t
mutex
;
// used to protect the operation on db
int32_t
numOfReqs
;
// number of sqlObj
from this tscObj
int32_t
numOfReqs
;
// number of sqlObj
bound to this connection
SAppInstInfo
*
pAppInfo
;
}
STscObj
;
...
...
@@ -149,12 +148,13 @@ typedef struct SShowReqInfo {
}
SShowReqInfo
;
typedef
struct
SRequestSendRecvBody
{
tsem_t
rspSem
;
// not used now
void
*
fp
;
SShowReqInfo
showInfo
;
// todo this attribute will be removed after the query framework being completed.
struct
SSchJob
*
pQueryJob
;
// query job, created according to sql query DAG.
SDataBuf
requestMsg
;
SReqResultInfo
resInfo
;
tsem_t
rspSem
;
// not used now
void
*
fp
;
SShowReqInfo
showInfo
;
// todo this attribute will be removed after the query framework being completed.
SDataBuf
requestMsg
;
struct
SSchJob
*
pQueryJob
;
// query job, created according to sql query DAG.
struct
SQueryDag
*
pDag
;
// the query dag, generated according to the sql statement.
SReqResultInfo
resInfo
;
}
SRequestSendRecvBody
;
#define ERROR_MSG_BUF_DEFAULT_SIZE 512
...
...
source/client/src/clientEnv.c
浏览文件 @
cc64e9e4
...
...
@@ -89,13 +89,12 @@ static void tscInitLogFile() {
// todo close the transporter properly
void
closeTransporter
(
STscObj
*
pTscObj
)
{
if
(
pTscObj
==
NULL
||
pTscObj
->
pTransporter
==
NULL
)
{
if
(
pTscObj
==
NULL
||
pTscObj
->
p
AppInfo
->
p
Transporter
==
NULL
)
{
return
;
}
tscDebug
(
"free transporter:%p in connObj: 0x%"
PRIx64
,
pTscObj
->
pTransporter
,
pTscObj
->
id
);
rpcClose
(
pTscObj
->
pTransporter
);
pTscObj
->
pTransporter
=
NULL
;
tscDebug
(
"free transporter:%p in connObj: 0x%"
PRIx64
,
pTscObj
->
pAppInfo
->
pTransporter
,
pTscObj
->
id
);
rpcClose
(
pTscObj
->
pAppInfo
->
pTransporter
);
}
// TODO refactor
...
...
@@ -140,10 +139,6 @@ void* createTscObj(const char* user, const char* auth, const char *db, SAppInstI
}
pObj
->
pAppInfo
=
pAppInfo
;
if
(
pAppInfo
!=
NULL
)
{
pObj
->
pTransporter
=
pAppInfo
->
pTransporter
;
}
tstrncpy
(
pObj
->
user
,
user
,
sizeof
(
pObj
->
user
));
memcpy
(
pObj
->
pass
,
auth
,
TSDB_PASSWORD_LEN
);
...
...
@@ -199,6 +194,7 @@ static void doDestroyRequest(void* p) {
tfree
(
pRequest
->
pInfo
);
doFreeReqResultInfo
(
&
pRequest
->
body
.
resInfo
);
qDestroyQueryDag
(
pRequest
->
body
.
pDag
);
deregisterRequest
(
pRequest
);
tfree
(
pRequest
);
...
...
source/client/src/clientImpl.c
浏览文件 @
cc64e9e4
...
...
@@ -13,12 +13,12 @@
#include "tpagedfile.h"
#include "tref.h"
#define CHECK_CODE_GOTO(expr, lab
le
) \
#define CHECK_CODE_GOTO(expr, lab
el
) \
do { \
int32_t code = expr; \
if (TSDB_CODE_SUCCESS != code) { \
terrno = code; \
goto lab
le
; \
goto lab
el
; \
} \
} while (0)
...
...
@@ -153,13 +153,13 @@ int32_t parseSql(SRequestObj* pRequest, SQueryNode** pQuery) {
SParseContext
cxt
=
{
.
requestId
=
pRequest
->
requestId
,
.
acctId
=
pTscObj
->
acctId
,
.
db
=
getConnectionDB
(
pTscObj
),
.
p
Transporter
=
pTscObj
->
pTransporte
r
,
.
pSql
=
pRequest
->
sqlstr
,
.
sqlLen
=
pRequest
->
sqlLen
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
.
acctId
=
pTscObj
->
acctId
,
.
db
=
getConnectionDB
(
pTscObj
),
.
p
Sql
=
pRequest
->
sqlst
r
,
.
sqlLen
=
pRequest
->
sqlLen
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
};
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
...
...
@@ -192,10 +192,10 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) {
pShowReqInfo
->
pArray
=
pDcl
->
pExtension
;
}
}
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
&
pDcl
->
epSet
,
&
transporterId
,
pSendMsg
);
asyncSendMsgToServer
(
pTscObj
->
p
AppInfo
->
p
Transporter
,
&
pDcl
->
epSet
,
&
transporterId
,
pSendMsg
);
}
else
{
SEpSet
*
pEpSet
=
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
;
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
pEpSet
,
&
transporterId
,
pSendMsg
);
asyncSendMsgToServer
(
pTscObj
->
p
AppInfo
->
p
Transporter
,
pEpSet
,
&
transporterId
,
pSendMsg
);
}
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
...
...
@@ -242,7 +242,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag) {
if
(
TSDB_SQL_INSERT
==
pRequest
->
type
||
TSDB_SQL_CREATE_TABLE
==
pRequest
->
type
)
{
SQueryResult
res
=
{.
code
=
0
,
.
numOfRows
=
0
,
.
msgSize
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
msg
=
pRequest
->
msgBuf
};
int32_t
code
=
scheduleExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQueryJob
,
&
res
);
int32_t
code
=
scheduleExecJob
(
pRequest
->
pTscObj
->
p
AppInfo
->
p
Transporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQueryJob
,
&
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// handle error and retry
}
else
{
...
...
@@ -256,7 +256,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag) {
return
pRequest
->
code
;
}
return
scheduleAsyncExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQueryJob
);
return
scheduleAsyncExecJob
(
pRequest
->
pTscObj
->
p
AppInfo
->
p
Transporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQueryJob
);
}
typedef
struct
tmq_t
tmq_t
;
...
...
@@ -362,28 +362,55 @@ TAOS_RES *tmq_create_topic(TAOS* taos, const char* name, const char* sql, int sq
char
*
dagStr
=
NULL
;
terrno
=
TSDB_CODE_SUCCESS
;
if
(
taos
==
NULL
||
topicName
==
NULL
||
sql
==
NULL
)
{
tscError
(
"invalid parameters for creating topic, connObj:%p, topic name:%s, sql:%s"
,
taos
,
topicName
,
sql
);
terrno
=
TSDB_CODE_TSC_INVALID_INPUT
;
goto
_return
;
}
if
(
strlen
(
topicName
)
>=
TSDB_TOPIC_NAME_LEN
)
{
tscError
(
"topic name too long, max length:%d"
,
TSDB_TOPIC_NAME_LEN
-
1
);
terrno
=
TSDB_CODE_TSC_INVALID_INPUT
;
goto
_return
;
}
if
(
sqlLen
>
tsMaxSQLStringLen
)
{
tscError
(
"sql string exceeds max length:%d"
,
tsMaxSQLStringLen
);
terrno
=
TSDB_CODE_TSC_EXCEED_SQL_LIMIT
;
goto
_return
;
}
tscDebug
(
"start to create topic, %s"
,
topicName
);
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
CHECK_CODE_GOTO
(
parseSql
(
pRequest
,
&
pQueryNode
),
_return
);
//temporary disabled until planner ready
#if 0
CHECK_CODE_GOTO(parseSql(pRequest, &pQuery), _return);
//TODO: check sql valid
// todo check for invalid sql statement and return with error code
CHECK_CODE_GOTO(qCreateQueryDag(pQuery
, &pDag
), _return);
CHECK_CODE_GOTO
(
qCreateQueryDag
(
pQuery
Node
,
&
pRequest
->
body
.
pDag
,
pRequest
->
requestId
),
_return
);
dagStr = qDagToString(
pDag);
if(
dag
Str == NULL) {
//TODO
pStr
=
qDagToString
(
pRequest
->
body
.
pDag
);
if
(
p
Str
==
NULL
)
{
goto
_return
;
}
#endif
// The topic should be related to a database that the queried table is belonged to.
SName
name
=
{
0
};
char
dbName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
((
SQueryStmtInfo
*
)
pQueryNode
)
->
pTableMetaInfo
[
0
]
->
name
,
dbName
);
tNameFromString
(
&
name
,
dbName
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameFromString
(
&
name
,
topicName
,
T_NAME_TABLE
);
char
topicFname
[
TSDB_TOPIC_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
name
,
topicFname
);
SCMCreateTopicReq
req
=
{
.
name
=
(
char
*
)
name
,
.
igExists
=
0
,
/*.physicalPlan = dagStr,*/
.
physicalPlan
=
(
char
*
)
sql
,
.
logicalPlan
=
"
"
,
.
name
=
(
char
*
)
topicF
name
,
.
igExists
=
0
,
.
physicalPlan
=
(
char
*
)
pStr
,
.
sql
=
(
char
*
)
sql
,
.
logicalPlan
=
"no logic plan
"
,
};
int
tlen
=
tSerializeSCMCreateTopicReq
(
NULL
,
&
req
);
...
...
@@ -391,27 +418,32 @@ TAOS_RES *tmq_create_topic(TAOS* taos, const char* name, const char* sql, int sq
if
(
buf
==
NULL
)
{
goto
_return
;
}
void
*
abuf
=
buf
;
tSerializeSCMCreateTopicReq
(
&
abuf
,
&
req
);
/*printf("formatted: %s\n", dagStr);*/
pRequest
->
body
.
requestMsg
=
(
SDataBuf
){
.
pData
=
buf
,
.
len
=
tlen
};
pRequest
->
type
=
TDMT_MND_CREATE_TOPIC
;
SMsgSendInfo
*
body
=
buildMsgInfoImpl
(
pRequest
);
SEpSet
*
pEpSet
=
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
;
SEpSet
epSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
)
;
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
pTscObj
->
p
Transporter
,
pE
pSet
,
&
transporterId
,
body
);
asyncSendMsgToServer
(
pTscObj
->
p
AppInfo
->
pTransporter
,
&
e
pSet
,
&
transporterId
,
body
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
_return:
qDestroyQuery
(
pQuery
);
qDestroyQueryDag
(
pDag
);
destroySendMsgInfo
(
body
);
qDestroyQuery
(
pQueryNode
);
if
(
body
!=
NULL
)
{
destroySendMsgInfo
(
body
);
}
if
(
pRequest
!=
NULL
&&
terrno
!=
TSDB_CODE_SUCCESS
)
{
pRequest
->
code
=
terrno
;
}
return
pRequest
;
}
...
...
@@ -445,24 +477,22 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
nPrintTsc
(
"%s"
,
sql
)
SRequestObj
*
pRequest
=
NULL
;
SQueryNode
*
pQuery
=
NULL
;
SQueryDag
*
pDag
=
NULL
;
SQueryNode
*
pQueryNode
=
NULL
;
terrno
=
TSDB_CODE_SUCCESS
;
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
CHECK_CODE_GOTO
(
parseSql
(
pRequest
,
&
pQuery
),
_return
);
CHECK_CODE_GOTO
(
parseSql
(
pRequest
,
&
pQuery
Node
),
_return
);
if
(
qIsDdlQuery
(
pQuery
))
{
CHECK_CODE_GOTO
(
execDdlQuery
(
pRequest
,
pQuery
),
_return
);
if
(
qIsDdlQuery
(
pQuery
Node
))
{
CHECK_CODE_GOTO
(
execDdlQuery
(
pRequest
,
pQuery
Node
),
_return
);
}
else
{
CHECK_CODE_GOTO
(
getPlan
(
pRequest
,
pQuery
,
&
pDag
),
_return
);
CHECK_CODE_GOTO
(
scheduleQuery
(
pRequest
,
pDag
),
_return
);
CHECK_CODE_GOTO
(
getPlan
(
pRequest
,
pQuery
Node
,
&
pRequest
->
body
.
pDag
),
_return
);
CHECK_CODE_GOTO
(
scheduleQuery
(
pRequest
,
p
Request
->
body
.
p
Dag
),
_return
);
pRequest
->
code
=
terrno
;
}
_return:
qDestroyQuery
(
pQuery
);
qDestroyQueryDag
(
pDag
);
qDestroyQuery
(
pQueryNode
);
if
(
NULL
!=
pRequest
&&
TSDB_CODE_SUCCESS
!=
terrno
)
{
pRequest
->
code
=
terrno
;
}
...
...
@@ -523,7 +553,7 @@ STscObj* taosConnectImpl(const char *ip, const char *user, const char *auth, con
SMsgSendInfo
*
body
=
buildConnectMsg
(
pRequest
);
int64_t
transporterId
=
0
;
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
transporterId
,
body
);
asyncSendMsgToServer
(
pTscObj
->
p
AppInfo
->
p
Transporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
transporterId
,
body
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -534,7 +564,7 @@ STscObj* taosConnectImpl(const char *ip, const char *user, const char *auth, con
taos_close
(
pTscObj
);
pTscObj
=
NULL
;
}
else
{
tscDebug
(
"0x%"
PRIx64
" connection is opening, connId:%d, dnodeConn:%p, reqId:0x%"
PRIx64
,
pTscObj
->
id
,
pTscObj
->
connId
,
pTscObj
->
pTransporter
,
pRequest
->
requestId
);
tscDebug
(
"0x%"
PRIx64
" connection is opening, connId:%d, dnodeConn:%p, reqId:0x%"
PRIx64
,
pTscObj
->
id
,
pTscObj
->
connId
,
pTscObj
->
p
AppInfo
->
p
Transporter
,
pRequest
->
requestId
);
destroyRequest
(
pRequest
);
}
...
...
@@ -702,7 +732,7 @@ void* doFetchRow(SRequestObj* pRequest) {
int64_t
transporterId
=
0
;
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
transporterId
,
body
);
asyncSendMsgToServer
(
pTscObj
->
p
AppInfo
->
p
Transporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
transporterId
,
body
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
pRequest
->
type
=
TDMT_VND_SHOW_TABLES_FETCH
;
...
...
@@ -712,7 +742,7 @@ void* doFetchRow(SRequestObj* pRequest) {
int64_t
transporterId
=
0
;
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
asyncSendMsgToServer
(
pTscObj
->
pTransporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
transporterId
,
body
);
asyncSendMsgToServer
(
pTscObj
->
p
AppInfo
->
p
Transporter
,
&
pTscObj
->
pAppInfo
->
mgmtEp
.
epSet
,
&
transporterId
,
body
);
tsem_wait
(
&
pRequest
->
body
.
rspSem
);
...
...
source/client/test/clientTests.cpp
浏览文件 @
cc64e9e4
...
...
@@ -149,27 +149,36 @@ TEST(testCase, connect_Test) {
//}
//
//TEST(testCase, create_db_Test) {
//TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
//assert(pConn != NULL);
//TAOS_RES* pRes = taos_query(pConn, "create database abc1 vgroups 2");
//if (taos_errno(pRes) != 0) {
//printf("error in create db, reason:%s\n", taos_errstr(pRes));
//}
//TAOS_FIELD* pFields = taos_fetch_fields(pRes);
//ASSERT_TRUE(pFields == NULL);
//int32_t numOfFields = taos_num_fields(pRes);
//ASSERT_EQ(numOfFields, 0);
//taos_free_result(pRes);
//pRes = taos_query(pConn, "create database abc1 vgroups 4");
//if (taos_errno(pRes) != 0) {
//printf("error in create db, reason:%s\n", taos_errstr(pRes));
//}
//taos_close(pConn);
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
//
// TAOS_RES* pRes = taos_query(pConn, "drop database abc1");
// if (taos_errno(pRes) != 0) {
// printf("failed to drop database, reason:%s\n", taos_errstr(pRes));
// }
//
// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "create database abc1 vgroups 2");
// if (taos_errno(pRes) != 0) {
// printf("error in create db, reason:%s\n", taos_errstr(pRes));
// }
//
// TAOS_FIELD* pFields = taos_fetch_fields(pRes);
// ASSERT_TRUE(pFields == NULL);
//
// int32_t numOfFields = taos_num_fields(pRes);
// ASSERT_EQ(numOfFields, 0);
//
// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "create database if not exists abc1 vgroups 4");
// if (taos_errno(pRes) != 0) {
// printf("failed to create database abc1, reason:%s\n", taos_errstr(pRes));
// }
//
// taos_free_result(pRes);
// taos_close(pConn);
//}
//
//TEST(testCase, create_dnode_Test) {
...
...
@@ -195,7 +204,7 @@ TEST(testCase, connect_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
//
// TAOS_RES* pRes = taos_query(pConn, "drop dnode
2
");
// TAOS_RES* pRes = taos_query(pConn, "drop dnode
3
");
// if (taos_errno(pRes) != 0) {
// printf("error in drop dnode, reason:%s\n", taos_errstr(pRes));
// }
...
...
@@ -206,6 +215,11 @@ TEST(testCase, connect_Test) {
// int32_t numOfFields = taos_num_fields(pRes);
// ASSERT_EQ(numOfFields, 0);
//
// pRes = taos_query(pConn, "drop dnode 4");
// if (taos_errno(pRes) != 0) {
// printf("error in drop dnode, reason:%s\n", taos_errstr(pRes));
// }
//
// taos_free_result(pRes);
// taos_close(pConn);
//}
...
...
@@ -228,33 +242,33 @@ TEST(testCase, connect_Test) {
// taos_close(pConn);
//}
//
//
//
TEST(testCase, drop_db_test) {
//
//
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
//
//
assert(pConn != NULL);
//
//
//
//
showDB(pConn);
//
//
//
//
TAOS_RES* pRes = taos_query(pConn, "drop database abc1");
//
//
if (taos_errno(pRes) != 0) {
//
//
printf("failed to drop db, reason:%s\n", taos_errstr(pRes));
//
//
}
//
//
taos_free_result(pRes);
//
//
//
//
showDB(pConn);
//
//
//
//
pRes = taos_query(pConn, "create database abc1");
//
//
if (taos_errno(pRes) != 0) {
//
//
printf("create to drop db, reason:%s\n", taos_errstr(pRes));
//
//
}
//
//
taos_free_result(pRes);
//
//
taos_close(pConn);
//
//
}
// TEST(testCase, drop_db_test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
//
// showDB(pConn);
//
// TAOS_RES* pRes = taos_query(pConn, "drop database abc1");
// if (taos_errno(pRes) != 0) {
// printf("failed to drop db, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
//
// showDB(pConn);
//
// pRes = taos_query(pConn, "create database abc1");
// if (taos_errno(pRes) != 0) {
// printf("create to drop db, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
// taos_close(pConn);
//}
//
//TEST(testCase, create_stable_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
//
// TAOS_RES* pRes = taos_query(pConn, "create database abc1 vgroups 2");
// TAOS_RES* pRes = taos_query(pConn, "create database
if not exists
abc1 vgroups 2");
// if (taos_errno(pRes) != 0) {
// printf("error in create db, reason:%s\n", taos_errstr(pRes));
// }
...
...
@@ -280,7 +294,7 @@ TEST(testCase, connect_Test) {
// taos_free_result(pRes);
// taos_close(pConn);
//}
//
//TEST(testCase, create_table_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
...
...
@@ -293,26 +307,26 @@ TEST(testCase, connect_Test) {
//
// taos_close(pConn);
//}
//
//TEST(testCase, create_ctable_Test) {
//
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
//
assert(pConn != NULL);
//
TAOS_RES* pRes = taos_query(pConn, "use abc1");
//
if (taos_errno(pRes) != 0) {
//
printf("failed to use db, reason:%s\n", taos_errstr(pRes));
//
}
//
taos_free_result(pRes);
//
pRes = taos_query(pConn, "create table tm0 using st1 tags(1)");
//
if (taos_errno(pRes) != 0) {
//
printf("failed to create child table tm0, reason:%s\n", taos_errstr(pRes));
//
}
//
taos_free_result(pRes);
//
taos_close(pConn);
//
TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
//
assert(pConn != NULL);
//
//
TAOS_RES* pRes = taos_query(pConn, "use abc1");
//
if (taos_errno(pRes) != 0) {
//
printf("failed to use db, reason:%s\n", taos_errstr(pRes));
//
}
//
taos_free_result(pRes);
//
//
pRes = taos_query(pConn, "create table tm0 using st1 tags(1)");
//
if (taos_errno(pRes) != 0) {
//
printf("failed to create child table tm0, reason:%s\n", taos_errstr(pRes));
//
}
//
//
taos_free_result(pRes);
//
taos_close(pConn);
//}
//
//TEST(testCase, show_stable_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
...
...
@@ -500,60 +514,101 @@ TEST(testCase, connect_Test) {
//
// taosHashCleanup(phash);
//}
//
TEST
(
testCase
,
create_topic_Test
)
{
TAOS
*
pConn
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
assert
(
pConn
!=
NULL
);
// TEST(testCase, create_topic_Test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// assert(pConn != NULL);
TAOS_RES
*
pRes
=
taos_query
(
pConn
,
"use abc1"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in use db, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
taos_free_result
(
pRes
);
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
pRes
);
ASSERT_TRUE
(
pFields
==
nullptr
);
int32_t
numOfFields
=
taos_num_fields
(
pRes
);
ASSERT_EQ
(
numOfFields
,
0
);
taos_free_result
(
pRes
);
char
*
sql
=
"select * from tu"
;
pRes
=
taos_create_topic
(
pConn
,
"test_topic_1"
,
sql
,
strlen
(
sql
));
taos_free_result
(
pRes
);
taos_close
(
pConn
);
}
//
// TAOS_RES* pRes = taos_query(pConn, "create database abc1");
// if (taos_errno(pRes) != 0) {
// printf("error in create db, reason:%s\n", taos_errstr(pRes));
// }
// taos_free_result(pRes);
//TEST(testCase, insert_test) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// ASSERT_NE(pConn, nullptr);
//
// pRes = taos_query(pConn, "use abc1");
// if (taos_errno(pRes) != 0) {
// printf("error in use db, reason:%s\n", taos_errstr(pRes));
// }
// TAOS_RES* pRes = taos_query(pConn, "use abc1");
// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "
create stable st1(ts timestamp, k int) tags(a int
)");
// pRes = taos_query(pConn, "
insert into t_2 values(now, 1
)");
// if (taos_errno(pRes) != 0) {
// printf("error in create stable, reason:%s\n", taos_errstr(pRes));
// printf("failed to create multiple tables, reason:%s\n", taos_errstr(pRes));
// taos_free_result(pRes);
// ASSERT_TRUE(false);
// }
//
// TAOS_FIELD* pFields = taos_fetch_fields(pRes);
// ASSERT_TRUE(pFields == NULL);
//
// int32_t numOfFields = taos_num_fields(pRes);
// ASSERT_EQ(numOfFields, 0);
//
// taos_free_result(pRes);
//
// char* sql = "select * from st1";
// tmq_create_topic(pConn, "test_topic_1", sql, strlen(sql));
// taos_close(pConn);
//}
//TEST(testCase,
insert_test
) {
//TEST(testCase,
projection_query_tables
) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// ASSERT_
EQ
(pConn, nullptr);
// ASSERT_
NE
(pConn, nullptr);
//
// TAOS_RES* pRes = taos_query(pConn, "use abc1");
// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "insert into t_2 values(now, 1)");
//// pRes = taos_query(pConn, "create stable st1 (ts timestamp, k int) tags(a int)");
//// if (taos_errno(pRes) != 0) {
//// printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
//// }
//// taos_free_result(pRes);
////
//// pRes = taos_query(pConn, "create table tu using st1 tags(1)");
//// if (taos_errno(pRes) != 0) {
//// printf("failed to create table tu, reason:%s\n", taos_errstr(pRes));
//// }
//// taos_free_result(pRes);
////
//// for(int32_t i = 0; i < 100; ++i) {
//// char sql[512] = {0};
//// sprintf(sql, "insert into tu values(now+%da, %d)", i, i);
//// TAOS_RES* p = taos_query(pConn, sql);
//// if (taos_errno(p) != 0) {
//// printf("failed to insert data, reason:%s\n", taos_errstr(p));
//// }
////
//// taos_free_result(p);
//// }
//
// pRes = taos_query(pConn, "select * from tu");
// if (taos_errno(pRes) != 0) {
// printf("failed to
create multiple tables
, reason:%s\n", taos_errstr(pRes));
// printf("failed to
select from table
, reason:%s\n", taos_errstr(pRes));
// taos_free_result(pRes);
// ASSERT_TRUE(false);
// }
//
// TAOS_ROW pRow = NULL;
// TAOS_FIELD* pFields = taos_fetch_fields(pRes);
// int32_t numOfFields = taos_num_fields(pRes);
//
// char str[512] = {0};
// while ((pRow = taos_fetch_row(pRes)) != NULL) {
// int32_t code = taos_print_row(str, pRow, pFields, numOfFields);
// printf("%s\n", str);
// }
//
// taos_free_result(pRes);
// taos_close(pConn);
//}
//TEST(testCase, projection_query_tables) {
//TEST(testCase, projection_query_
s
tables) {
// TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0);
// ASSERT_NE(pConn, nullptr);
//
...
...
@@ -577,7 +632,7 @@ TEST(testCase, connect_Test) {
//// pRes = taos_query(pConn, "insert into tu values(now, 1)");
//// taos_free_result(pRes);
//
// pRes = taos_query(pConn, "select
* from tu
");
// pRes = taos_query(pConn, "select
ts,k from m1
");
// if (taos_errno(pRes) != 0) {
// printf("failed to select from table, reason:%s\n", taos_errstr(pRes));
// taos_free_result(pRes);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
cc64e9e4
...
...
@@ -350,7 +350,7 @@ typedef struct SMqTopicObj {
// TODO: add cache and change name to id
typedef
struct
SMqConsumerTopic
{
char
name
[
TSDB_TOPIC_
F
NAME_LEN
];
char
name
[
TSDB_TOPIC_NAME_LEN
];
SList
*
vgroups
;
// SList<int32_t>
}
SMqConsumerTopic
;
...
...
@@ -409,7 +409,7 @@ typedef struct SMqVGroupHbObj {
#if 0
typedef struct SCGroupObj {
char name[TSDB_TOPIC_
F
NAME_LEN];
char name[TSDB_TOPIC_NAME_LEN];
int64_t createTime;
int64_t updateTime;
uint64_t uid;
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
cc64e9e4
...
...
@@ -118,11 +118,13 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTopic
->
dbUid
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTopic
->
version
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTopic
->
sqlLen
,
TOPIC_DECODE_OVER
);
pTopic
->
sql
=
calloc
(
pTopic
->
sqlLen
+
1
,
sizeof
(
char
));
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTopic
->
sql
,
pTopic
->
sqlLen
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
len
,
TOPIC_DECODE_OVER
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTopic
->
logicalPlan
,
len
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
len
,
TOPIC_DECODE_OVER
);
SDB_GET_BINARY
(
pRaw
,
dataPos
,
pTopic
->
physicalPlan
,
len
,
TOPIC_DECODE_OVER
);
//
SDB_GET_INT32(pRaw, dataPos, &len, TOPIC_DECODE_OVER);
//
SDB_GET_BINARY(pRaw, dataPos, pTopic->logicalPlan, len, TOPIC_DECODE_OVER);
//
SDB_GET_INT32(pRaw, dataPos, &len, TOPIC_DECODE_OVER);
//
SDB_GET_BINARY(pRaw, dataPos, pTopic->physicalPlan, len, TOPIC_DECODE_OVER);
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
MND_TOPIC_RESERVE_SIZE
,
TOPIC_DECODE_OVER
)
...
...
@@ -178,7 +180,7 @@ void mndReleaseTopic(SMnode *pMnode, SMqTopicObj *pTopic) {
static
SDbObj
*
mndAcquireDbByTopic
(
SMnode
*
pMnode
,
char
*
topicName
)
{
SName
name
=
{
0
};
tNameFromString
(
&
name
,
topicName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_T
OPIC
);
tNameFromString
(
&
name
,
topicName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_T
ABLE
);
char
db
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
db
);
...
...
@@ -203,20 +205,24 @@ static SDDropTopicReq *mndBuildDropTopicMsg(SMnode *pMnode, SVgObj *pVgroup, SMq
return
pDrop
;
}
static
int32_t
mndCheckCreateTopicMsg
(
SCMCreateTopicReq
*
pCreate
)
{
static
int32_t
mndCheckCreateTopicMsg
(
SCMCreateTopicReq
*
creattopReq
)
{
// deserialize and other stuff
return
0
;
}
static
int32_t
mndCreateTopic
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCMCreateTopicReq
*
pCreate
,
SDbObj
*
pDb
)
{
SMqTopicObj
topicObj
=
{
0
};
tstrncpy
(
topicObj
.
name
,
pCreate
->
name
,
TSDB_T
ABLE
_FNAME_LEN
);
tstrncpy
(
topicObj
.
name
,
pCreate
->
name
,
TSDB_T
OPIC
_FNAME_LEN
);
tstrncpy
(
topicObj
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
topicObj
.
createTime
=
taosGetTimestampMs
();
topicObj
.
updateTime
=
topicObj
.
createTime
;
topicObj
.
uid
=
mndGenerateUid
(
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
topicObj
.
dbUid
=
pDb
->
uid
;
topicObj
.
version
=
1
;
topicObj
.
sql
=
strdup
(
pCreate
->
sql
);
topicObj
.
physicalPlan
=
strdup
(
pCreate
->
physicalPlan
);
topicObj
.
logicalPlan
=
strdup
(
pCreate
->
logicalPlan
);
topicObj
.
sqlLen
=
strlen
(
pCreate
->
sql
);
SSdbRaw
*
pTopicRaw
=
mndTopicActionEncode
(
&
topicObj
);
if
(
pTopicRaw
==
NULL
)
return
-
1
;
...
...
@@ -228,46 +234,47 @@ static int32_t mndCreateTopic(SMnode *pMnode, SMnodeMsg *pMsg, SCMCreateTopicReq
static
int32_t
mndProcessCreateTopicMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
char
*
msgStr
=
pMsg
->
rpcMsg
.
pCont
;
SCMCreateTopicReq
*
pCreate
;
tDeserializeSCMCreateTopicReq
(
msgStr
,
pCreate
);
mDebug
(
"topic:%s, start to create"
,
pCreate
->
name
);
SCMCreateTopicReq
createTopicReq
=
{
0
};
tDeserializeSCMCreateTopicReq
(
msgStr
,
&
createTopicReq
);
mDebug
(
"topic:%s, start to create, sql:%s"
,
createTopicReq
.
name
,
createTopicReq
.
sql
);
if
(
mndCheckCreateTopicMsg
(
pCreate
)
!=
0
)
{
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
if
(
mndCheckCreateTopicMsg
(
&
createTopicReq
)
!=
0
)
{
mError
(
"topic:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
return
-
1
;
}
SMqTopicObj
*
pTopic
=
mndAcquireTopic
(
pMnode
,
pCreate
->
name
);
SMqTopicObj
*
pTopic
=
mndAcquireTopic
(
pMnode
,
createTopicReq
.
name
);
if
(
pTopic
!=
NULL
)
{
sdbRelease
(
pMnode
->
pSdb
,
pTopic
);
if
(
pCreate
->
igExists
)
{
mDebug
(
"topic:%s, already exist, ignore exist is set"
,
pCreate
->
name
);
if
(
createTopicReq
.
igExists
)
{
mDebug
(
"topic:%s, already exist, ignore exist is set"
,
createTopicReq
.
name
);
return
0
;
}
else
{
terrno
=
TSDB_CODE_MND_TOPIC_ALREADY_EXIST
;
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"db:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
return
-
1
;
}
}
SDbObj
*
pDb
=
mndAcquireDbByTopic
(
pMnode
,
pCreate
->
name
);
SDbObj
*
pDb
=
mndAcquireDbByTopic
(
pMnode
,
createTopicReq
.
name
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"topic:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
return
-
1
;
}
int32_t
code
=
mndCreateTopic
(
pMnode
,
pMsg
,
pCreate
,
pDb
);
int32_t
code
=
mndCreateTopic
(
pMnode
,
pMsg
,
&
createTopicReq
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
if
(
code
!=
0
)
{
terrno
=
code
;
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"topic:%s, failed to create since %s"
,
createTopicReq
.
name
,
terrstr
());
return
-
1
;
}
return
TSDB_CODE_
MND_ACTION_IN_PROGR
ESS
;
return
TSDB_CODE_
SUCC
ESS
;
}
static
int32_t
mndDropTopic
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SMqTopicObj
*
pTopic
)
{
return
0
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
cc64e9e4
...
...
@@ -713,13 +713,6 @@ static bool initTableMemIterator(STsdbReadHandle* pHandle, STableCheckInfo* pChe
pCheckInfo
->
initBuf
=
true
;
int32_t
order
=
pHandle
->
order
;
// no data in buffer, abort
// if (pHandle->pMemTable->snapshot.mem == NULL && pHandle->pMemTable->snapshot.imem == NULL) {
// return false;
// }
//
// assert(pCheckInfo->iter == NULL && pCheckInfo->iiter == NULL);
//
STbData
**
pMem
=
NULL
;
STbData
**
pIMem
=
NULL
;
...
...
@@ -787,8 +780,7 @@ static bool initTableMemIterator(STsdbReadHandle* pHandle, STableCheckInfo* pChe
assert
(
pCheckInfo
->
lastKey
>=
key
);
}
}
else
{
tsdbDebug
(
"%p uid:%"
PRId64
", no data in imem, 0x%"
PRIx64
,
pHandle
,
pCheckInfo
->
tableId
,
pHandle
->
qId
);
tsdbDebug
(
"%p uid:%"
PRId64
", no data in imem, 0x%"
PRIx64
,
pHandle
,
pCheckInfo
->
tableId
,
pHandle
->
qId
);
}
return
true
;
...
...
@@ -2554,9 +2546,6 @@ static bool doHasDataInBuffer(STsdbReadHandle* pTsdbReadHandle) {
pTsdbReadHandle
->
activeIndex
+=
1
;
}
// no data in memtable or imemtable, decrease the memory reference.
// TODO !!
// tsdbMayUnTakeMemSnapshot(pTsdbReadHandle);
return
false
;
}
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
cc64e9e4
...
...
@@ -68,6 +68,7 @@ static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
pTbCfg
=
metaGetTbInfoByName
(
pVnode
->
pMeta
,
pReq
->
tableFname
,
&
uid
);
if
(
pTbCfg
==
NULL
)
{
code
=
TSDB_CODE_VND_TB_NOT_EXIST
;
goto
_exit
;
}
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
cc64e9e4
...
...
@@ -285,16 +285,16 @@ int32_t ctgGetTableMetaFromVnode(struct SCatalog* pCatalog, void *pTransporter,
char
dbFullName
[
TSDB_DB_FNAME_LEN
];
tNameGetFullDbName
(
pTableName
,
dbFullName
);
ctgDebug
(
"try to get table meta from vnode, db:%s, tbName:%s"
,
dbFullName
,
pTableName
->
tname
);
ctgDebug
(
"try to get table meta from vnode, db:%s, tbName:%s"
,
dbFullName
,
tNameGetTableName
(
pTableName
)
);
SBuildTableMetaInput
bInput
=
{.
vgId
=
vgroupInfo
->
vgId
,
.
dbName
=
dbFullName
,
.
tableFullName
=
(
char
*
)
pTableName
->
tname
};
SBuildTableMetaInput
bInput
=
{.
vgId
=
vgroupInfo
->
vgId
,
.
dbName
=
dbFullName
,
.
tableFullName
=
(
char
*
)
tNameGetTableName
(
pTableName
)
};
char
*
msg
=
NULL
;
SEpSet
*
pVnodeEpSet
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
code
=
queryBuildMsg
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)](
&
bInput
,
&
msg
,
0
,
&
msgLen
);
if
(
code
)
{
ctgError
(
"Build vnode tablemeta msg failed, code:%x, tbName:%s"
,
code
,
pTableName
->
tname
);
ctgError
(
"Build vnode tablemeta msg failed, code:%x, tbName:%s"
,
code
,
tNameGetTableName
(
pTableName
)
);
CTG_ERR_RET
(
code
);
}
...
...
@@ -313,21 +313,21 @@ int32_t ctgGetTableMetaFromVnode(struct SCatalog* pCatalog, void *pTransporter,
if
(
TSDB_CODE_SUCCESS
!=
rpcRsp
.
code
)
{
if
(
CTG_TABLE_NOT_EXIST
(
rpcRsp
.
code
))
{
SET_META_TYPE_NONE
(
output
->
metaType
);
ctgDebug
(
"tablemeta not exist in vnode, tbName:%s"
,
pTableName
->
tname
);
ctgDebug
(
"tablemeta not exist in vnode, tbName:%s"
,
tNameGetTableName
(
pTableName
)
);
return
TSDB_CODE_SUCCESS
;
}
ctgError
(
"error rsp for table meta from vnode, code:%x, tbName:%s"
,
rpcRsp
.
code
,
pTableName
->
tname
);
ctgError
(
"error rsp for table meta from vnode, code:%x, tbName:%s"
,
rpcRsp
.
code
,
tNameGetTableName
(
pTableName
)
);
CTG_ERR_RET
(
rpcRsp
.
code
);
}
code
=
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)](
output
,
rpcRsp
.
pCont
,
rpcRsp
.
contLen
);
if
(
code
)
{
ctgError
(
"Process vnode tablemeta rsp failed, code:%x, tbName:%s"
,
code
,
pTableName
->
tname
);
ctgError
(
"Process vnode tablemeta rsp failed, code:%x, tbName:%s"
,
code
,
tNameGetTableName
(
pTableName
)
);
CTG_ERR_RET
(
code
);
}
ctgDebug
(
"Got table meta from vnode, db:%s, tbName:%s"
,
dbFullName
,
pTableName
->
tname
);
ctgDebug
(
"Got table meta from vnode, db:%s, tbName:%s"
,
dbFullName
,
tNameGetTableName
(
pTableName
)
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -776,7 +776,7 @@ int32_t ctgRenewTableMetaImpl(struct SCatalog* pCatalog, void *pTransporter, con
STableMetaOutput
*
output
=
&
voutput
;
if
(
CTG_IS_STABLE
(
isSTable
))
{
ctgDebug
(
"will renew table meta, supposed to be stable, tbName:%s"
,
pTableName
->
tname
);
ctgDebug
(
"will renew table meta, supposed to be stable, tbName:%s"
,
tNameGetTableName
(
pTableName
)
);
// if get from mnode failed, will not try vnode
CTG_ERR_JRET
(
ctgGetTableMetaFromMnode
(
pCatalog
,
pTransporter
,
pMgmtEps
,
pTableName
,
&
moutput
));
...
...
@@ -787,13 +787,13 @@ int32_t ctgRenewTableMetaImpl(struct SCatalog* pCatalog, void *pTransporter, con
output
=
&
moutput
;
}
}
else
{
ctgDebug
(
"will renew table meta, not supposed to be stable, tbName:%s, isStable:%d"
,
pTableName
->
tname
,
isSTable
);
ctgDebug
(
"will renew table meta, not supposed to be stable, tbName:%s, isStable:%d"
,
tNameGetTableName
(
pTableName
)
,
isSTable
);
// if get from vnode failed or no table meta, will not try mnode
CTG_ERR_JRET
(
ctgGetTableMetaFromVnode
(
pCatalog
,
pTransporter
,
pMgmtEps
,
pTableName
,
&
vgroupInfo
,
&
voutput
));
if
(
CTG_IS_META_TABLE
(
voutput
.
metaType
)
&&
TSDB_SUPER_TABLE
==
voutput
.
tbMeta
->
tableType
)
{
ctgDebug
(
"will continue to renew table meta since got stable, tbName:%s, metaType:%d"
,
pTableName
->
tname
,
voutput
.
metaType
);
ctgDebug
(
"will continue to renew table meta since got stable, tbName:%s, metaType:%d"
,
tNameGetTableName
(
pTableName
)
,
voutput
.
metaType
);
CTG_ERR_JRET
(
ctgGetTableMetaFromMnodeImpl
(
pCatalog
,
pTransporter
,
pMgmtEps
,
voutput
.
tbFname
,
&
moutput
));
...
...
@@ -820,7 +820,7 @@ int32_t ctgRenewTableMetaImpl(struct SCatalog* pCatalog, void *pTransporter, con
}
if
(
CTG_IS_META_NONE
(
output
->
metaType
))
{
ctgError
(
"no tablemeta got, tbNmae:%s"
,
pTableName
->
tname
);
ctgError
(
"no tablemeta got, tbNmae:%s"
,
tNameGetTableName
(
pTableName
)
);
CTG_ERR_JRET
(
CTG_ERR_CODE_TABLE_NOT_EXIST
);
}
...
...
@@ -860,7 +860,7 @@ int32_t ctgGetTableMeta(struct SCatalog* pCatalog, void *pRpc, const SEpSet* pMg
CTG_ERR_RET
(
ctgGetTableMetaFromCache
(
pCatalog
,
pTableName
,
pTableMeta
,
&
exist
));
if
(
0
==
exist
)
{
ctgError
(
"renew tablemeta succeed but get from cache failed, may be deleted, tbName:%s"
,
pTableName
->
tname
);
ctgError
(
"renew tablemeta succeed but get from cache failed, may be deleted, tbName:%s"
,
tNameGetTableName
(
pTableName
)
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
...
...
@@ -1241,7 +1241,7 @@ int32_t catalogGetTableDistVgroup(struct SCatalog* pCatalog, void *pRpc, const S
}
else
{
int32_t
vgId
=
tbMeta
->
vgId
;
if
(
NULL
==
taosHashGetClone
(
dbVgroup
->
vgInfo
,
&
vgId
,
sizeof
(
vgId
),
&
vgroupInfo
))
{
ctgError
(
"table's vgId not found in vgroup list, vgId:%d, tbName:%s"
,
vgId
,
pTableName
->
tname
);
ctgError
(
"table's vgId not found in vgroup list, vgId:%d, tbName:%s"
,
vgId
,
tNameGetTableName
(
pTableName
)
);
CTG_ERR_JRET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
...
...
@@ -1252,7 +1252,7 @@ int32_t catalogGetTableDistVgroup(struct SCatalog* pCatalog, void *pRpc, const S
}
if
(
NULL
==
taosArrayPush
(
vgList
,
&
vgroupInfo
))
{
ctgError
(
"taosArrayPush vgroupInfo to array failed, vgId:%d, tbName:%s"
,
vgId
,
pTableName
->
tname
);
ctgError
(
"taosArrayPush vgroupInfo to array failed, vgId:%d, tbName:%s"
,
vgId
,
tNameGetTableName
(
pTableName
)
);
CTG_ERR_JRET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
cc64e9e4
...
...
@@ -542,34 +542,34 @@ typedef struct SOrderOperatorInfo {
void
appendUpstream
(
SOperatorInfo
*
p
,
SOperatorInfo
*
pUpstream
);
SOperatorInfo
*
createDataBlocksOptScanInfo
(
void
*
pTsdb
QueryHandle
,
STaskRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
,
int32_t
reverseTime
);
SOperatorInfo
*
createTableScanOperator
(
void
*
pTsdb
Query
Handle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTableSeqScanOperator
(
void
*
pTsdb
Query
Handle
,
STaskRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createAggregateOperatorInfo
(
S
TaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createProjectOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createLimitOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
);
SOperatorInfo
*
createTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createAllTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createSWindowOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createFillOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
bool
multigroupResult
);
SOperatorInfo
*
createGroupbyOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createMultiTableAggOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createMultiTableTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createAllMultiTableTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createDataBlocksOptScanInfo
(
void
*
pTsdb
ReadHandle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
,
int32_t
reverseTime
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTableScanOperator
(
void
*
pTsdb
Read
Handle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTableSeqScanOperator
(
void
*
pTsdb
Read
Handle
,
STaskRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createAggregateOperatorInfo
(
S
OperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createProjectOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createLimitOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
);
SOperatorInfo
*
createTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createAllTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createSWindowOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createFillOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
bool
multigroupResult
);
SOperatorInfo
*
createGroupbyOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createMultiTableAggOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createMultiTableTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createAllMultiTableTimeIntervalOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createTagScanOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createDistinctOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createTableBlockInfoScanOperator
(
void
*
pTsdb
Query
Handle
,
STaskRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createDistinctOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createTableBlockInfoScanOperator
(
void
*
pTsdb
Read
Handle
,
STaskRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createMultiwaySortOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
int32_t
numOfRows
,
void
*
merger
);
SOperatorInfo
*
createGlobalAggregateOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
void
*
param
,
SArray
*
pUdfInfo
,
bool
groupResultMixedUp
);
SOperatorInfo
*
createStatewindowOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createSLimitOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
void
*
merger
,
bool
multigroupResult
);
SOperatorInfo
*
createFilterOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
SOperatorInfo
*
createGlobalAggregateOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
void
*
param
,
SArray
*
pUdfInfo
,
bool
groupResultMixedUp
);
SOperatorInfo
*
createStatewindowOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createSLimitOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
void
*
merger
,
bool
multigroupResult
);
SOperatorInfo
*
createFilterOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
SColumnInfo
*
pCols
,
int32_t
numOfFilter
);
SOperatorInfo
*
createJoinOperatorInfo
(
SOperatorInfo
**
p
Upstream
,
int32_t
numOfUp
stream
,
SSchema
*
pSchema
,
int32_t
numOfOutput
);
SOperatorInfo
*
createOrderOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
up
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
SOrder
*
pOrderVal
);
SOperatorInfo
*
createJoinOperatorInfo
(
SOperatorInfo
**
p
downstream
,
int32_t
numOfDown
stream
,
SSchema
*
pSchema
,
int32_t
numOfOutput
);
SOperatorInfo
*
createOrderOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
down
stream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
SOrder
*
pOrderVal
);
//SSDataBlock* doGlobalAggregate(void* param, bool* newgroup);
//SSDataBlock* doMultiwayMergeSort(void* param, bool* newgroup);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
cc64e9e4
此差异已折叠。
点击以展开。
source/libs/function/src/tscalarfunction.c
浏览文件 @
cc64e9e4
...
...
@@ -2,7 +2,6 @@
#include "tbinoperator.h"
#include "tunaryoperator.h"
static
void
assignBasicParaInfo
(
struct
SScalarFuncParam
*
dst
,
const
struct
SScalarFuncParam
*
src
)
{
dst
->
type
=
src
->
type
;
dst
->
bytes
=
src
->
bytes
;
...
...
source/libs/parser/inc/astGenerator.h
浏览文件 @
cc64e9e4
...
...
@@ -170,8 +170,6 @@ typedef struct SCreateDbInfo {
int8_t
update
;
int8_t
cachelast
;
SArray
*
keep
;
// int8_t dbType;
// int16_t partitions;
}
SCreateDbInfo
;
typedef
struct
SCreateFuncInfo
{
...
...
source/libs/parser/src/astValidate.c
浏览文件 @
cc64e9e4
...
...
@@ -917,6 +917,8 @@ int32_t validateLimitNode(SQueryStmtInfo *pQueryInfo, SSqlNode* pSqlNode, SMsgBu
return
buildInvalidOperationMsg
(
pMsgBuf
,
msg1
);
}
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
validateOrderbyNode
(
SQueryStmtInfo
*
pQueryInfo
,
SSqlNode
*
pSqlNode
,
SMsgBuf
*
pMsgBuf
)
{
...
...
source/libs/parser/src/parser.c
浏览文件 @
cc64e9e4
...
...
@@ -80,11 +80,11 @@ int32_t parseQuerySql(SParseContext* pCxt, SQueryNode** pQuery) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQueryNode
**
pQuery
)
{
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQueryNode
**
pQuery
Node
)
{
if
(
isInsertSql
(
pCxt
->
pSql
,
pCxt
->
sqlLen
))
{
return
parseInsertSql
(
pCxt
,
(
SVnodeModifOpStmtInfo
**
)
pQuery
);
return
parseInsertSql
(
pCxt
,
(
SVnodeModifOpStmtInfo
**
)
pQuery
Node
);
}
else
{
return
parseQuerySql
(
pCxt
,
pQuery
);
return
parseQuerySql
(
pCxt
,
pQuery
Node
);
}
}
...
...
source/libs/planner/src/physicalPlan.c
浏览文件 @
cc64e9e4
...
...
@@ -189,6 +189,7 @@ static SPhyNode* createUserTableScanNode(SQueryPlanNode* pPlanNode, SQueryTableI
return
(
SPhyNode
*
)
node
;
}
static
bool
isSystemTable
(
SQueryTableInfo
*
pTable
)
{
// todo
return
false
;
...
...
@@ -261,8 +262,8 @@ static void vgroupMsgToEpSet(const SVgroupMsg* vg, SQueryNodeAddr* execNode) {
}
static
uint64_t
splitSubplanByTable
(
SPlanContext
*
pCxt
,
SQueryPlanNode
*
pPlanNode
,
SQueryTableInfo
*
pTable
)
{
SVgroupsInfo
*
v
groupList
=
pTable
->
pMeta
->
vgroupList
;
for
(
int32_t
i
=
0
;
i
<
p
Table
->
pMeta
->
v
groupList
->
numOfVgroups
;
++
i
)
{
SVgroupsInfo
*
pV
groupList
=
pTable
->
pMeta
->
vgroupList
;
for
(
int32_t
i
=
0
;
i
<
p
V
groupList
->
numOfVgroups
;
++
i
)
{
STORE_CURRENT_SUBPLAN
(
pCxt
);
SSubplan
*
subplan
=
initSubplan
(
pCxt
,
QUERY_TYPE_SCAN
);
subplan
->
msgType
=
TDMT_VND_QUERY
;
...
...
source/libs/planner/src/physicalPlanJson.c
浏览文件 @
cc64e9e4
...
...
@@ -559,28 +559,35 @@ static const char* jkScanNodeTableId = "TableId";
static
const
char
*
jkScanNodeTableType
=
"TableType"
;
static
const
char
*
jkScanNodeTableOrder
=
"Order"
;
static
const
char
*
jkScanNodeTableCount
=
"Count"
;
static
const
char
*
jkScanNodeTableRevCount
=
"Reverse"
;
static
bool
scanNodeToJson
(
const
void
*
obj
,
cJSON
*
json
)
{
const
SScanPhyNode
*
scan
=
(
const
SScanPhyNode
*
)
obj
;
bool
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTableId
,
scan
->
uid
);
const
SScanPhyNode
*
pNode
=
(
const
SScanPhyNode
*
)
obj
;
bool
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTableId
,
pNode
->
uid
);
if
(
res
)
{
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTableType
,
pNode
->
tableType
);
}
if
(
res
)
{
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTable
Type
,
scan
->
tableType
);
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTable
Order
,
pNode
->
order
);
}
if
(
res
)
{
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTable
Order
,
scan
->
order
);
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTable
Count
,
pNode
->
count
);
}
if
(
res
)
{
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTable
Count
,
scan
->
count
);
res
=
cJSON_AddNumberToObject
(
json
,
jkScanNodeTable
RevCount
,
pNode
->
reverse
);
}
return
res
;
}
static
bool
scanNodeFromJson
(
const
cJSON
*
json
,
void
*
obj
)
{
SScanPhyNode
*
scan
=
(
SScanPhyNode
*
)
obj
;
scan
->
uid
=
getNumber
(
json
,
jkScanNodeTableId
);
scan
->
tableType
=
getNumber
(
json
,
jkScanNodeTableType
);
scan
->
count
=
getNumber
(
json
,
jkScanNodeTableCount
);
scan
->
order
=
getNumber
(
json
,
jkScanNodeTableOrder
);
SScanPhyNode
*
pNode
=
(
SScanPhyNode
*
)
obj
;
pNode
->
uid
=
getNumber
(
json
,
jkScanNodeTableId
);
pNode
->
tableType
=
getNumber
(
json
,
jkScanNodeTableType
);
pNode
->
count
=
getNumber
(
json
,
jkScanNodeTableCount
);
pNode
->
order
=
getNumber
(
json
,
jkScanNodeTableOrder
);
pNode
->
reverse
=
getNumber
(
json
,
jkScanNodeTableRevCount
);
return
true
;
}
...
...
@@ -996,10 +1003,13 @@ static SSubplan* subplanFromJson(const cJSON* json) {
if
(
NULL
==
subplan
)
{
return
NULL
;
}
bool
res
=
fromObject
(
json
,
jkSubplanId
,
subplanIdFromJson
,
&
subplan
->
id
,
true
);
if
(
res
)
{
res
=
fromPnode
(
json
,
jkSubplanNode
,
phyNodeFromJson
,
(
void
**
)
&
subplan
->
pNode
);
}
if
(
res
)
{
res
=
fromObjectWithAlloc
(
json
,
jkSubplanDataSink
,
dataSinkFromJson
,
(
void
**
)
&
subplan
->
pDataSink
,
sizeof
(
SDataSink
),
false
);
}
...
...
@@ -1027,7 +1037,7 @@ int32_t subPlanToString(const SSubplan* subplan, char** str, int32_t* len) {
}
*
str
=
cJSON_Print
(
json
);
// printf("====Physical plan:====\n")
// printf("====Physical plan:====\n")
;
// printf("%s\n", *str);
*
len
=
strlen
(
*
str
)
+
1
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1047,14 +1057,18 @@ cJSON* qDagToJson(const SQueryDag* pDag) {
if
(
pRoot
==
NULL
)
{
return
NULL
;
}
cJSON_AddNumberToObject
(
pRoot
,
"numOfSubplans"
,
pDag
->
numOfSubplans
);
cJSON_AddNumberToObject
(
pRoot
,
"queryId"
,
pDag
->
queryId
);
cJSON_AddNumberToObject
(
pRoot
,
"Number"
,
pDag
->
numOfSubplans
);
cJSON_AddNumberToObject
(
pRoot
,
"QueryId"
,
pDag
->
queryId
);
cJSON
*
pLevels
=
cJSON_CreateArray
();
if
(
pLevels
==
NULL
)
{
cJSON_Delete
(
pRoot
);
return
NULL
;
}
cJSON_AddItemToObject
(
pRoot
,
"pSubplans"
,
pLevels
);
cJSON_AddItemToObject
(
pRoot
,
"Subplans"
,
pLevels
);
size_t
level
=
taosArrayGetSize
(
pDag
->
pSubplans
);
for
(
size_t
i
=
0
;
i
<
level
;
i
++
)
{
const
SArray
*
pSubplans
=
(
const
SArray
*
)
taosArrayGetP
(
pDag
->
pSubplans
,
i
);
...
...
@@ -1064,6 +1078,7 @@ cJSON* qDagToJson(const SQueryDag* pDag) {
cJSON_Delete
(
pRoot
);
return
NULL
;
}
cJSON_AddItemToArray
(
pLevels
,
plansOneLevel
);
for
(
size_t
j
=
0
;
j
<
num
;
j
++
)
{
cJSON
*
pSubplan
=
subplanToJson
((
const
SSubplan
*
)
taosArrayGetP
(
pSubplans
,
j
));
...
...
@@ -1071,6 +1086,7 @@ cJSON* qDagToJson(const SQueryDag* pDag) {
cJSON_Delete
(
pRoot
);
return
NULL
;
}
cJSON_AddItemToArray
(
plansOneLevel
,
pSubplan
);
}
}
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
cc64e9e4
...
...
@@ -1029,6 +1029,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
msg
=
pTask
->
msg
;
break
;
}
case
TDMT_VND_QUERY
:
{
msgSize
=
sizeof
(
SSubQueryMsg
)
+
pTask
->
msgLen
;
msg
=
calloc
(
1
,
msgSize
);
...
...
@@ -1047,7 +1048,8 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
pMsg
->
contentLen
=
htonl
(
pTask
->
msgLen
);
memcpy
(
pMsg
->
msg
,
pTask
->
msg
,
pTask
->
msgLen
);
break
;
}
}
case
TDMT_VND_RES_READY
:
{
msgSize
=
sizeof
(
SResReadyReq
);
msg
=
calloc
(
1
,
msgSize
);
...
...
source/libs/transport/src/rpcTcp.c
浏览文件 @
cc64e9e4
...
...
@@ -413,8 +413,11 @@ void *taosOpenTcpClientConnection(void *shandle, void *thandle, uint32_t ip, uin
pFdObj
->
thandle
=
thandle
;
pFdObj
->
port
=
port
;
pFdObj
->
ip
=
ip
;
tDebug
(
"%s %p TCP connection to 0x%x:%hu is created, localPort:%hu FD:%p numOfFds:%d"
,
pThreadObj
->
label
,
thandle
,
ip
,
port
,
localPort
,
pFdObj
,
pThreadObj
->
numOfFds
);
char
ipport
[
40
]
=
{
0
};
taosIpPort2String
(
ip
,
port
,
ipport
);
tDebug
(
"%s %p TCP connection to %s is created, localPort:%hu FD:%p numOfFds:%d"
,
pThreadObj
->
label
,
thandle
,
ipport
,
localPort
,
pFdObj
,
pThreadObj
->
numOfFds
);
}
else
{
tError
(
"%s failed to malloc client FdObj(%s)"
,
pThreadObj
->
label
,
strerror
(
errno
));
taosCloseSocket
(
fd
);
...
...
source/util/src/terror.c
浏览文件 @
cc64e9e4
...
...
@@ -301,12 +301,13 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_CFG_FILE, "Invalid config file")
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_INVALID_TERM_FILE
,
"Invalid term file"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_IS_FLOWCTRL
,
"Database memory is full"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_IS_DROPPING
,
"Database is dropping"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_IS_UPDATING
,
"Database is updating"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_IS_UPDATING
,
"Database is updating"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_IS_CLOSING
,
"Database is closing"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NOT_SYNCED
,
"Database suspended"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_NO_WRITE_AUTH
,
"Database write operation denied"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_IS_SYNCING
,
"Database is syncing"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_INVALID_TSDB_STATE
,
"Invalid tsdb state"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_VND_TB_NOT_EXIST
,
"Table not exists"
)
// tsdb
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_INVALID_TABLE_ID
,
"Invalid table ID"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录