Merge pull request #5070 from taosdata/feature/sim

[TD-2877]<fix>: fix the problem of data loss caused by system power failure
This commit is contained in:
Shengliang Guan 2021-01-28 17:38:48 +08:00 committed by GitHub
commit b4aff4843d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View File

@ -156,7 +156,7 @@ static int32_t dnodeWriteCfg() {
len += snprintf(content + len, maxLen - len, "}\n");
fwrite(content, 1, len, fp);
fflush(fp);
fsync(fileno(fp));
fclose(fp);
free(content);
terrno = 0;

View File

@ -277,7 +277,7 @@ static int32_t dnodeWriteEps() {
len += snprintf(content + len, maxLen - len, "}\n");
fwrite(content, 1, len, fp);
fflush(fp);
fsync(fileno(fp));
fclose(fp);
free(content);
terrno = 0;

View File

@ -286,7 +286,7 @@ static int32_t dnodeWriteMInfos() {
len += snprintf(content + len, maxLen - len, "}\n");
fwrite(content, 1, len, fp);
fflush(fp);
fsync(fileno(fp));
fclose(fp);
free(content);
terrno = 0;

View File

@ -123,7 +123,7 @@ static void mnodePrintUserAuth() {
mnodeDecUserRef(pUser);
}
fflush(fp);
fsync(fileno(fp));
fclose(fp);
}

View File

@ -341,7 +341,7 @@ int32_t vnodeWriteCfg(SCreateVnodeMsg *pMsg) {
len += snprintf(content + len, maxLen - len, "}\n");
fwrite(content, 1, len, fp);
fflush(fp);
fsync(fileno(fp));
fclose(fp);
free(content);
terrno = 0;

View File

@ -90,7 +90,7 @@ int32_t vnodeSaveVersion(SVnodeObj *pVnode) {
len += snprintf(content + len, maxLen - len, "}\n");
fwrite(content, 1, len, fp);
fflush(fp);
fsync(fileno(fp));
fclose(fp);
free(content);
terrno = 0;