Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
TDengine
提交
37b55ef1
T
TDengine
项目概览
dgr6878
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
8
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
37b55ef1
编写于
2月 18, 2020
作者:
陶建辉(Jeff)
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '2.0' of
https://github.com/taosdata/TDengine
into 2.0
上级
005a7fda
15e4b5ca
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
295 addition
and
470 deletion
+295
-470
src/client/src/tscSql.c
src/client/src/tscSql.c
+1
-1
src/dnode/inc/dnodeMgmt.h
src/dnode/inc/dnodeMgmt.h
+5
-0
src/dnode/inc/dnodeRead.h
src/dnode/inc/dnodeRead.h
+12
-0
src/dnode/inc/dnodeShell.h
src/dnode/inc/dnodeShell.h
+2
-1
src/dnode/inc/dnodeSystem.h
src/dnode/inc/dnodeSystem.h
+2
-1
src/dnode/inc/dnodeUtil.h
src/dnode/inc/dnodeUtil.h
+39
-0
src/dnode/inc/dnodeWrite.h
src/dnode/inc/dnodeWrite.h
+6
-4
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+2
-2
src/dnode/src/dnodeRead.c
src/dnode/src/dnodeRead.c
+44
-0
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+103
-443
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+6
-5
src/dnode/src/dnodeUtil.c
src/dnode/src/dnodeUtil.c
+25
-0
src/dnode/src/dnodeWrite.c
src/dnode/src/dnodeWrite.c
+14
-3
src/inc/http.h
src/inc/http.h
+8
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+19
-2
src/mnode/src/mgmtSystem.c
src/mnode/src/mgmtSystem.c
+1
-1
src/util/inc/tstatus.h
src/util/inc/tstatus.h
+2
-2
src/vnode/detail/inc/vnode.h
src/vnode/detail/inc/vnode.h
+1
-2
src/vnode/detail/src/vnodeRead.c
src/vnode/detail/src/vnodeRead.c
+3
-3
未找到文件。
src/client/src/tscSql.c
浏览文件 @
37b55ef1
...
...
@@ -660,7 +660,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) {
}
// projection query on metric, pipeline retrieve data from vnode list,
// instead of two-stage merge
v
nodeProcessMsgFromShell free qhandle
// instead of two-stage merge
d
nodeProcessMsgFromShell free qhandle
nRows
=
taos_fetch_block_impl
(
res
,
rows
);
// current subclause is completed, try the next subclause
...
...
src/dnode/inc/dnodeMgmt.h
浏览文件 @
37b55ef1
...
...
@@ -20,6 +20,8 @@
extern
"C"
{
#endif
#include <stdint.h>
#include <stdbool.h>
#include "tsched.h"
#include "dnode.h"
...
...
@@ -30,6 +32,9 @@ void dnodeDistributeMsgFromMgmt(char *content, int msgLen, int msgType, SMgmtObj
extern
void
*
dmQhandle
;
void
dnodeSendVpeerCfgMsg
(
int32_t
vnode
);
void
dnodeSendMeterCfgMsg
(
int32_t
vnode
,
int32_t
sid
);
#ifdef __cplusplus
}
#endif
...
...
src/dnode/inc/dnodeRead.h
浏览文件 @
37b55ef1
...
...
@@ -20,12 +20,24 @@
extern
"C"
{
#endif
#include <stdbool.h>
#include <stdint.h>
#include "taosdef.h"
#include "taosmsg.h"
#include "dnodeShell.h"
void
dnodeFreeQInfoInQueue
(
SShellObj
*
pShellObj
);
/*
* Dnode handle read messages
* The processing result is returned by callback function with pShellObj parameter
*/
int32_t
dnodeReadData
(
SQueryMeterMsg
*
msg
,
void
*
pShellObj
,
void
(
*
callback
)(
SQueryMeterRsp
*
rspMsg
,
void
*
pShellObj
));
typedef
void
(
*
SDnodeRetrieveCallbackFp
)(
int32_t
code
,
SRetrieveMeterRsp
*
pRetrieveRspMsg
,
void
*
pShellObj
);
void
dnodeRetrieveData
(
SRetrieveMeterMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pShellObj
,
SDnodeRetrieveCallbackFp
callback
);
#ifdef __cplusplus
}
#endif
...
...
src/dnode/inc/dnodeShell.h
浏览文件 @
37b55ef1
...
...
@@ -26,7 +26,6 @@ extern "C" {
typedef
struct
{
int
sid
;
int
vnode
;
uint32_t
ip
;
uint16_t
port
;
int32_t
count
;
// track the number of imports
...
...
@@ -38,6 +37,8 @@ typedef struct {
int32_t
dnodeInitShell
();
void
dnodeCleanupShell
();
//SDnodeStatisInfo dnodeGetStatisInfo()
#ifdef __cplusplus
...
...
src/dnode/inc/dnodeSystem.h
浏览文件 @
37b55ef1
...
...
@@ -37,7 +37,8 @@ extern int32_t (*dnodeInitStorage)();
extern
void
(
*
dnodeCleanupStorage
)();
extern
void
(
*
dnodeParseParameterK
)();
extern
int32_t
tsMaxQueues
;
extern
void
**
tsRpcQhandle
;
extern
void
*
tsQueryQhandle
;
int32_t
dnodeInitSystem
();
void
dnodeCleanUpSystem
();
...
...
src/dnode/inc/dnodeUtil.h
0 → 100644
浏览文件 @
37b55ef1
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_DNODE_UTIL_H
#define TDENGINE_DNODE_UTIL_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include <stdbool.h>
#include <stdint.h>
#include "taosdef.h"
#include "taosmsg.h"
#include "tstatus.h"
EVnodeStatus
dnodeGetVnodeStatus
(
int32_t
vnode
);
bool
dnodeCheckVnodeExist
(
int32_t
vnode
);
void
*
dnodeGetVnodeObj
(
int32_t
vnode
);
#ifdef __cplusplus
}
#endif
#endif
src/dnode/inc/dnodeWrite.h
浏览文件 @
37b55ef1
...
...
@@ -26,11 +26,13 @@ extern "C" {
#include "taosmsg.h"
/*
* Write data based on dnode
* If >= 0, it is affect rows
* If < 0, get error code from terrno
* Write data based on dnode, the detail result can be fetched from rsponse
* pSubmitMsg: Data to be written
* pShellObj: Used to pass a communication handle
* callback: Pass the write result through a callback function, possibly in a different thread space
* rsp: will not be freed by callback function
*/
int32_t
dnodeWriteData
(
SShellSubmitMsg
*
msg
);
void
dnodeWriteData
(
SShellSubmitMsg
*
pMsg
,
void
*
pShellObj
,
void
(
*
callback
)(
SShellSubmitRspMsg
*
rsp
,
void
*
pShellObj
)
);
/*
* Check if table already exists
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
37b55ef1
...
...
@@ -548,7 +548,7 @@ int vnodeProcessCfgDnodeRequest(char *cont, int contLen, SMgmtObj *pMgmtObj) {
return
0
;
}
void
vnodeSendVpeerCfgMsg
(
in
t
vnode
)
{
void
dnodeSendVpeerCfgMsg
(
int32_
t
vnode
)
{
char
*
pMsg
,
*
pStart
;
int
msgLen
;
SVpeerCfgMsg
*
pCfg
;
...
...
@@ -566,7 +566,7 @@ void vnodeSendVpeerCfgMsg(int vnode) {
taosSendMsgToMnode
(
pObj
,
pStart
,
msgLen
);
}
int
vnodeSendMeterCfgMsg
(
int
vnode
,
in
t
sid
)
{
void
dnodeSendMeterCfgMsg
(
int32_t
vnode
,
int32_
t
sid
)
{
char
*
pMsg
,
*
pStart
;
int
msgLen
;
SMeterCfgMsg
*
pCfg
;
...
...
src/dnode/src/dnodeRead.c
浏览文件 @
37b55ef1
...
...
@@ -14,4 +14,48 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "taoserror.h"
#include "tlog.h"
#include "dnodeWrite.h"
#include "dnode.h"
#include "dnodeRead.h"
#include "dnodeSystem.h"
void
dnodeFreeQInfoInQueue
(
SShellObj
*
pShellObj
)
{
}
void
dnodeExecuteRetrieveData
(
SSchedMsg
*
pSched
)
{
SRetrieveMeterMsg
*
pRetrieve
=
(
SRetrieveMeterMsg
*
)
pSched
->
msg
;
SDnodeRetrieveCallbackFp
callback
=
(
SDnodeRetrieveCallbackFp
)
pSched
->
thandle
;
SShellObj
*
pObj
=
(
SShellObj
*
)
pSched
->
ahandle
;
SRetrieveMeterRsp
result
=
{
0
};
/*
* in case of server restart, apps may hold qhandle created by server before restart,
* which is actually invalid, therefore, signature check is required.
*/
if
(
pRetrieve
->
qhandle
!=
(
uint64_t
)
pObj
->
qhandle
)
{
// if free flag is set, client wants to clean the resources
dError
(
"QInfo:%p, qhandle:%p is not matched with saved:%p"
,
pObj
->
qhandle
,
pRetrieve
->
qhandle
,
pObj
->
qhandle
);
int32_t
code
=
TSDB_CODE_INVALID_QHANDLE
;
(
*
callback
)(
code
,
&
result
,
pObj
);
}
//TODO build response here
free
(
pSched
->
msg
);
}
void
dnodeRetrieveData
(
SRetrieveMeterMsg
*
pMsg
,
int32_t
msgLen
,
void
*
pShellObj
,
SDnodeRetrieveCallbackFp
callback
)
{
int8_t
*
msg
=
malloc
(
msgLen
);
memcpy
(
msg
,
pMsg
,
msgLen
);
SSchedMsg
schedMsg
;
schedMsg
.
msg
=
msg
;
schedMsg
.
ahandle
=
pShellObj
;
schedMsg
.
thandle
=
callback
;
schedMsg
.
fp
=
dnodeExecuteRetrieveData
;
taosScheduleTask
(
tsQueryQhandle
,
&
schedMsg
);
}
src/dnode/src/dnodeShell.c
浏览文件 @
37b55ef1
此差异已折叠。
点击以展开。
src/dnode/src/dnodeSystem.c
浏览文件 @
37b55ef1
...
...
@@ -52,9 +52,9 @@ static int32_t dnodeInitTmrCtl();
void
*
tsStatusTimer
=
NULL
;
void
*
vnodeTmrCtrl
;
void
**
r
pcQhandle
;
void
**
tsR
pcQhandle
;
void
*
dmQhandle
;
void
*
q
ueryQhandle
;
void
*
tsQ
ueryQhandle
;
int32_t
tsVnodePeers
=
TSDB_VNODES_SUPPORT
-
1
;
int32_t
tsMaxQueues
;
uint32_t
tsRebootTime
;
...
...
@@ -95,6 +95,7 @@ void dnodeCleanUpSystem() {
tsStatusTimer
=
NULL
;
}
dnodeCleanupShell
();
dnodeCleanUpModules
();
dnodeCleanupVnodes
();
taosCloseLogger
();
...
...
@@ -269,7 +270,7 @@ static int32_t dnodeInitQueryQHandle() {
int32_t
maxQueueSize
=
tsNumOfVnodesPerCore
*
tsNumOfCores
*
tsSessionsPerVnode
;
dTrace
(
"query task queue initialized, max slot:%d, task threads:%d"
,
maxQueueSize
,
numOfThreads
);
q
ueryQhandle
=
taosInitSchedulerWithInfo
(
maxQueueSize
,
numOfThreads
,
"query"
,
vnodeTmrCtrl
);
tsQ
ueryQhandle
=
taosInitSchedulerWithInfo
(
maxQueueSize
,
numOfThreads
,
"query"
,
vnodeTmrCtrl
);
return
0
;
}
...
...
@@ -291,10 +292,10 @@ static int32_t dnodeInitRpcQHandle() {
tsMaxQueues
=
1
;
}
r
pcQhandle
=
malloc
(
tsMaxQueues
*
sizeof
(
void
*
));
tsR
pcQhandle
=
malloc
(
tsMaxQueues
*
sizeof
(
void
*
));
for
(
int32_t
i
=
0
;
i
<
tsMaxQueues
;
++
i
)
{
r
pcQhandle
[
i
]
=
taosInitScheduler
(
tsSessionsPerVnode
,
1
,
"dnode"
);
tsR
pcQhandle
[
i
]
=
taosInitScheduler
(
tsSessionsPerVnode
,
1
,
"dnode"
);
}
dmQhandle
=
taosInitScheduler
(
tsSessionsPerVnode
,
1
,
"mgmt"
);
...
...
src/dnode/src/dnodeUtil.c
0 → 100644
浏览文件 @
37b55ef1
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "dnodeUtil.h"
EVnodeStatus
dnodeGetVnodeStatus
(
int32_t
vnode
)
{
return
TSDB_VN_STATUS_MASTER
;
}
bool
dnodeCheckVnodeExist
(
int32_t
vnode
)
{
return
true
;
}
src/dnode/src/dnodeWrite.c
浏览文件 @
37b55ef1
...
...
@@ -14,15 +14,26 @@
*/
#define _DEFAULT_SOURCE
#include "
dnodeWrite
.h"
#include "
os
.h"
#include "taoserror.h"
#include "tlog.h"
#include "dnodeWrite.h"
int32_t
dnodeCheckTableExist
(
char
*
tableId
)
{
return
0
;
}
int32_t
dnodeWriteData
(
SShellSubmitMsg
*
msg
)
{
return
0
;
void
dnodeWriteData
(
SShellSubmitMsg
*
pSubmit
,
void
*
pShellObj
,
void
(
*
callback
)(
SShellSubmitRspMsg
*
,
void
*
))
{
SShellSubmitRspMsg
result
=
{
0
};
int32_t
numOfSid
=
htonl
(
pSubmit
->
numOfSid
);
if
(
numOfSid
<=
0
)
{
dError
(
"invalid num of tables:%d"
,
numOfSid
);
result
.
code
=
TSDB_CODE_INVALID_QUERY_MSG
;
callback
(
&
result
,
pShellObj
);
}
//TODO: submit implementation
}
int32_t
dnodeCreateNormalTable
(
SCreateNormalTableMsg
*
table
)
{
...
...
src/inc/http.h
浏览文件 @
37b55ef1
...
...
@@ -16,6 +16,10 @@
#ifndef TDENGINE_HTTP_H
#define TDENGINE_HTTP_H
#ifdef __cplusplus
extern
"C"
{
#endif
#include "tglobalcfg.h"
#include "tlog.h"
...
...
@@ -44,4 +48,8 @@
int32_t
httpGetReqCount
();
#ifdef __cplusplus
}
#endif
#endif
src/inc/taosmsg.h
浏览文件 @
37b55ef1
...
...
@@ -271,6 +271,7 @@ typedef struct {
}
SSubmitMsg
;
typedef
struct
{
int32_t
vnode
;
int32_t
sid
;
int32_t
sversion
;
uint64_t
uid
;
...
...
@@ -279,12 +280,28 @@ typedef struct {
}
SShellSubmitBlock
;
typedef
struct
{
short
import
;
short
vnode
;
int8_t
import
;
int8_t
reserved
[
3
]
;
int32_t
numOfSid
;
/* total number of sid */
char
blks
[];
/* numOfSid blocks, each blocks for one meter */
}
SShellSubmitMsg
;
typedef
struct
{
int32_t
vnode
;
// vnode index of failed block
int32_t
sid
;
// table index of failed block
int32_t
code
;
// errorcode while write data to vnode, such as not created, dropped, no space, invalid table
}
SShellSubmitRspBlock
;
typedef
struct
{
int32_t
code
;
// 0-success, 1-inprogress, > 1 error code
int32_t
numOfRows
;
// number of records the client is trying to write
int32_t
affectedRows
;
// number of records actually written
int32_t
failedRows
;
// number of failed records (exclude duplicate records)
int32_t
numOfFailedBlocks
;
SShellSubmitRspBlock
*
failedBlocks
;
}
SShellSubmitRspMsg
;
typedef
struct
SSchema
{
uint8_t
type
;
char
name
[
TSDB_COL_NAME_LEN
];
...
...
src/mnode/src/mgmtSystem.c
浏览文件 @
37b55ef1
...
...
@@ -40,7 +40,7 @@ void * mgmtStatisticTimer = NULL;
int
mgmtShellConns
=
0
;
int
mgmtDnodeConns
=
0
;
extern
void
*
pShellConn
;
extern
void
**
r
pcQhandle
;
extern
void
**
tsR
pcQhandle
;
extern
SMgmtIpList
mgmtIpList
;
extern
SMgmtIpList
mgmtPublicIpList
;
extern
char
mgmtIpStr
[
TSDB_MAX_MGMT_IPS
][
20
];
...
...
src/util/inc/tstatus.h
浏览文件 @
37b55ef1
...
...
@@ -40,7 +40,7 @@ enum _TSDB_DB_STATUS {
TSDB_DB_STATUS_DROP_FROM_SDB
};
enum
_TSDB_VN_STATUS
{
typedef
enum
_TSDB_VN_STATUS
{
TSDB_VN_STATUS_OFFLINE
,
TSDB_VN_STATUS_CREATING
,
TSDB_VN_STATUS_UNSYNCED
,
...
...
@@ -48,7 +48,7 @@ enum _TSDB_VN_STATUS {
TSDB_VN_STATUS_MASTER
,
TSDB_VN_STATUS_CLOSING
,
TSDB_VN_STATUS_DELETING
,
};
}
EVnodeStatus
;
enum
_TSDB_VN_SYNC_STATUS
{
TSDB_VN_SYNC_STATUS_INIT
,
...
...
src/vnode/detail/inc/vnode.h
浏览文件 @
37b55ef1
...
...
@@ -302,9 +302,8 @@ typedef struct {
// internal globals
extern
int
tsMeterSizeOnFile
;
extern
void
**
rpcQhandle
;
extern
void
*
q
ueryQhandle
;
extern
void
*
tsQ
ueryQhandle
;
extern
int
tsVnodePeers
;
extern
int
tsMaxVnode
;
extern
int
tsMaxQueues
;
...
...
src/vnode/detail/src/vnodeRead.c
浏览文件 @
37b55ef1
...
...
@@ -696,7 +696,7 @@ void *vnodeQueryOnSingleTable(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
dTrace
(
"QInfo:%p set query flag and prepare runtime environment completed, ref:%d, wait for schedule"
,
pQInfo
,
pQInfo
->
refCount
);
taosScheduleTask
(
q
ueryQhandle
,
&
schedMsg
);
taosScheduleTask
(
tsQ
ueryQhandle
,
&
schedMsg
);
return
pQInfo
;
_error:
...
...
@@ -812,7 +812,7 @@ void *vnodeQueryOnMultiMeters(SMeterObj **pMetersObj, SSqlGroupbyExpr *pGroupbyE
dTrace
(
"QInfo:%p set query flag and prepare runtime environment completed, wait for schedule"
,
pQInfo
);
taosScheduleTask
(
q
ueryQhandle
,
&
schedMsg
);
taosScheduleTask
(
tsQ
ueryQhandle
,
&
schedMsg
);
return
pQInfo
;
_error:
...
...
@@ -912,7 +912,7 @@ int vnodeSaveQueryResult(void *handle, char *data, int32_t *size) {
schedMsg
.
msg
=
NULL
;
schedMsg
.
thandle
=
(
void
*
)
1
;
schedMsg
.
ahandle
=
pQInfo
;
taosScheduleTask
(
q
ueryQhandle
,
&
schedMsg
);
taosScheduleTask
(
tsQ
ueryQhandle
,
&
schedMsg
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录