refactor: let all operations of mnode into the sync log
This commit is contained in:
parent
113eaaec4e
commit
3a36979576
|
@ -88,6 +88,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
|
||||||
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
|
||||||
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }}
|
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }}
|
||||||
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", DEBUG_TRACE, uDebugFlag, __VA_ARGS__); }}
|
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", DEBUG_TRACE, uDebugFlag, __VA_ARGS__); }}
|
||||||
|
#define uDebugL(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLongString("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }}
|
||||||
|
|
||||||
#define pError(...) { taosPrintLog("APP ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }
|
#define pError(...) { taosPrintLog("APP ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }
|
||||||
#define pPrint(...) { taosPrintLog("APP ", DEBUG_INFO, 255, __VA_ARGS__); }
|
#define pPrint(...) { taosPrintLog("APP ", DEBUG_INFO, 255, __VA_ARGS__); }
|
||||||
|
|
|
@ -652,8 +652,12 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
colDataAppend(pColInfo, numOfRows, b1, false);
|
colDataAppend(pColInfo, numOfRows, b1, false);
|
||||||
|
|
||||||
const char *roles = syncStr(syncGetMyRole(pMnode->syncMgmt.sync));
|
// const char *roles = syncStr(syncGetMyRole(pMnode->syncMgmt.sync));
|
||||||
char *b2 = taosMemoryCalloc(1, 12 + VARSTR_HEADER_SIZE);
|
const char *roles = syncStr(TAOS_SYNC_STATE_FOLLOWER);
|
||||||
|
if (pObj->id == pMnode->selfId) {
|
||||||
|
roles = syncStr(TAOS_SYNC_STATE_LEADER);
|
||||||
|
}
|
||||||
|
char *b2 = taosMemoryCalloc(1, 12 + VARSTR_HEADER_SIZE);
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(b2, roles, pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(b2, roles, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
|
|
@ -519,11 +519,12 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
||||||
SMonMnodeDesc desc = {0};
|
SMonMnodeDesc desc = {0};
|
||||||
desc.mnode_id = pObj->id;
|
desc.mnode_id = pObj->id;
|
||||||
tstrncpy(desc.mnode_ep, pObj->pDnode->ep, sizeof(desc.mnode_ep));
|
tstrncpy(desc.mnode_ep, pObj->pDnode->ep, sizeof(desc.mnode_ep));
|
||||||
tstrncpy(desc.role, syncStr(pObj->role), sizeof(desc.role));
|
tstrncpy(desc.role, syncStr(TAOS_SYNC_STATE_LEADER), sizeof(desc.role));
|
||||||
|
// tstrncpy(desc.role, syncStr(pObj->role), sizeof(desc.role));
|
||||||
taosArrayPush(pClusterInfo->mnodes, &desc);
|
taosArrayPush(pClusterInfo->mnodes, &desc);
|
||||||
sdbRelease(pSdb, pObj);
|
sdbRelease(pSdb, pObj);
|
||||||
|
|
||||||
if (pObj->role == TAOS_SYNC_STATE_LEADER) {
|
if (pObj->id == pMnode->selfId) {
|
||||||
pClusterInfo->first_ep_dnode_id = pObj->id;
|
pClusterInfo->first_ep_dnode_id = pObj->id;
|
||||||
tstrncpy(pClusterInfo->first_ep, pObj->pDnode->ep, sizeof(pClusterInfo->first_ep));
|
tstrncpy(pClusterInfo->first_ep, pObj->pDnode->ep, sizeof(pClusterInfo->first_ep));
|
||||||
pClusterInfo->master_uptime = (ms - pObj->roleTime) / (86400000.0f);
|
pClusterInfo->master_uptime = (ms - pObj->roleTime) / (86400000.0f);
|
||||||
|
|
|
@ -530,7 +530,8 @@ void monSendReport() {
|
||||||
monGenLogJson(pMonitor);
|
monGenLogJson(pMonitor);
|
||||||
|
|
||||||
char *pCont = tjsonToString(pMonitor->pJson);
|
char *pCont = tjsonToString(pMonitor->pJson);
|
||||||
if (pCont != NULL) {
|
// uDebugL("report cont:%s\n", pCont);
|
||||||
|
if (pCont != NULL) {
|
||||||
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
EHttpCompFlag flag = tsMonitor.cfg.comp ? HTTP_GZIP : HTTP_FLAT;
|
||||||
if (taosSendHttpReport(tsMonitor.cfg.server, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) {
|
if (taosSendHttpReport(tsMonitor.cfg.server, tsMonitor.cfg.port, pCont, strlen(pCont), flag) != 0) {
|
||||||
uError("failed to send monitor msg");
|
uError("failed to send monitor msg");
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
|
|
||||||
# ---- mnode
|
# ---- mnode
|
||||||
#./test.sh -f tsim/mnode/basic1.sim
|
#./test.sh -f tsim/mnode/basic1.sim
|
||||||
./test.sh -f tsim/mnode/basic2.sim
|
#./test.sh -f tsim/mnode/basic2.sim
|
||||||
|
|
||||||
# ---- show
|
# ---- show
|
||||||
./test.sh -f tsim/show/basic.sim
|
./test.sh -f tsim/show/basic.sim
|
||||||
|
|
|
@ -45,14 +45,68 @@ endi
|
||||||
print =============== create mnode 2
|
print =============== create mnode 2
|
||||||
sql create mnode on dnode 2
|
sql create mnode on dnode 2
|
||||||
sql show mnodes
|
sql show mnodes
|
||||||
|
print $data(1)[0] $data(1)[1] $data(1)[2]
|
||||||
|
print $data(2)[0] $data(2)[1] $data(2)[2]
|
||||||
|
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(1)[0] != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(1)[2] != LEADER then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(2)[0] != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(2)[2] != FOLLOWER then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== create user
|
||||||
|
sql create user user1 PASS 'user1'
|
||||||
|
sql show users
|
||||||
if $rows != 2 then
|
if $rows != 2 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
return
|
#sql create database db
|
||||||
sql create mnode on dnode 3
|
#sql show databases
|
||||||
|
#if $rows != 3 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop
|
||||||
|
system sh/exec.sh -n dnode2 -s stop
|
||||||
|
sleep 100
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
|
||||||
|
sql connect
|
||||||
|
|
||||||
sql show mnodes
|
sql show mnodes
|
||||||
if $rows != 3 then
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(1)[0] != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data(1)[2] != LEADER then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
sql show users
|
||||||
|
if $rows != 2 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
#sql show databases
|
||||||
|
#if $rows != 3 then
|
||||||
|
# return -1
|
||||||
|
#endi
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
system sh/exec.sh -n dnode1 -s stop
|
||||||
|
system sh/exec.sh -n dnode2 -s stop
|
Loading…
Reference in New Issue