1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-33671: Remove hardcoded open-files-limit in safe_process.cc

The fixed limit of 1024 open files was preventing proper concurrency
testing in MTR. This commit removes the hardcoded value and adds a new
option to control the limit when running tests: --open-files-limit=X.

The default is still 1024, but it can now be changed when needed,
making it easier to test scenarios that require different number of
open file descriptors at the same time e.g: partition_notwin.test

Documentation is added to mtr's help file as well.

Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
This commit is contained in:
Mohanad
2025-03-29 20:36:08 +02:00
committed by Vicențiu-Marian Ciorbaru
parent a524ec5951
commit 1f5d2b2010
3 changed files with 20 additions and 6 deletions

View File

@ -220,6 +220,7 @@ int main(int argc, char* const argv[] )
pid_t own_pid= getpid();
pid_t parent_pid= getppid();
bool nocore = false;
int open_files_limit = 1024;
struct sigaction sa,sa_abort;
sa.sa_handler= handle_signal;
@ -268,7 +269,14 @@ int main(int argc, char* const argv[] )
}
else if ( strncmp (arg, "--env ", 6) == 0 )
{
putenv(strdup(arg+6));
putenv(strdup(arg+6));
}
else if ( strncmp(arg, "--open-files-limit=", 19) == 0 )
{
const char* start = arg + 19;
open_files_limit = atoi(start);
if (open_files_limit <= 0)
die("Invalid value '%s' passed to --open-files-limit", start);
}
else
die("Unknown option: %s", arg);
@ -318,11 +326,8 @@ int main(int argc, char* const argv[] )
if (nocore)
setlimit(RLIMIT_CORE, 0, 0);
/*
mysqld defaults depend on that. make test results stable and independent
from the environment
*/
setlimit(RLIMIT_NOFILE, 1024, 1024);
// Set open files limit
setlimit(RLIMIT_NOFILE, open_files_limit, open_files_limit);
// Signal that child is ready
buf= 37;