Skip to content
/ server Public

Conversation

@sjaakola
Copy link
Contributor

@sjaakola sjaakola commented Feb 3, 2026

When a cluster donor node executes mariabackup SST, it will use same approximation for max open files limit as was set for the mariadbd process during the server startup. This may be a problem for installation where mariabackup execution would need higher open file count, and might crash for exceeding the too tight open file limit.

The reason for this behavior is that when mariadbd server calculates the expected max open files count, it will record this open file count approximation as system ulimit value, both as soft and hard limit. Later, when the node operates as SST donor, it spawns mariabackup executable, which now inherits the ulmit setting used for the mariadbd process. Mariabackup tries to enforce open_files_limit variable value configured in [mariabackup] group in the my.cnf fle, but this will fail if hard ulimit value is smaller.

The fix in this commit records the approximated max open file count only as soft ulimit value. If hard ulimit is higher or unlimited, there remains head room for the mariabackup to use higher open_files_limit configuration.

@sjaakola
Copy link
Contributor Author

sjaakola commented Feb 4, 2026

assigned for review for server team / @sanja-byelkin . I could not figure out a safe deterministic mtr test for this. Tested only manually by starting a 2 node cluster (by mariabackup SST) and verifying that mariabackup execution had ulimit set to according to open-files-limit as configured for mariabackup

Copy link
Contributor

@janlindstrom janlindstrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check indentation and soft limit case.

}

/* Soft limit cannot exceed hard limit. */
rlimit.rlim_cur= max_file_limit;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If setting new limit fails, does it also mean that soft limit remains bigger than hard limit ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hard limit is the ceiling, soft limit can never been higher

mysys/my_file.c Outdated
/* Never lower the hard limit (rlim_max): lowering is irreversible for
non-privileged users and can prevent later increases. */
if ((ulonglong) rlimit.rlim_max != (ulonglong) RLIM_INFINITY &&
max_file_limit > rlimit.rlim_max)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation is incorrect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

original file has tabs here and there, replaced by spaces

When a cluster donor node executes mariabackup SST, it will use same
approximation for max open files limit as was set for the mariadbd
process during the server startup. This may be a problem for installation
where mariabackup execution would need higher open file count, and might
crash for exceeding the too tight open file limit.

The reason for this behavior is that when mariadbd server calculates the
expected max open files count, it will record this open file count approximation
as system ulimit value, both as soft and hard limit. Later, when the node
operates as SST donor, it spawns mariabackup executable, which now inherits the
ulmit setting used for the mariadbd process. Mariabackup tries to enforce
open_files_limit variable value configured in [mariabackup] group in the my.cnf
fle, but this will fail if hard ulimit value is smaller.

The fix in this commit records the approximated max open file count only as soft
ulimit value. If hard ulimit is higher or unlimited, there remains head room for
the mariabackup to use higher open_files_limit configuration.
@sjaakola
Copy link
Contributor Author

sjaakola commented Feb 6, 2026

Pushed new version based on Jan's review comments

@sjaakola sjaakola requested a review from janlindstrom February 6, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants