Skip to content

Commit

Permalink
Use separate tmp directory
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Dmitriy Rabotyagov authored and noonedeadpunk committed Apr 11, 2022
1 parent 3c57409 commit ebc0417
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions defaults/main.yml
Expand Up @@ -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') }}"
Expand Down
10 changes: 10 additions & 0 deletions releasenotes/notes/galera_tmpdir-3271e0bc8e353930.yaml
@@ -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.
1 change: 1 addition & 0 deletions tasks/galera_server_post_install.yml
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion templates/my.cnf.j2
Expand Up @@ -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 }}
Expand Down

0 comments on commit ebc0417

Please sign in to comment.