Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
a00be5e3
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看板
提交
a00be5e3
编写于
3月 06, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact code for cluster
上级
0d4618ce
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
51 addition
and
65 deletion
+51
-65
src/inc/sdb.h
src/inc/sdb.h
+0
-15
src/inc/taosmsg.h
src/inc/taosmsg.h
+0
-11
src/mnode/inc/mgmtBalance.h
src/mnode/inc/mgmtBalance.h
+0
-1
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+2
-0
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+2
-2
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+3
-0
src/mnode/src/mgmtDnodeInt.c
src/mnode/src/mgmtDnodeInt.c
+1
-1
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+0
-1
src/mnode/src/mgmtSystem.c
src/mnode/src/mgmtSystem.c
+0
-4
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+21
-0
src/sdb/inc/sdbint.h
src/sdb/inc/sdbint.h
+17
-24
src/sdb/src/sdbEngine.c
src/sdb/src/sdbEngine.c
+4
-5
src/sdb/src/sdbstr.c
src/sdb/src/sdbstr.c
+1
-1
未找到文件。
src/inc/sdb.h
浏览文件 @
a00be5e3
...
...
@@ -25,18 +25,10 @@ extern "C" {
extern
uint16_t
tsMgmtMgmtPort
;
extern
uint16_t
tsMgmtSyncPort
;
extern
int
sdbMaxNodes
;
extern
int
tsMgmtPeerHBTimer
;
// seconds
extern
char
sdbZone
[];
extern
char
sdbMasterIp
[];
extern
char
sdbPrivateIp
[];
extern
char
*
sdbStatusStr
[];
extern
char
*
sdbRoleStr
[];
extern
void
*
mnodeSdb
;
extern
int
sdbExtConns
;
extern
int
sdbMaster
;
extern
uint32_t
sdbPublicIp
;
extern
uint32_t
sdbMasterStartTime
;
extern
SRpcIpSet
*
pSdbIpList
;
extern
SRpcIpSet
*
pSdbPublicIpList
;
...
...
@@ -89,14 +81,9 @@ typedef struct {
// internal
int
syncFd
;
void
*
hbTimer
;
void
*
thandle
;
void
*
pSync
;
}
SSdbPeer
;
SSdbPeer
*
sdbAddPeer
(
uint32_t
ip
,
uint32_t
publicIp
,
char
role
);
void
sdbUpdateIpList
();
extern
SSdbPeer
*
sdbPeer
[];
#define sdbInited (sdbPeer[0])
#define sdbStatus (sdbPeer[0]->status)
...
...
@@ -130,8 +117,6 @@ int sdbInitPeers(char *directory);
void
sdbCleanUpPeers
();
int
sdbCfgNode
(
char
*
cont
);
int64_t
sdbGetVersion
();
int32_t
sdbGetRunStatus
();
...
...
src/inc/taosmsg.h
浏览文件 @
a00be5e3
...
...
@@ -600,17 +600,6 @@ typedef struct {
SVnodeAccess
vnodeAccess
[];
}
SStatusRsp
;
// internal message
typedef
struct
{
uint32_t
destId
;
uint32_t
destIp
;
char
tableId
[
TSDB_UNI_LEN
+
1
];
char
empty
[
3
];
uint8_t
msgType
;
int32_t
msgLen
;
uint8_t
content
[
0
];
}
SIntMsg
;
typedef
struct
{
char
spi
;
char
encrypt
;
...
...
src/mnode/inc/mgmtBalance.h
浏览文件 @
a00be5e3
...
...
@@ -22,7 +22,6 @@ extern "C" {
#include "mnode.h"
void
mgmtStartBalanceTimer
(
int64_t
mseconds
);
int32_t
mgmtInitBalance
();
void
mgmtCleanupBalance
();
int32_t
mgmtAllocVnodes
(
SVgObj
*
pVgroup
);
...
...
src/mnode/inc/mgmtDnode.h
浏览文件 @
a00be5e3
...
...
@@ -58,6 +58,8 @@ SDnodeObj* mgmtGetDnode(uint32_t ip);
extern
int32_t
(
*
mgmtCreateDnodeFp
)(
uint32_t
ip
);
extern
int32_t
(
*
mgmtDropDnodeByIpFp
)(
uint32_t
ip
);
void
mgmtCalcNumOfFreeVnodes
(
SDnodeObj
*
pDnode
);
#ifdef __cplusplus
}
#endif
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
a00be5e3
...
...
@@ -455,9 +455,9 @@ int32_t mgmtAlterDb(SAcctObj *pAcct, SAlterDbMsg *pAlter) {
//
// SVgObj *pVgroup = pDb->pHead;
// while (pVgroup != NULL) {
//
mgmt
UpdateVgroupState(pVgroup, TSDB_VG_LB_STATUS_UPDATE, 0);
//
balance
UpdateVgroupState(pVgroup, TSDB_VG_LB_STATUS_UPDATE, 0);
// if (oldReplicaNum < pDb->cfg.replications) {
// if (!
mgmt
AddVnode(pVgroup, NULL, NULL)) {
// if (!
balance
AddVnode(pVgroup, NULL, NULL)) {
// mWarn("db:%s vgroup:%d not enough dnode to add vnode", pAlter->db, pVgroup->vgId);
// code = TSDB_CODE_NO_ENOUGH_DNODES;
// }
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
a00be5e3
...
...
@@ -609,6 +609,9 @@ void *mgmtGetNextDnode(SShowObj *pShow, SDnodeObj **pDnode) {
int32_t
mgmtGetScoresMeta
(
STableMeta
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
)
{
if
(
mgmtGetScoresMetaFp
)
{
SUserObj
*
pUser
=
mgmtGetUserFromConn
(
pConn
);
if
(
pUser
==
NULL
)
return
0
;
if
(
strcmp
(
pUser
->
user
,
"root"
)
!=
0
)
return
TSDB_CODE_NO_RIGHTS
;
return
mgmtGetScoresMetaFp
(
pMeta
,
pShow
,
pConn
);
}
else
{
return
TSDB_CODE_OPS_NOT_SUPPORT
;
...
...
src/mnode/src/mgmtDnodeInt.c
浏览文件 @
a00be5e3
...
...
@@ -312,7 +312,7 @@ int32_t mgmtCfgDynamicOptions(SDnodeObj *pDnode, char *msg) {
mTrace
(
"dnode:%s, custom score set from:%d to:%d"
,
taosIpStr
(
pDnode
->
privateIp
),
pDnode
->
customScore
,
score
);
pDnode
->
customScore
=
score
;
mgmtUpdateDnode
(
pDnode
);
mgmtStartBalanceTimer
(
15
);
//
mgmtStartBalanceTimer(15);
}
return
TSDB_CODE_INVALID_SQL
;
}
else
if
(
strncasecmp
(
option
,
"bandwidth"
,
9
)
==
0
)
{
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
a00be5e3
...
...
@@ -51,7 +51,6 @@ static void (*mgmtProcessShellMsg[TSDB_MSG_TYPE_MAX])(void *pCont, int32_t contL
static
void
mgmtProcessUnSupportMsg
(
void
*
pCont
,
int32_t
contLen
,
void
*
ahandle
);
static
int
mgmtRetriveUserAuthInfo
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
uint32_t
mgmtAccessSquence
=
0
;
void
*
tsShellConnServer
=
NULL
;
void
mgmtProcessTranRequest
(
SSchedMsg
*
sched
)
{
...
...
src/mnode/src/mgmtSystem.c
浏览文件 @
a00be5e3
...
...
@@ -61,10 +61,6 @@ int32_t mgmtCheckMgmtRunning() {
tsetModuleStatus
(
TSDB_MOD_MGMT
);
// strcpy(sdbMasterIp, mgmtIpStr[0]);
// strcpy(sdbPrivateIp, tsPrivateIp);
// sdbPublicIp = inet_addr(tsPublicIp);
return
0
;
}
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
a00be5e3
...
...
@@ -318,6 +318,27 @@ int32_t mgmtGetVgroupMeta(STableMeta *pMeta, SShowObj *pShow, void *pConn) {
return
0
;
}
char
*
mgmtGetVnodeStatus
(
SVgObj
*
pVgroup
,
SVnodeGid
*
pVnode
)
{
SDnodeObj
*
pDnode
=
mgmtGetDnode
(
pVnode
->
ip
);
if
(
pDnode
==
NULL
)
{
mError
(
"dnode:%s, vgroup:%d, vnode:%d dnode not exist"
,
taosIpStr
(
pVnode
->
ip
),
pVgroup
->
vgId
,
pVnode
->
vnode
);
return
"null"
;
}
if
(
pDnode
->
status
==
TSDB_DN_STATUS_OFFLINE
)
{
return
"offline"
;
}
SVnodeLoad
*
vload
=
pDnode
->
vload
+
pVnode
->
vnode
;
if
(
vload
->
vgId
!=
pVgroup
->
vgId
||
vload
->
vnode
!=
pVnode
->
vnode
)
{
mError
(
"dnode:%s, vgroup:%d, vnode:%d not same with dnode vgroup:%d vnode:%d"
,
taosIpStr
(
pVnode
->
ip
),
pVgroup
->
vgId
,
pVnode
->
vnode
,
vload
->
vgId
,
vload
->
vnode
);
return
"null"
;
}
return
(
char
*
)
taosGetVnodeStatusStr
(
vload
->
status
);
}
int32_t
mgmtRetrieveVgroups
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
{
int32_t
numOfRows
=
0
;
SVgObj
*
pVgroup
=
NULL
;
...
...
src/sdb/inc/sdbint.h
浏览文件 @
a00be5e3
...
...
@@ -48,6 +48,21 @@
#define sdbPrint(...) \
{ tprintf("MND-SDB ", 255, __VA_ARGS__); }
#define mpeerError(...) \
if (sdbDebugFlag & DEBUG_ERROR) { \
tprintf("ERROR MND-MPEER ", 255, __VA_ARGS__); \
}
#define mpeerWarn(...) \
if (sdbDebugFlag & DEBUG_WARN) { \
tprintf("WARN MND-MPEER ", sdbDebugFlag, __VA_ARGS__); \
}
#define mpeerTrace(...) \
if (sdbDebugFlag & DEBUG_TRACE) { \
tprintf("MND-MPEER ", sdbDebugFlag, __VA_ARGS__); \
}
#define mpeerPrint(...) \
{ tprintf("MND-MPEER ", 255, __VA_ARGS__); }
#define sdbLError(...) taosLogError(__VA_ARGS__) sdbError(__VA_ARGS__)
#define sdbLWarn(...) taosLogWarn(__VA_ARGS__) sdbWarn(__VA_ARGS__)
#define sdbLPrint(...) taosLogPrint(__VA_ARGS__) sdbPrint(__VA_ARGS__)
...
...
@@ -69,11 +84,6 @@ typedef struct {
char
*
row
;
}
SSdbUpdate
;
typedef
struct
{
char
numOfTables
;
uint64_t
version
[];
}
SSdbSync
;
typedef
struct
{
SSdbHeader
header
;
int
maxRows
;
...
...
@@ -109,23 +119,6 @@ typedef struct {
char
data
[];
}
SRowHead
;
typedef
struct
{
char
*
buffer
;
char
*
offset
;
int
trans
;
int
bufferSize
;
pthread_mutex_t
qmutex
;
}
STranQueue
;
typedef
struct
{
char
status
;
char
role
;
char
numOfMnodes
;
uint64_t
dbVersion
;
uint32_t
numOfDnodes
;
uint32_t
publicIp
;
}
SMnodeStatus
;
typedef
struct
{
uint8_t
dbId
;
char
type
;
...
...
@@ -139,8 +132,8 @@ extern int sdbMaxPeers;
extern
int
sdbNumOfTables
;
extern
int64_t
sdbVersion
;
int
sdb
ForwardDbReqToPeer
(
SSdbTable
*
pTable
,
char
type
,
char
*
data
,
int
dataLen
);
int
sdb
RetrieveRows
(
int
fd
,
SSdbTable
*
pTable
,
uint64_t
version
);
int
mpeer
ForwardDbReqToPeer
(
SSdbTable
*
pTable
,
char
type
,
char
*
data
,
int
dataLen
);
int
mpeer
RetrieveRows
(
int
fd
,
SSdbTable
*
pTable
,
uint64_t
version
);
void
sdbResetTable
(
SSdbTable
*
pTable
);
extern
const
int16_t
sdbFileVersion
;
...
...
src/sdb/src/sdbEngine.c
浏览文件 @
a00be5e3
...
...
@@ -23,7 +23,6 @@
extern
char
version
[];
const
int16_t
sdbFileVersion
=
0
;
int
sdbExtConns
=
0
;
SRpcIpSet
*
pSdbIpList
=
NULL
;
SRpcIpSet
*
pSdbPublicIpList
=
NULL
;
SSdbPeer
*
sdbPeer
[
SDB_MAX_PEERS
];
// first slot for self
...
...
@@ -431,7 +430,7 @@ int64_t sdbInsertRow(void *handle, void *row, int rowSize) {
pthread_mutex_lock
(
&
pTable
->
mutex
);
if
(
sdb
ForwardDbReqToPeer
(
pTable
,
SDB_TYPE_INSERT
,
rowHead
->
data
,
rowHead
->
rowSize
)
==
0
)
{
if
(
mpeer
ForwardDbReqToPeer
(
pTable
,
SDB_TYPE_INSERT
,
rowHead
->
data
,
rowHead
->
rowSize
)
==
0
)
{
pTable
->
id
++
;
sdbVersion
++
;
if
(
pTable
->
keyType
==
SDB_KEYTYPE_AUTO
)
{
...
...
@@ -548,7 +547,7 @@ int sdbDeleteRow(void *handle, void *row) {
pthread_mutex_lock
(
&
pTable
->
mutex
);
if
(
sdb
ForwardDbReqToPeer
(
pTable
,
SDB_TYPE_DELETE
,
(
char
*
)
row
,
rowSize
)
==
0
)
{
if
(
mpeer
ForwardDbReqToPeer
(
pTable
,
SDB_TYPE_DELETE
,
(
char
*
)
row
,
rowSize
)
==
0
)
{
pTable
->
id
++
;
sdbVersion
++
;
...
...
@@ -666,7 +665,7 @@ int sdbUpdateRow(void *handle, void *row, int updateSize, char isUpdated) {
pthread_mutex_lock
(
&
pTable
->
mutex
);
if
(
sdb
ForwardDbReqToPeer
(
pTable
,
SDB_TYPE_UPDATE
,
rowHead
->
data
,
rowHead
->
rowSize
)
==
0
)
{
if
(
mpeer
ForwardDbReqToPeer
(
pTable
,
SDB_TYPE_UPDATE
,
rowHead
->
data
,
rowHead
->
rowSize
)
==
0
)
{
pTable
->
id
++
;
sdbVersion
++
;
...
...
@@ -745,7 +744,7 @@ int sdbBatchUpdateRow(void *handle, void *row, int rowSize) {
}
pthread_mutex_lock
(
&
pTable
->
mutex
);
if
(
sdb
ForwardDbReqToPeer
(
pTable
,
SDB_TYPE_BATCH_UPDATE
,
row
,
rowSize
)
==
0
)
{
if
(
mpeer
ForwardDbReqToPeer
(
pTable
,
SDB_TYPE_BATCH_UPDATE
,
row
,
rowSize
)
==
0
)
{
/* // write action */
/* write(pTable->fd, &action, sizeof(action)); */
/* pTable->size += sizeof(action); */
...
...
src/sdb/src/sdbstr.c
浏览文件 @
a00be5e3
...
...
@@ -24,7 +24,7 @@ char* sdbRoleStr[] = {"unauthed", "undecided", "master", "slave", "null"};
/*
* Lite Version sync request is always successful
*/
int
sdb
ForwardDbReqToPeer
(
SSdbTable
*
pTable
,
char
type
,
char
*
data
,
int
dataLen
)
{
int
mpeer
ForwardDbReqToPeer
(
SSdbTable
*
pTable
,
char
type
,
char
*
data
,
int
dataLen
)
{
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录