提交 a5d0e01a 编写于 作者: S slguan

fix error in sdb

上级 cc52d293
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "dnodeModule.h" #include "dnodeModule.h"
#include "dnodeMgmt.h" #include "dnodeMgmt.h"
#include "vnode.h" #include "vnode.h"
#include "mpeer.h"
#define MPEER_CONTENT_LEN 2000 #define MPEER_CONTENT_LEN 2000
...@@ -148,6 +149,15 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { ...@@ -148,6 +149,15 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
return; return;
} }
SDnodeState *pState = &pStatusRsp->dnodeState;
pState->numOfVnodes = htonl(pState->numOfVnodes);
pState->moduleStatus = htonl(pState->moduleStatus);
pState->createdTime = htonl(pState->createdTime);
pState->dnodeId = htonl(pState->dnodeId);
dnodeProcessModuleStatus(pState->moduleStatus);
dnodeUpdateDnodeInfo(pState->dnodeId);
SRpcIpSet mgmtIpSet = {0}; SRpcIpSet mgmtIpSet = {0};
mgmtIpSet.inUse = mpeers->inUse; mgmtIpSet.inUse = mpeers->inUse;
mgmtIpSet.numOfIps = mpeers->nodeNum; mgmtIpSet.numOfIps = mpeers->nodeNum;
...@@ -167,20 +177,13 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { ...@@ -167,20 +177,13 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
tsMnodeInfos.nodeInfos[i].nodePort = htons(mpeers->nodeInfos[i].nodePort); tsMnodeInfos.nodeInfos[i].nodePort = htons(mpeers->nodeInfos[i].nodePort);
strcpy(tsMnodeInfos.nodeInfos[i].nodeName, mpeers->nodeInfos[i].nodeName); strcpy(tsMnodeInfos.nodeInfos[i].nodeName, mpeers->nodeInfos[i].nodeName);
dPrint("mnode:%d, ip:%s:%u name:%s", tsMnodeInfos.nodeInfos[i].nodeId, dPrint("mnode:%d, ip:%s:%u name:%s", tsMnodeInfos.nodeInfos[i].nodeId,
taosIpStr(tsMnodeInfos.nodeInfos[i].nodeId), tsMnodeInfos.nodeInfos[i].nodePort, taosIpStr(tsMnodeInfos.nodeInfos[i].nodeIp), tsMnodeInfos.nodeInfos[i].nodePort,
tsMnodeInfos.nodeInfos[i].nodeName); tsMnodeInfos.nodeInfos[i].nodeName);
} }
dnodeSaveMnodeIpList(); dnodeSaveMnodeIpList();
mpeerUpdateSync();
} }
SDnodeState *pState = &pStatusRsp->dnodeState;
pState->numOfVnodes = htonl(pState->numOfVnodes);
pState->moduleStatus = htonl(pState->moduleStatus);
pState->createdTime = htonl(pState->createdTime);
pState->dnodeId = htonl(pState->dnodeId);
dnodeProcessModuleStatus(pState->moduleStatus);
dnodeUpdateDnodeInfo(pState->dnodeId);
taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer);
} }
......
...@@ -159,10 +159,10 @@ static int32_t dnodeInitSystem() { ...@@ -159,10 +159,10 @@ static int32_t dnodeInitSystem() {
dPrint("starting to initialize TDengine ..."); dPrint("starting to initialize TDengine ...");
if (dnodeInitStorage() != 0) return -1; if (dnodeInitStorage() != 0) return -1;
if (dnodeInitModules() != 0) return -1;
if (dnodeInitRead() != 0) return -1; if (dnodeInitRead() != 0) return -1;
if (dnodeInitWrite() != 0) return -1; if (dnodeInitWrite() != 0) return -1;
if (dnodeInitMClient() != 0) return -1; if (dnodeInitMClient() != 0) return -1;
if (dnodeInitModules() != 0) return -1;
if (dnodeInitMnode() != 0) return -1; if (dnodeInitMnode() != 0) return -1;
if (dnodeInitMgmt() != 0) return -1; if (dnodeInitMgmt() != 0) return -1;
if (dnodeInitShell() != 0) return -1; if (dnodeInitShell() != 0) return -1;
......
...@@ -50,6 +50,7 @@ void mpeerGetPublicIpList(SRpcIpSet *ipSet); ...@@ -50,6 +50,7 @@ void mpeerGetPublicIpList(SRpcIpSet *ipSet);
void mpeerGetMpeerInfos(void *mpeers); void mpeerGetMpeerInfos(void *mpeers);
int32_t mpeerForwardReqToPeer(void *pHead); int32_t mpeerForwardReqToPeer(void *pHead);
void mpeerUpdateSync();
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -77,6 +77,7 @@ void * clusterGetDnode(int32_t dnodeId) { return dnodeId == 1 ? &tsDnodeObj : N ...@@ -77,6 +77,7 @@ void * clusterGetDnode(int32_t dnodeId) { return dnodeId == 1 ? &tsDnodeObj : N
void * clusterGetDnodeByIp(uint32_t ip) { return &tsDnodeObj; } void * clusterGetDnodeByIp(uint32_t ip) { return &tsDnodeObj; }
void clusterReleaseDnode(struct _dnode_obj *pDnode) {} void clusterReleaseDnode(struct _dnode_obj *pDnode) {}
void clusterUpdateDnode(struct _dnode_obj *pDnode) {} void clusterUpdateDnode(struct _dnode_obj *pDnode) {}
void clusterMonitorDnodeModule() {}
#endif #endif
......
...@@ -48,6 +48,7 @@ void * mpeerGetMnode(int32_t mnodeId) { return &tsMnodeObj; } ...@@ -48,6 +48,7 @@ void * mpeerGetMnode(int32_t mnodeId) { return &tsMnodeObj; }
int32_t mpeerGetMnodesNum() { return 1; } int32_t mpeerGetMnodesNum() { return 1; }
void mpeerReleaseMnode(struct _mnode_obj *pMnode) {} void mpeerReleaseMnode(struct _mnode_obj *pMnode) {}
bool mpeerIsMaster() { return tsMnodeObj.role == TAOS_SYNC_ROLE_MASTER; } bool mpeerIsMaster() { return tsMnodeObj.role == TAOS_SYNC_ROLE_MASTER; }
void mpeerUpdateSync() {}
void *mpeerGetNextMnode(void *pNode, SMnodeObj **pMnode) { void *mpeerGetNextMnode(void *pNode, SMnodeObj **pMnode) {
if (*pMnode == NULL) { if (*pMnode == NULL) {
......
...@@ -130,6 +130,9 @@ int32_t sdbInit() { ...@@ -130,6 +130,9 @@ int32_t sdbInit() {
} }
sdbTrace("sdb is initialized, version:%d totalRows:%d numOfTables:%d", tsSdbObj->version, totalRows, numOfTables); sdbTrace("sdb is initialized, version:%d totalRows:%d numOfTables:%d", tsSdbObj->version, totalRows, numOfTables);
mpeerUpdateSync();
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -215,6 +218,11 @@ static int32_t sdbInsertLocal(SSdbTable *pTable, SSdbOperDesc *pOper) { ...@@ -215,6 +218,11 @@ static int32_t sdbInsertLocal(SSdbTable *pTable, SSdbOperDesc *pOper) {
(*sdbAddIndexFp[pTable->keyType])(pTable->iHandle, pOper->pObj, &rowMeta); (*sdbAddIndexFp[pTable->keyType])(pTable->iHandle, pOper->pObj, &rowMeta);
sdbIncRef(pTable, pOper->pObj); sdbIncRef(pTable, pOper->pObj);
pTable->numOfRows++; pTable->numOfRows++;
if (pTable->keyType == SDB_KEY_AUTO) {
pTable->autoIndex = MAX(pTable->autoIndex, *((uint32_t *)pOper->pObj));
}
pthread_mutex_unlock(&pTable->mutex); pthread_mutex_unlock(&pTable->mutex);
sdbTrace("table:%s, insert record:%s, numOfRows:%d", pTable->tableName, sdbGetkeyStr(pTable, pOper->pObj), sdbTrace("table:%s, insert record:%s, numOfRows:%d", pTable->tableName, sdbGetkeyStr(pTable, pOper->pObj),
......
...@@ -85,11 +85,13 @@ static int32_t mgmtUserActionDecode(SSdbOperDesc *pOper) { ...@@ -85,11 +85,13 @@ static int32_t mgmtUserActionDecode(SSdbOperDesc *pOper) {
} }
static int32_t mgmtUserActionRestored() { static int32_t mgmtUserActionRestored() {
SAcctObj *pAcct = acctGetAcct("root"); if (strcmp(tsMasterIp, tsPrivateIp) == 0) {
mgmtCreateUser(pAcct, "root", "taosdata"); SAcctObj *pAcct = acctGetAcct("root");
mgmtCreateUser(pAcct, "monitor", tsInternalPass); mgmtCreateUser(pAcct, "root", "taosdata");
mgmtCreateUser(pAcct, "_root", tsInternalPass); mgmtCreateUser(pAcct, "monitor", tsInternalPass);
acctReleaseAcct(pAcct); mgmtCreateUser(pAcct, "_root", tsInternalPass);
acctReleaseAcct(pAcct);
}
return 0; return 0;
} }
......
...@@ -129,7 +129,7 @@ void httpCleanUpSystem() { ...@@ -129,7 +129,7 @@ void httpCleanUpSystem() {
httpPrint("http service cleanup"); httpPrint("http service cleanup");
httpStopSystem(); httpStopSystem();
#if 1 #if 0
if (httpServer == NULL) { if (httpServer == NULL) {
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册