Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset file handles limit on windows #22853

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/os/osFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ int32_t taosGetErrorFile(TdFilePtr pFile);

int32_t taosCompressFile(char *srcFileName, char *destFileName);

int32_t taosSetFileHandlesLimit();

#ifdef __cplusplus
}
#endif
Expand Down
1 change: 1 addition & 0 deletions source/common/src/tglobal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,7 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile
if (taosSetS3Cfg(tsCfg) != 0) return -1;
}
taosSetSystemCfg(tsCfg);
if (taosSetFileHandlesLimit() != 0) return -1;

cfgDumpCfg(tsCfg, tsc, false);

Expand Down
9 changes: 9 additions & 0 deletions source/os/src/osFile.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,3 +954,12 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) {

return ret;
}

int32_t taosSetFileHandlesLimit() {
#ifdef WINDOWS
const int max_handles = 8192;
int res = _setmaxstdio(max_handles);
return res == max_handles ? 0 : -1;
#endif
return 0;
}