Use separate tmp directory

During upgrades or cluster repairments, temporary directories are created
inside /var/lib/mysql and treated as databases. This results in errors
during mysqlcheck like:

`Got error: 1102: Incorrect database name '#mysql50#tmp.stLr46FBlt'`

Path outside of datadir is not choosen since it could be separate mount
point and it's important for replication
to survive reboots.

Change-Id: Ia110dd9ed09b04f6bb7a0a3adf5a808966558507
This commit is contained in:
Dmitriy Rabotyagov 2022-03-02 16:57:40 +01:00 committed by Dmitriy Rabotyagov
parent 3c57409bdf
commit ebc0417919
4 changed files with 17 additions and 1 deletions

View File

@ -99,6 +99,9 @@ galera_gcache_size: 1024M
galera_max_heap_table_size: 32M
galera_tmp_table_size: 32M
galera_tmp_dir: /var/lib/mysql/#tmp
galera_ignore_db_dirs:
- "'#tmp'"
galera_file_limits: 65535
galera_wait_timeout: "{{ openstack_db_connection_recycle_time | default('600') }}"

View File

@ -0,0 +1,10 @@
---
features:
- |
New variables ``galera_tmp_dir`` and ``galera_ignore_db_dirs`` were
implemented to control path to tmp dir and what directories should be
ignored when listing databases.
upgrade:
- |
If you have database named as ``#tmp`` you should change ``galera_tmp_dir``
path and adjust ``galera_ignore_db_dirs`` or rename database.

View File

@ -111,6 +111,7 @@
recurse: "{{ item.recurse|default('false') }}"
with_items:
- { path: "/var/lib/mysql", owner: "mysql", mode: "02755" }
- { path: "{{ galera_tmp_dir }}", owner: "mysql", mode: "02755" }
- { path: "/etc/mysql/conf.d" }
- name: Create and install SSL certificates

View File

@ -28,7 +28,9 @@ collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
datadir = /var/lib/mysql
tmpdir = /var/lib/mysql
tmpdir = {{ galera_tmp_dir }}
ignore_db_dirs = {{ galera_ignore_db_dirs | join(',') }}
bind-address = {{ galera_server_bind_address }}
{% if galera_server_id is defined %}
server-id = {{ galera_server_id }}