提交 8ac0fe09 编写于 作者: D dapan1121

add log for user to check; show "System not ready" for not connection

issue;
上级 5a7b938b
...@@ -53,6 +53,7 @@ extern char tsCharset[]; // default encode string ...@@ -53,6 +53,7 @@ extern char tsCharset[]; // default encode string
extern int32_t tsEnableCoreFile; extern int32_t tsEnableCoreFile;
extern int32_t tsCompressMsgSize; extern int32_t tsCompressMsgSize;
extern char tsTempDir[]; extern char tsTempDir[];
extern int32_t tsFirstBoot;
//query buffer management //query buffer management
extern int32_t tsQueryBufferSize; // maximum allowed usage buffer for each data node during query processing extern int32_t tsQueryBufferSize; // maximum allowed usage buffer for each data node during query processing
......
...@@ -60,6 +60,7 @@ char tsCharset[TSDB_LOCALE_LEN] = {0}; // default encode string ...@@ -60,6 +60,7 @@ char tsCharset[TSDB_LOCALE_LEN] = {0}; // default encode string
int32_t tsEnableCoreFile = 0; int32_t tsEnableCoreFile = 0;
int32_t tsMaxBinaryDisplayWidth = 30; int32_t tsMaxBinaryDisplayWidth = 30;
char tsTempDir[TSDB_FILENAME_LEN] = "/tmp/"; char tsTempDir[TSDB_FILENAME_LEN] = "/tmp/";
int32_t tsFirstBoot = 0;
/* /*
* denote if the server needs to compress response message at the application layer to client, including query rsp, * denote if the server needs to compress response message at the application layer to client, including query rsp,
...@@ -1368,11 +1369,16 @@ int32_t taosCheckGlobalCfg() { ...@@ -1368,11 +1369,16 @@ int32_t taosCheckGlobalCfg() {
if (tsFirst[0] == 0) { if (tsFirst[0] == 0) {
strcpy(tsFirst, tsLocalEp); strcpy(tsFirst, tsLocalEp);
taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
} else { } else {
taosGetFqdnPortFromEp(tsFirst, fqdn, &port); taosGetFqdnPortFromEp(tsFirst, fqdn, &port);
snprintf(tsFirst, sizeof(tsFirst), "%s:%u", fqdn, port); snprintf(tsFirst, sizeof(tsFirst), "%s:%u", fqdn, port);
} }
if(tscEmbedded && tsFirstBoot && strcmp(fqdn, tsLocalFqdn)){
userLog("Dnode %s is goning to join the cluster %s belongs, make sure this is what you want", tsLocalFqdn, fqdn);
}
if (tsSecond[0] == 0) { if (tsSecond[0] == 0) {
strcpy(tsSecond, tsLocalEp); strcpy(tsSecond, tsLocalEp);
} else { } else {
......
...@@ -91,6 +91,7 @@ static int32_t dnodeReadCfg() { ...@@ -91,6 +91,7 @@ static int32_t dnodeReadCfg() {
fp = fopen(file, "r"); fp = fopen(file, "r");
if (!fp) { if (!fp) {
dDebug("failed to read %s, file not exist", file); dDebug("failed to read %s, file not exist", file);
tsFirstBoot = 1;
goto PARSE_CFG_OVER; goto PARSE_CFG_OVER;
} }
......
...@@ -58,6 +58,7 @@ static uint32_t tsRebootTime; ...@@ -58,6 +58,7 @@ static uint32_t tsRebootTime;
static taos_qset tsMgmtQset = NULL; static taos_qset tsMgmtQset = NULL;
static taos_queue tsMgmtQueue = NULL; static taos_queue tsMgmtQueue = NULL;
static pthread_t tsQthread; static pthread_t tsQthread;
static uint32_t tsNumOfLostConn = 0;
static void dnodeProcessStatusRsp(SRpcMsg *pMsg); static void dnodeProcessStatusRsp(SRpcMsg *pMsg);
static void dnodeSendStatusMsg(void *handle, void *tmrId); static void dnodeSendStatusMsg(void *handle, void *tmrId);
...@@ -467,10 +468,31 @@ static int32_t dnodeProcessCreateMnodeMsg(SRpcMsg *pMsg) { ...@@ -467,10 +468,31 @@ static int32_t dnodeProcessCreateMnodeMsg(SRpcMsg *pMsg) {
static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
if (pMsg->code != TSDB_CODE_SUCCESS) { if (pMsg->code != TSDB_CODE_SUCCESS) {
dError("status rsp is received, error:%s", tstrerror(pMsg->code)); dError("status rsp is received, error:%s", tstrerror(pMsg->code));
if(pMsg->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
tsNumOfLostConn++;
if(tsNumOfLostConn && (tsNumOfLostConn % 10 == 0)) {
if(tsFirstBoot) {
userLog("Dnode has not joined the cluster yet, check the network/configuration and the other dnode status in cluster");
} else {
userLog("Dnode lost connection to the mnode, check the network and the other dnode status in cluster");
}
}
}
taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer);
return; return;
} }
if(tsNumOfLostConn) {
if(tsNumOfLostConn >= 10) {
if(tsFirstBoot) {
userLog("Done has joined the cluster now");
} else {
userLog("Dnode's connection to the mnode is ok now");
}
}
tsNumOfLostConn = 0;
}
SStatusRsp *pStatusRsp = pMsg->pCont; SStatusRsp *pStatusRsp = pMsg->pCont;
SMnodeInfos *minfos = &pStatusRsp->mnodes; SMnodeInfos *minfos = &pStatusRsp->mnodes;
dnodeUpdateMInfos(minfos); dnodeUpdateMInfos(minfos);
......
...@@ -160,6 +160,10 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char ...@@ -160,6 +160,10 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char
if (rpcRsp.code != 0) { if (rpcRsp.code != 0) {
dError("user:%s, auth msg received from mnodes, error:%s", user, tstrerror(rpcRsp.code)); dError("user:%s, auth msg received from mnodes, error:%s", user, tstrerror(rpcRsp.code));
if(rpcRsp.code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
dError("all mnodes unreachable, dnode not ready");
rpcRsp.code = TSDB_CODE_RPC_NOT_READY;
}
} else { } else {
SAuthRsp *pRsp = rpcRsp.pCont; SAuthRsp *pRsp = rpcRsp.pCont;
dDebug("user:%s, auth msg received from mnodes", user); dDebug("user:%s, auth msg received from mnodes", user);
......
...@@ -1372,7 +1372,9 @@ static void rpcProcessRetryTimer(void *param, void *tmrId) { ...@@ -1372,7 +1372,9 @@ static void rpcProcessRetryTimer(void *param, void *tmrId) {
// close the connection // close the connection
tDebug("%s, failed to send msg:%s to %s:%hu", pConn->info, taosMsg[pConn->outType], pConn->peerFqdn, pConn->peerPort); tDebug("%s, failed to send msg:%s to %s:%hu", pConn->info, taosMsg[pConn->outType], pConn->peerFqdn, pConn->peerPort);
if (pConn->pContext) { if (pConn->pContext) {
pConn->pContext->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; if(pConn->pContext->code == 0) {
pConn->pContext->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
}
pConn->pContext->pConn = NULL; pConn->pContext->pConn = NULL;
pConn->pReqMsg = NULL; pConn->pReqMsg = NULL;
taosTmrStart(rpcProcessConnError, 0, pConn->pContext, pRpc->tmrCtrl); taosTmrStart(rpcProcessConnError, 0, pConn->pContext, pRpc->tmrCtrl);
......
...@@ -49,6 +49,8 @@ void taosPrintLongString(const char * flags, int32_t dflag, const char *forma ...@@ -49,6 +49,8 @@ void taosPrintLongString(const char * flags, int32_t dflag, const char *forma
void taosDumpData(unsigned char *msg, int32_t len); void taosDumpData(unsigned char *msg, int32_t len);
#define userLog(...) { taosPrintLog("USR ", 255, __VA_ARGS__); }
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册