提交 98a1ff7c 编写于 作者: S Shengliang Guan

revert codes

上级 3909b3c6
...@@ -90,12 +90,12 @@ typedef struct STableComInfo { ...@@ -90,12 +90,12 @@ typedef struct STableComInfo {
int32_t rowSize; int32_t rowSize;
} STableComInfo; } STableComInfo;
typedef struct SCMCorVgroupInfo { typedef struct SCorVgroupInfo {
int32_t version; int32_t version;
int8_t inUse; int8_t inUse;
int8_t numOfEps; int8_t numOfEps;
SEpAddr1 epAddr[TSDB_MAX_REPLICA]; SEpAddr1 epAddr[TSDB_MAX_REPLICA];
} SCMCorVgroupInfo; } SCorVgroupInfo;
typedef struct STableMeta { typedef struct STableMeta {
STableComInfo tableInfo; STableComInfo tableInfo;
...@@ -104,7 +104,7 @@ typedef struct STableMeta { ...@@ -104,7 +104,7 @@ typedef struct STableMeta {
int16_t tversion; int16_t tversion;
char sTableId[TSDB_TABLE_FNAME_LEN]; char sTableId[TSDB_TABLE_FNAME_LEN];
SVgroupInfo vgroupInfo; SVgroupInfo vgroupInfo;
SCMCorVgroupInfo corVgroupInfo; SCorVgroupInfo corVgroupInfo;
STableId id; STableId id;
SSchema schema[]; // if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info SSchema schema[]; // if the table is TSDB_CHILD_TABLE, schema is acquired by super table meta info
} STableMeta; } STableMeta;
......
...@@ -140,7 +140,7 @@ struct SSchema tscGetTbnameColumnSchema() { ...@@ -140,7 +140,7 @@ struct SSchema tscGetTbnameColumnSchema() {
strcpy(s.name, TSQL_TBNAME_L); strcpy(s.name, TSQL_TBNAME_L);
return s; return s;
} }
static void tscInitCorVgroupInfo(SCMCorVgroupInfo *corVgroupInfo, SVgroupInfo *vgroupInfo) { static void tscInitCorVgroupInfo(SCorVgroupInfo *corVgroupInfo, SVgroupInfo *vgroupInfo) {
corVgroupInfo->version = 0; corVgroupInfo->version = 0;
corVgroupInfo->inUse = 0; corVgroupInfo->inUse = 0;
corVgroupInfo->numOfEps = vgroupInfo->numOfEps; corVgroupInfo->numOfEps = vgroupInfo->numOfEps;
......
...@@ -100,7 +100,7 @@ void tscUpdateMgmtEpSet(SRpcEpSet *pEpSet) { ...@@ -100,7 +100,7 @@ void tscUpdateMgmtEpSet(SRpcEpSet *pEpSet) {
tscMgmtEpSet.epSet = *pEpSet; tscMgmtEpSet.epSet = *pEpSet;
taosCorEndWrite(&tscMgmtEpSet.version); taosCorEndWrite(&tscMgmtEpSet.version);
} }
static void tscDumpEpSetFromVgroupInfo(SCMCorVgroupInfo *pVgroupInfo, SRpcEpSet *pEpSet) { static void tscDumpEpSetFromVgroupInfo(SCorVgroupInfo *pVgroupInfo, SRpcEpSet *pEpSet) {
if (pVgroupInfo == NULL) { return;} if (pVgroupInfo == NULL) { return;}
taosCorBeginRead(&pVgroupInfo->version); taosCorBeginRead(&pVgroupInfo->version);
int8_t inUse = pVgroupInfo->inUse; int8_t inUse = pVgroupInfo->inUse;
...@@ -117,7 +117,7 @@ static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcEpSet *pEpSet) { ...@@ -117,7 +117,7 @@ static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcEpSet *pEpSet) {
SSqlCmd *pCmd = &pObj->cmd; SSqlCmd *pCmd = &pObj->cmd;
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
if (pTableMetaInfo == NULL || pTableMetaInfo->pTableMeta == NULL) { return;} if (pTableMetaInfo == NULL || pTableMetaInfo->pTableMeta == NULL) { return;}
SCMCorVgroupInfo *pVgroupInfo = &pTableMetaInfo->pTableMeta->corVgroupInfo; SCorVgroupInfo *pVgroupInfo = &pTableMetaInfo->pTableMeta->corVgroupInfo;
taosCorBeginWrite(&pVgroupInfo->version); taosCorBeginWrite(&pVgroupInfo->version);
tscDebug("before: Endpoint in use: %d", pVgroupInfo->inUse); tscDebug("before: Endpoint in use: %d", pVgroupInfo->inUse);
......
...@@ -103,7 +103,7 @@ void taos_init_imp(void) { ...@@ -103,7 +103,7 @@ void taos_init_imp(void) {
} }
taosReadGlobalCfg(); taosReadGlobalCfg();
taosCheckGlobalCfg(); // taosCheckGlobalCfg();
tscDebug("starting to initialize TAOS client ..."); tscDebug("starting to initialize TAOS client ...");
tscDebug("Local End Point is:%s", tsLocalEp); tscDebug("Local End Point is:%s", tsLocalEp);
......
...@@ -184,7 +184,7 @@ extern int32_t debugFlag; ...@@ -184,7 +184,7 @@ extern int32_t debugFlag;
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize) #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
void taosInitGlobalCfg(); void taosInitGlobalCfg();
int32_t taosCheckGlobalCfg(); bool taosCheckGlobalCfg();
void taosSetAllDebugFlag(); void taosSetAllDebugFlag();
bool taosCfgDynamicOptions(char *msg); bool taosCfgDynamicOptions(char *msg);
int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port); int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port);
......
...@@ -1316,7 +1316,7 @@ void taosInitGlobalCfg() { ...@@ -1316,7 +1316,7 @@ void taosInitGlobalCfg() {
pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig); pthread_once(&tsInitGlobalCfgOnce, doInitGlobalConfig);
} }
int32_t taosCheckGlobalCfg() { bool taosCheckGlobalCfg() {
char fqdn[TSDB_FQDN_LEN]; char fqdn[TSDB_FQDN_LEN];
uint16_t port; uint16_t port;
...@@ -1375,9 +1375,9 @@ int32_t taosCheckGlobalCfg() { ...@@ -1375,9 +1375,9 @@ int32_t taosCheckGlobalCfg() {
tsSyncPort = tsServerPort + TSDB_PORT_SYNC; tsSyncPort = tsServerPort + TSDB_PORT_SYNC;
tsHttpPort = tsServerPort + TSDB_PORT_HTTP; tsHttpPort = tsServerPort + TSDB_PORT_HTTP;
taosPrintGlobalCfg(); // taosPrintGlobalCfg();
return 0; return true;
} }
int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) { int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
......
...@@ -87,7 +87,7 @@ bool dnodeCheckEpChanged(int32_t dnodeId, char *epstr) { ...@@ -87,7 +87,7 @@ bool dnodeCheckEpChanged(int32_t dnodeId, char *epstr) {
char epSaved[TSDB_EP_LEN + 1]; char epSaved[TSDB_EP_LEN + 1];
snprintf(epSaved, TSDB_EP_LEN, "%s:%u", ep->dnodeFqdn, ep->dnodePort); snprintf(epSaved, TSDB_EP_LEN, "%s:%u", ep->dnodeFqdn, ep->dnodePort);
changed = strcmp(epstr, epSaved) != 0; changed = strcmp(epstr, epSaved) != 0;
tstrncpy(epstr, epSaved, TSDB_EP_LEN); // tstrncpy(epstr, epSaved, TSDB_EP_LEN);
} }
pthread_mutex_unlock(&tsEpsMutex); pthread_mutex_unlock(&tsEpsMutex);
return changed; return changed;
...@@ -236,7 +236,7 @@ PRASE_EPS_OVER: ...@@ -236,7 +236,7 @@ PRASE_EPS_OVER:
dnodeResetEps(eps); dnodeResetEps(eps);
if (eps) free(eps); if (eps) free(eps);
dnodeUpdateEp(dnodeGetDnodeId(), tsLocalEp, tsLocalFqdn, &tsServerPort); // dnodeUpdateEp(dnodeGetDnodeId(), tsLocalEp, tsLocalFqdn, &tsServerPort);
terrno = 0; terrno = 0;
return 0; return 0;
......
...@@ -124,10 +124,10 @@ void dnodeGetEpSetForShell(SRpcEpSet *epSet) { ...@@ -124,10 +124,10 @@ void dnodeGetEpSetForShell(SRpcEpSet *epSet) {
} }
static void dnodePrintMInfos(SMnodeInfos *minfos) { static void dnodePrintMInfos(SMnodeInfos *minfos) {
dInfo("print mnode infos, mnodeNum:%d inUse:%d", minfos->mnodeNum, minfos->inUse); // dInfo("print mnode infos, mnodeNum:%d inUse:%d", minfos->mnodeNum, minfos->inUse);
for (int32_t i = 0; i < minfos->mnodeNum; i++) { // for (int32_t i = 0; i < minfos->mnodeNum; i++) {
dInfo("mnode index:%d, %s", minfos->mnodeInfos[i].mnodeId, minfos->mnodeInfos[i].mnodeEp); // dInfo("mnode index:%d, %s", minfos->mnodeInfos[i].mnodeId, minfos->mnodeInfos[i].mnodeEp);
} // }
} }
static void dnodeResetMInfos(SMnodeInfos *minfos) { static void dnodeResetMInfos(SMnodeInfos *minfos) {
...@@ -240,10 +240,10 @@ PARSE_MINFOS_OVER: ...@@ -240,10 +240,10 @@ PARSE_MINFOS_OVER:
if (fp != NULL) fclose(fp); if (fp != NULL) fclose(fp);
terrno = 0; terrno = 0;
for (int32_t i = 0; i < minfos.mnodeNum; ++i) { // for (int32_t i = 0; i < minfos.mnodeNum; ++i) {
SMnodeInfo *mInfo = &minfos.mnodeInfos[i]; // SMnodeInfo *mInfo = &minfos.mnodeInfos[i];
dnodeUpdateEp(mInfo->mnodeId, mInfo->mnodeEp, NULL, NULL); // dnodeUpdateEp(mInfo->mnodeId, mInfo->mnodeEp, NULL, NULL);
} // }
dnodeResetMInfos(&minfos); dnodeResetMInfos(&minfos);
return 0; return 0;
} }
......
...@@ -58,7 +58,7 @@ static const SDnodeComponent tsDnodeComponents[] = { ...@@ -58,7 +58,7 @@ static const SDnodeComponent tsDnodeComponents[] = {
{"dnodecfg", dnodeInitCfg, dnodeCleanupCfg}, {"dnodecfg", dnodeInitCfg, dnodeCleanupCfg},
{"dnodeeps", dnodeInitEps, dnodeCleanupEps}, {"dnodeeps", dnodeInitEps, dnodeCleanupEps},
{"mnodeinfos",dnodeInitMInfos, dnodeCleanupMInfos}, {"mnodeinfos",dnodeInitMInfos, dnodeCleanupMInfos},
{"globalcfg" ,taosCheckGlobalCfg, NULL}, // {"globalcfg" ,taosCheckGlobalCfg, NULL},
{"wal", walInit, walCleanUp}, {"wal", walInit, walCleanUp},
{"check", dnodeInitCheck, dnodeCleanupCheck}, // NOTES: dnodeInitCheck must be behind the dnodeinitStorage component !!! {"check", dnodeInitCheck, dnodeCleanupCheck}, // NOTES: dnodeInitCheck must be behind the dnodeinitStorage component !!!
{"vread", dnodeInitVnodeRead, dnodeCleanupVnodeRead}, {"vread", dnodeInitVnodeRead, dnodeCleanupVnodeRead},
...@@ -85,9 +85,7 @@ static int dnodeCreateDir(const char *dir) { ...@@ -85,9 +85,7 @@ static int dnodeCreateDir(const char *dir) {
static void dnodeCleanupComponents(int32_t stepId) { static void dnodeCleanupComponents(int32_t stepId) {
for (int32_t i = stepId; i >= 0; i--) { for (int32_t i = stepId; i >= 0; i--) {
if (tsDnodeComponents[i].cleanup) { tsDnodeComponents[i].cleanup();
(*tsDnodeComponents[i].cleanup)();
}
} }
} }
...@@ -124,12 +122,14 @@ int32_t dnodeInitSystem() { ...@@ -124,12 +122,14 @@ int32_t dnodeInitSystem() {
printf("failed to init log file\n"); printf("failed to init log file\n");
} }
if (!taosReadGlobalCfg()) { if (!taosReadGlobalCfg() || !taosCheckGlobalCfg()) {
taosPrintGlobalCfg(); taosPrintGlobalCfg();
dError("TDengine read global config failed"); dError("TDengine read global config failed");
return -1; return -1;
} }
taosPrintGlobalCfg();
dInfo("start to initialize TDengine"); dInfo("start to initialize TDengine");
if (dnodeInitComponents() != 0) { if (dnodeInitComponents() != 0) {
......
...@@ -356,9 +356,9 @@ bool taosReadGlobalCfg() { ...@@ -356,9 +356,9 @@ bool taosReadGlobalCfg() {
taosTFree(line); taosTFree(line);
if (debugFlag & DEBUG_TRACE || debugFlag & DEBUG_DEBUG || debugFlag & DEBUG_DUMP) { // if (debugFlag & DEBUG_TRACE || debugFlag & DEBUG_DEBUG || debugFlag & DEBUG_DUMP) {
taosSetAllDebugFlag(); // taosSetAllDebugFlag();
} // }
return true; return true;
} }
......
...@@ -72,7 +72,7 @@ int32_t vnodeReadCfg(SVnodeObj *pVnode) { ...@@ -72,7 +72,7 @@ int32_t vnodeReadCfg(SVnodeObj *pVnode) {
char file[TSDB_FILENAME_LEN + 30] = {0}; char file[TSDB_FILENAME_LEN + 30] = {0};
sprintf(file, "%s/vnode%d/config.json", tsVnodeDir, pVnode->vgId); sprintf(file, "%s/vnode%d/config.json", tsVnodeDir, pVnode->vgId);
vnodeMsg.cfg.vgId = pVnode->vgId; // vnodeMsg.cfg.vgId = pVnode->vgId;
fp = fopen(file, "r"); fp = fopen(file, "r");
if (!fp) { if (!fp) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册