TD-2506
This commit is contained in:
parent
7726ede559
commit
e8ce28f03f
|
@ -65,7 +65,7 @@ void dnodeDispatchToVReadQueue(SRpcMsg *pMsg) {
|
||||||
assert(pHead->contLen > 0);
|
assert(pHead->contLen > 0);
|
||||||
void *pVnode = vnodeAcquire(pHead->vgId);
|
void *pVnode = vnodeAcquire(pHead->vgId);
|
||||||
if (pVnode != NULL) {
|
if (pVnode != NULL) {
|
||||||
int32_t code = vnodeWriteToRQueue(pVnode, pCont, pHead->contLen, TAOS_QTYPE_RPC, pMsg);
|
code = vnodeWriteToRQueue(pVnode, pCont, pHead->contLen, TAOS_QTYPE_RPC, pMsg);
|
||||||
if (code == TSDB_CODE_SUCCESS) queuedMsgNum++;
|
if (code == TSDB_CODE_SUCCESS) queuedMsgNum++;
|
||||||
vnodeRelease(pVnode);
|
vnodeRelease(pVnode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -656,7 +656,7 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
|
||||||
|
|
||||||
pShow->bytes[cols] = 4;
|
pShow->bytes[cols] = 4;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
pSchema[cols].type = TSDB_DATA_TYPE_INT;
|
||||||
strcpy(pSchema[cols].name, "onlineVnodes");
|
strcpy(pSchema[cols].name, "onlines");
|
||||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
|
@ -671,13 +671,13 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
|
||||||
for (int32_t i = 0; i < pShow->maxReplica; ++i) {
|
for (int32_t i = 0; i < pShow->maxReplica; ++i) {
|
||||||
pShow->bytes[cols] = 2;
|
pShow->bytes[cols] = 2;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
pSchema[cols].type = TSDB_DATA_TYPE_SMALLINT;
|
||||||
snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%dDnode", i + 1);
|
snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%d_dnode", i + 1);
|
||||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
|
|
||||||
pShow->bytes[cols] = 9 + VARSTR_HEADER_SIZE;
|
pShow->bytes[cols] = 9 + VARSTR_HEADER_SIZE;
|
||||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||||
snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%dStatus", i + 1);
|
snprintf(pSchema[cols].name, TSDB_COL_NAME_LEN, "v%d_status", i + 1);
|
||||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||||
cols++;
|
cols++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -560,6 +560,9 @@ static void syncChooseMaster(SSyncNode *pNode) {
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sDebug("vgId:%d, master:%s may be choosed, index:%d", pNode->vgId, pNode->peerInfo[index]->id, index);
|
||||||
|
} else {
|
||||||
|
sDebug("vgId:%d, no master election since onlineNum:%d replica:%d", pNode->vgId, onlineNum, pNode->replica);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add arbitrator connection
|
// add arbitrator connection
|
||||||
|
@ -580,6 +583,11 @@ static void syncChooseMaster(SSyncNode *pNode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index >= 0) {
|
||||||
|
sDebug("vgId:%d, master:%s may be choosed, index:%d onlineNum(arb):%d replica:%d", pNode->vgId,
|
||||||
|
pNode->peerInfo[index]->id, index, onlineNum, replica);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
@ -678,7 +686,7 @@ static void syncCheckRole(SSyncPeer *pPeer, SPeerStatus* peersStatus, int8_t new
|
||||||
if (pMaster) {
|
if (pMaster) {
|
||||||
// master is there
|
// master is there
|
||||||
pNode->pMaster = pMaster;
|
pNode->pMaster = pMaster;
|
||||||
sDebug("%s, it is the master, sver:%" PRIu64, pMaster->id, pMaster->version);
|
sDebug("%s, it is the master, replica:^%d sver:%" PRIu64, pMaster->id, pNode->replica, pMaster->version);
|
||||||
|
|
||||||
if (syncValidateMaster(pPeer) < 0) return;
|
if (syncValidateMaster(pPeer) < 0) return;
|
||||||
|
|
||||||
|
@ -711,10 +719,10 @@ static void syncCheckRole(SSyncPeer *pPeer, SPeerStatus* peersStatus, int8_t new
|
||||||
}
|
}
|
||||||
|
|
||||||
if (consistent) {
|
if (consistent) {
|
||||||
sDebug("vgId:%d, choose master", pNode->vgId);
|
sDebug("vgId:%d, choose master, replica:%d", pNode->vgId, pNode->replica);
|
||||||
syncChooseMaster(pNode);
|
syncChooseMaster(pNode);
|
||||||
} else {
|
} else {
|
||||||
sDebug("vgId:%d, cannot choose master since roles inequality", pNode->vgId);
|
sDebug("vgId:%d, cannot choose master since roles inequality, replica:%d", pNode->vgId, pNode->replica);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,10 @@ int32_t taosWriteMsg(SOCKET fd, void *buf, int32_t nbytes) {
|
||||||
nleft -= nwritten;
|
nleft -= nwritten;
|
||||||
ptr += nwritten;
|
ptr += nwritten;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errno == SIGPIPE || errno == EPIPE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (nbytes - nleft);
|
return (nbytes - nleft);
|
||||||
|
@ -142,6 +146,10 @@ int32_t taosReadMsg(SOCKET fd, void *buf, int32_t nbytes) {
|
||||||
nleft -= nread;
|
nleft -= nread;
|
||||||
ptr += nread;
|
ptr += nread;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errno == SIGPIPE || errno == EPIPE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (nbytes - nleft);
|
return (nbytes - nleft);
|
||||||
|
|
Loading…
Reference in New Issue