fix: write MariaDB's startup spelling for time_zone into the option file

mariadbd has no time_zone startup option — the name only exists for SET — so
the resolved parameter group aborted the server while it parsed defaults, before
it opened the datadir. No pidfile was ever written and the reconciler failed
every instance at the 20-minute engine-health deadline.

ParameterSpec gains an option-file spelling, used only when rendering the
include. time_zone is the one setting that needs it, as default_time_zone, which
resolves @@global.time_zone to the same value. The customer-facing name is
unchanged: the API still reports time_zone and a live apply still issues
SET GLOBAL time_zone. Names read back out of a generated file return to the
catalog's namespace first, so a startup spelling cannot read as an unknown name
and report a pending restart nothing could clear.

setup.sh now feeds the catalog's resolved defaults to the image's own mariadbd
at build time, so a name the server refuses fails the build rather than every
instance built from it.
This commit is contained in:
Julian Sommer
2026-08-12 10:14:30 +10:00
parent 16aa888d10
commit 09d23ae7dd
16 changed files with 421 additions and 17 deletions
@@ -0,0 +1,56 @@
[mysqld]
# Resolved parameter group, written by rds-agent.
autocommit = 'on'
character_set_server = 'utf8mb4'
collation_server = 'utf8mb4_general_ci'
connect_timeout = '10'
event_scheduler = 'off'
general_log = 'off'
group_concat_max_len = '1048576'
idle_transaction_timeout = '0'
innodb_adaptive_hash_index = 'off'
innodb_autoinc_lock_mode = '1'
innodb_buffer_pool_size = '805306368'
innodb_file_per_table = 'on'
innodb_flush_log_at_trx_commit = '1'
innodb_flush_method = 'o_direct'
innodb_flush_neighbors = '1'
innodb_io_capacity = '200'
innodb_io_capacity_max = '2000'
innodb_lock_wait_timeout = '50'
innodb_log_file_size = '100663296'
innodb_max_dirty_pages_pct = '90'
innodb_purge_threads = '4'
innodb_read_io_threads = '4'
innodb_stats_persistent = 'on'
innodb_strict_mode = 'on'
innodb_write_io_threads = '4'
interactive_timeout = '28800'
join_buffer_size = '262144'
key_buffer_size = '134217728'
lock_wait_timeout = '86400'
log_output = 'file'
log_queries_not_using_indexes = 'off'
log_warnings = '2'
long_query_time = '10'
max_allowed_packet = '16777216'
max_connect_errors = '100'
max_connections = '85'
max_heap_table_size = '16777216'
max_prepared_stmt_count = '16382'
max_statement_time = '0'
net_read_timeout = '30'
net_write_timeout = '60'
performance_schema = 'off'
read_buffer_size = '131072'
read_rnd_buffer_size = '262144'
slow_query_log = 'off'
sort_buffer_size = '2097152'
sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
table_definition_cache = '400'
table_open_cache = '2000'
thread_cache_size = '256'
default_time_zone = 'SYSTEM'
tmp_table_size = '16777216'
transaction_isolation = 'repeatable-read'
wait_timeout = '28800'
+1
View File
@@ -36,6 +36,7 @@ scripts/images/common/mulga-mgmt-net.initd:/etc/init.d/mulga-mgmt-net \
scripts/images/common/mulga-mgmt-net-routes.initd:/etc/init.d/mulga-mgmt-net-routes \
scripts/images/common/mulga-mgmt-net.sh:/usr/local/sbin/mulga-mgmt-net \
scripts/images/rds-mariadb/zz-rds-include.cnf:/etc/my.cnf.d/zz-rds-include.cnf \
scripts/images/rds-mariadb/default-parameters.cnf:/usr/local/share/spinifex-rds/default-parameters.cnf \
scripts/images/rds-mariadb/mariadb.confd:/etc/conf.d/mariadb"
# Each service's own depend() asserts the ordering; this lists it to match.
+23
View File
@@ -62,6 +62,29 @@ if grep -rEq '^[[:space:]]*skip[-_]networking' /etc/my.cnf /etc/my.cnf.d; then
exit 1
fi
# The resolved defaults checked against this image's own mariadbd. A name the
# server refuses at startup is not a rejected setting: it aborts the boot with the
# generated file already on the data volume. cmd/rds-agent keeps this file in step.
#
# --verbose --help parses the option files and exits without touching a datadir,
# so it is the whole check. defaults-extra-file rather than the include directory,
# which stays empty in the image; it must be the first option mariadbd sees.
default_params=/usr/local/share/spinifex-rds/default-parameters.cnf
if [ ! -f "${default_params}" ]; then
echo "[rds-mariadb-setup] the catalog's default parameter set was not delivered to ${default_params}"
exit 1
fi
if ! mariadbd --defaults-extra-file="${default_params}" --user=mysql --verbose --help \
>/dev/null 2>/tmp/rds-defaults.err; then
echo "[rds-mariadb-setup] mariadbd refuses the catalog's default parameter set"
cat /tmp/rds-defaults.err
exit 1
fi
# Build-time only: nothing at runtime reads it, and an include the server could
# find twice is a way for a stale copy to shadow the customer's own set.
rm -f /tmp/rds-defaults.err "${default_params}"
rmdir /usr/local/share/spinifex-rds 2>/dev/null || true
# The packaged service starts on a warning when the datadir is empty, so the
# dependency is what keeps it off an unbootstrapped volume. Asserted here, since
# an image whose engine can come up beside a failed bootstrap is the one failure