enh: dnode online judgement

This commit is contained in:
kailixu 2024-03-28 16:59:00 +08:00
parent a3398f791e
commit 4e54dc09c5
2 changed files with 3 additions and 5 deletions

View File

@ -217,7 +217,6 @@ typedef struct {
EDndReason offlineReason; EDndReason offlineReason;
uint32_t encryptionKeyChksum; uint32_t encryptionKeyChksum;
int8_t encryptionKeyStat; int8_t encryptionKeyStat;
int8_t reboot;
uint16_t port; uint16_t port;
char fqdn[TSDB_FQDN_LEN]; char fqdn[TSDB_FQDN_LEN];
char ep[TSDB_EP_LEN]; char ep[TSDB_EP_LEN];

View File

@ -36,7 +36,7 @@
#define TSDB_DNODE_RESERVE_SIZE 40 #define TSDB_DNODE_RESERVE_SIZE 40
static const char *offlineReason[] = { static const char *offlineReason[] = {
"online", "",
"status msg timeout", "status msg timeout",
"status not received", "status not received",
"version not match", "version not match",
@ -374,8 +374,8 @@ int32_t mndGetDbSize(SMnode *pMnode) {
bool mndIsDnodeOnline(SDnodeObj *pDnode, int64_t curMs) { bool mndIsDnodeOnline(SDnodeObj *pDnode, int64_t curMs) {
int64_t interval = TABS(pDnode->lastAccessTime - curMs); int64_t interval = TABS(pDnode->lastAccessTime - curMs);
if (interval > 5000 * (int64_t)tsStatusInterval) { if (interval > 5000 * (int64_t)tsStatusInterval) {
if (pDnode->rebootTime > 0 && pDnode->offlineReason != DND_REASON_STATUS_MSG_TIMEOUT) { if (pDnode->rebootTime > 0 && pDnode->offlineReason == DND_REASON_ONLINE) {
if (!pDnode->reboot) pDnode->offlineReason = DND_REASON_STATUS_MSG_TIMEOUT; pDnode->offlineReason = DND_REASON_STATUS_MSG_TIMEOUT;
} }
return false; return false;
} }
@ -813,7 +813,6 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
if (reboot) { if (reboot) {
tsGrantHBInterval = GRANT_HEART_BEAT_MIN; tsGrantHBInterval = GRANT_HEART_BEAT_MIN;
} }
pDnode->reboot = reboot;
for (int32_t v = 0; v < taosArrayGetSize(statusReq.pVloads); ++v) { for (int32_t v = 0; v < taosArrayGetSize(statusReq.pVloads); ++v) {
SVnodeLoad *pVload = taosArrayGet(statusReq.pVloads, v); SVnodeLoad *pVload = taosArrayGet(statusReq.pVloads, v);