[TBASE-1128]
This commit is contained in:
parent
026d0b499b
commit
ada94e72d2
|
@ -583,7 +583,7 @@ typedef struct {
|
||||||
int64_t compStorage;
|
int64_t compStorage;
|
||||||
int64_t pointsWritten;
|
int64_t pointsWritten;
|
||||||
uint8_t syncStatus;
|
uint8_t syncStatus;
|
||||||
uint8_t reserved;
|
uint8_t reserved[15];
|
||||||
} SVnodeLoad;
|
} SVnodeLoad;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -24,7 +24,12 @@
|
||||||
extern char version[];
|
extern char version[];
|
||||||
const int16_t sdbFileVersion = 0;
|
const int16_t sdbFileVersion = 0;
|
||||||
int sdbExtConns = 0;
|
int sdbExtConns = 0;
|
||||||
|
|
||||||
|
#ifdef CLUSTER
|
||||||
|
int sdbMaster = 0;
|
||||||
|
#else
|
||||||
int sdbMaster = 1;
|
int sdbMaster = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
void *(*sdbInitIndexFp[])(int maxRows, int dataSize) = {sdbOpenStrHash, sdbOpenIntHash, sdbOpenIntHash};
|
void *(*sdbInitIndexFp[])(int maxRows, int dataSize) = {sdbOpenStrHash, sdbOpenIntHash, sdbOpenIntHash};
|
||||||
|
|
||||||
|
@ -126,7 +131,7 @@ int sdbOpenSdbFile(SSdbTable *pTable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pTable->header.swVersion != swVersion.iversion) {
|
if (pTable->header.swVersion != swVersion.iversion) {
|
||||||
sdbWarn("sdb file %s version not match software version", pTable->fn);
|
sdbWarn("sdb file:%s version not match software version", pTable->fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!taosCheckChecksumWhole((uint8_t *)(&pTable->header), size)) {
|
if (!taosCheckChecksumWhole((uint8_t *)(&pTable->header), size)) {
|
||||||
|
@ -177,6 +182,8 @@ int sdbInitTableByFile(SSdbTable *pTable) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sdbTrace("open sdb file:%s for read", pTable->fn);
|
||||||
|
|
||||||
// Loop to read sdb file row by row
|
// Loop to read sdb file row by row
|
||||||
while (1) {
|
while (1) {
|
||||||
memset(rowHead, 0, total_size);
|
memset(rowHead, 0, total_size);
|
||||||
|
@ -196,8 +203,8 @@ int sdbInitTableByFile(SSdbTable *pTable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rowHead->rowSize < 0 || rowHead->rowSize > pTable->maxRowSize) {
|
if (rowHead->rowSize < 0 || rowHead->rowSize > pTable->maxRowSize) {
|
||||||
sdbError("error row size in sdb file: %s rowSize: %d maxRowSize: %d", pTable->fn, rowHead->rowSize,
|
sdbError("error row size in sdb file:%s, id:%d rowSize:%d maxRowSize:%d",
|
||||||
pTable->maxRowSize);
|
pTable->fn, rowHead->id, rowHead->rowSize, pTable->maxRowSize);
|
||||||
pTable->size += sizeof(SRowHead);
|
pTable->size += sizeof(SRowHead);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -748,6 +755,8 @@ void sdbResetTable(SSdbTable *pTable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sdbTrace("open sdb file:%s for update", pTable->fn);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
memset(rowHead, 0, total_size);
|
memset(rowHead, 0, total_size);
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,11 @@ int mgmtProcessMeterCfgMsg(char *cont, int contLen, SDnodeObj *pObj) {
|
||||||
SMeterCfgMsg *pCfg = (SMeterCfgMsg *)cont;
|
SMeterCfgMsg *pCfg = (SMeterCfgMsg *)cont;
|
||||||
SVgObj * pVgroup;
|
SVgObj * pVgroup;
|
||||||
|
|
||||||
|
if (!sdbMaster) {
|
||||||
|
taosSendSimpleRspToDnode(pObj, TSDB_MSG_TYPE_METER_CFG_RSP, TSDB_CODE_REDIRECT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int vnode = htonl(pCfg->vnode);
|
int vnode = htonl(pCfg->vnode);
|
||||||
int sid = htonl(pCfg->sid);
|
int sid = htonl(pCfg->sid);
|
||||||
|
|
||||||
|
@ -51,6 +56,7 @@ int mgmtProcessMeterCfgMsg(char *cont, int contLen, SDnodeObj *pObj) {
|
||||||
taosSendSimpleRspToDnode(pObj, TSDB_MSG_TYPE_METER_CFG_RSP, TSDB_CODE_SERV_OUT_OF_MEMORY);
|
taosSendSimpleRspToDnode(pObj, TSDB_MSG_TYPE_METER_CFG_RSP, TSDB_CODE_SERV_OUT_OF_MEMORY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pMsg = pStart;
|
pMsg = pStart;
|
||||||
|
|
||||||
if (vnode < pObj->numOfVnodes) {
|
if (vnode < pObj->numOfVnodes) {
|
||||||
|
@ -87,10 +93,18 @@ int mgmtProcessVpeerCfgMsg(char *cont, int contLen, SDnodeObj *pObj) {
|
||||||
SVpeerCfgMsg *pCfg = (SVpeerCfgMsg *)cont;
|
SVpeerCfgMsg *pCfg = (SVpeerCfgMsg *)cont;
|
||||||
SVgObj * pVgroup = NULL;
|
SVgObj * pVgroup = NULL;
|
||||||
|
|
||||||
|
if (!sdbMaster) {
|
||||||
|
taosSendSimpleRspToDnode(pObj, TSDB_MSG_TYPE_VPEER_CFG_RSP, TSDB_CODE_REDIRECT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int vnode = htonl(pCfg->vnode);
|
int vnode = htonl(pCfg->vnode);
|
||||||
|
|
||||||
pStart = taosBuildRspMsgToDnode(pObj, TSDB_MSG_TYPE_VPEER_CFG_RSP);
|
pStart = taosBuildRspMsgToDnode(pObj, TSDB_MSG_TYPE_VPEER_CFG_RSP);
|
||||||
if (pStart == NULL) return 0;
|
if (pStart == NULL) {
|
||||||
|
taosSendSimpleRspToDnode(pObj, TSDB_MSG_TYPE_VPEER_CFG_RSP, TSDB_CODE_SERV_OUT_OF_MEMORY);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
pMsg = pStart;
|
pMsg = pStart;
|
||||||
|
|
||||||
if (vnode < pObj->numOfVnodes) pVgroup = mgmtGetVgroup(pObj->vload[vnode].vgId);
|
if (vnode < pObj->numOfVnodes) pVgroup = mgmtGetVgroup(pObj->vload[vnode].vgId);
|
||||||
|
@ -121,6 +135,11 @@ int mgmtProcessFreeVnodeRsp(char *msg, int msgLen, SDnodeObj *pObj) { return 0;
|
||||||
int mgmtProcessVPeersRsp(char *msg, int msgLen, SDnodeObj *pObj) {
|
int mgmtProcessVPeersRsp(char *msg, int msgLen, SDnodeObj *pObj) {
|
||||||
STaosRsp *pRsp = (STaosRsp *)msg;
|
STaosRsp *pRsp = (STaosRsp *)msg;
|
||||||
|
|
||||||
|
if (!sdbMaster) {
|
||||||
|
taosSendSimpleRspToDnode(pObj, TSDB_MSG_TYPE_VPEERS_RSP, TSDB_CODE_REDIRECT);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
SDbObj *pDb = mgmtGetDb(pRsp->more);
|
SDbObj *pDb = mgmtGetDb(pRsp->more);
|
||||||
if (!pDb) {
|
if (!pDb) {
|
||||||
mError("dnode:%s, db not find, code:%d", taosIpStr(pObj->privateIp), pRsp->code);
|
mError("dnode:%s, db not find, code:%d", taosIpStr(pObj->privateIp), pRsp->code);
|
||||||
|
|
Loading…
Reference in New Issue