diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 88240f85edf8478e63168d0c2ad25fc5f98ee3ca..47460a5fab34289e5534fc753ff4b4bd86452d65 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -39,6 +39,7 @@ extern int8_t tsEnableTelemetryReporting; extern char tsEmail[]; extern char tsArbitrator[]; extern int8_t tsArbOnline; +extern int64_t tsArbOnlineTimestamp; extern int32_t tsDnodeId; // common diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index f8127b24b9c5d41a62242faf843d117b1a054a20..eae2fab32b892bdc9ede258467217df0d82eccea 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -42,6 +42,7 @@ int32_t tsNumOfMnodes = 3; int8_t tsEnableVnodeBak = 1; int8_t tsEnableTelemetryReporting = 1; int8_t tsArbOnline = 0; +int64_t tsArbOnlineTimestamp = TSDB_ARB_DUMMY_TIME; char tsEmail[TSDB_FQDN_LEN] = {0}; int32_t tsDnodeId = 0; diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 5bdd197aa9a76a72e5194f2c1591e52f47706dfb..e6eec73681dbde6c4c5b18f7b7c0351d40f7d134 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -375,6 +375,8 @@ do { \ #define TSDB_MAX_WAL_SIZE (1024*1024*3) +#define TSDB_ARB_DUMMY_TIME 4765104000000 // 2121-01-01 00:00:00.000, :P + typedef enum { TAOS_QTYPE_RPC = 0, TAOS_QTYPE_FWD = 1, diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 51f16e4bc63e8b12ac31c3e1ad9ac605b72c56ca..7702978af19f192ec9ec1ee4a7cda6df24db1f20 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -941,7 +941,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = 0; + *(int64_t *)pWrite = tsArbOnlineTimestamp; cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/src/sync/src/syncMain.c b/src/sync/src/syncMain.c index 493d5f117ac4d213da2703ed60825209f19f46b4..d34536543c32dd8129375cc93902648e9566239a 100644 --- a/src/sync/src/syncMain.c +++ b/src/sync/src/syncMain.c @@ -1150,7 +1150,12 @@ static void syncSetupPeerConnection(SSyncPeer *pPeer) { pPeer->peerFd = connFd; pPeer->role = TAOS_SYNC_ROLE_UNSYNCED; pPeer->pConn = syncAllocateTcpConn(tsTcpPool, pPeer->rid, connFd); - if (pPeer->isArb) tsArbOnline = 1; + if (pPeer->isArb) { + tsArbOnline = 1; + if (tsArbOnlineTimestamp == TSDB_ARB_DUMMY_TIME) { + tsArbOnlineTimestamp = taosGetTimestampMs(); + } + } } else { sDebug("%s, failed to setup peer connection to server since %s, try later", pPeer->id, strerror(errno)); taosCloseSocket(connFd);