Merge pull request #26915 from taosdata/opti/TD-31097

feat:[TD-31097]init lock to avoid error in mac os
This commit is contained in:
dapan1121 2024-08-01 10:17:28 +08:00 committed by GitHub
commit b76490bb7e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -669,6 +669,13 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
}
(void)memset(pMnode, 0, sizeof(SMnode));
int32_t code = taosThreadRwlockInit(&pMnode->lock, NULL);
if (code != 0) {
taosMemoryFree(pMnode);
mError("failed to open mnode lock since %s", tstrerror(code));
return NULL;
}
char timestr[24] = "1970-01-01 00:00:00.00";
(void)taosParseTime(timestr, &pMnode->checkTime, (int32_t)strlen(timestr), TSDB_TIME_PRECISION_MILLI, 0);
mndSetOptions(pMnode, pOption);
@ -682,7 +689,7 @@ SMnode *mndOpen(const char *path, const SMnodeOpt *pOption) {
return NULL;
}
int32_t code = mndCreateDir(pMnode, path);
code = mndCreateDir(pMnode, path);
if (code != 0) {
code = terrno;
mError("failed to open mnode since %s", tstrerror(code));