Closed howels closed 1 month ago
This is outside of Patroni scope. The initdb doesn't provide a way to disable huge pages. Editing the sample.conf isn't an option either, Patroni simply doesn't have permissions for that.
initdb now support a -c
option to set server variables for the duration of initdb and all future server starts from pg16.
initdb now support a -c option to set server variables
Then we don't have to do anything, because users can do it via Patroni config:
bootstrap:
initdb:
- set: hugepages=off
Describe the bug On an OS where hugepages are enabled, if no hugepages resources are assigned in Kubernetes and the postgres instance is set to
hugepages = off
in the config then one would assume that the DB would not use hugepages. However, because the initdb process usespostgres.conf,sample
instead of the actual specified configuration the applied setting is actuallyhugepages = try
during initdb. In these case the initdb phase will attempt to allocate hugepages which are available in the OS, but it will be denied access by Kubernetes and fail.To Reproduce Run a DB with no hugepages resources assigned on a OS with hugepages and with
hugepages = off
set in postgres conf.Expected behavior When hugepages are disabled they should not be used, during initdb or otherwise. The inability to specify hugepages forces all DBs to use hugepages on any system where they are enabled, even if the hugepages are intended for other applications and not available to the DB Pods.
Additional context Issue has persisted for some time and the implementation goes against the spirit of the configuration options provided. Exceedingly awkward workaround such as https://github.com/zalando/patroni/issues/1393#issuecomment-1044380715 are not suitable for ongoing long-term usage.