Merge pull request #4734 from taosdata/feature/TD-2561
[TD-2561]<enhance>: new field clusterId for SConnectRsp
This commit is contained in:
commit
6d04a266b2
|
@ -25,6 +25,7 @@ int32_t dnodeInitCfg();
|
|||
void dnodeCleanupCfg();
|
||||
void dnodeUpdateCfg(SDnodeCfg *cfg);
|
||||
int32_t dnodeGetDnodeId();
|
||||
void dnodeGetClusterId(char *clusterId);
|
||||
void dnodeGetCfg(int32_t *dnodeId, char *clusterId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -51,6 +51,12 @@ int32_t dnodeGetDnodeId() {
|
|||
return dnodeId;
|
||||
}
|
||||
|
||||
void dnodeGetClusterId(char *clusterId) {
|
||||
pthread_mutex_lock(&tsCfgMutex);
|
||||
tstrncpy(clusterId, tsCfg.clusterId, TSDB_CLUSTER_ID_LEN);
|
||||
pthread_mutex_unlock(&tsCfgMutex);
|
||||
}
|
||||
|
||||
void dnodeGetCfg(int32_t *dnodeId, char *clusterId) {
|
||||
pthread_mutex_lock(&tsCfgMutex);
|
||||
*dnodeId = tsCfg.dnodeId;
|
||||
|
|
|
@ -36,6 +36,8 @@ bool dnodeIsMasterEp(char *ep);
|
|||
void dnodeGetEpSetForPeer(SRpcEpSet *epSet);
|
||||
void dnodeGetEpSetForShell(SRpcEpSet *epSet);
|
||||
int32_t dnodeGetDnodeId();
|
||||
void dnodeGetClusterId(char *clusterId);
|
||||
|
||||
void dnodeUpdateEp(int32_t dnodeId, char *ep, char *fqdn, uint16_t *port);
|
||||
bool dnodeCheckEpChanged(int32_t dnodeId, char *epstr);
|
||||
bool dnodeStartMnode(SMInfos *pMinfos);
|
||||
|
@ -80,4 +82,4 @@ void dnodeReportStep(char *name, char *desc, int8_t finished);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -324,6 +324,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
char acctId[TSDB_ACCT_LEN];
|
||||
char serverVersion[TSDB_VERSION_LEN];
|
||||
char clusterId[TSDB_CLUSTER_ID_LEN];
|
||||
int8_t writeAuth;
|
||||
int8_t superAuth;
|
||||
int8_t reserved1;
|
||||
|
|
|
@ -351,6 +351,8 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
|
|||
|
||||
mnodeGetMnodeEpSetForShell(&pConnectRsp->epSet, false);
|
||||
|
||||
dnodeGetClusterId(pConnectRsp->clusterId);
|
||||
|
||||
connect_over:
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
if (pConnectRsp) rpcFreeCont(pConnectRsp);
|
||||
|
|
Loading…
Reference in New Issue