xtf-cz / xtf

MIT License
12 stars 55 forks source link

Fix MySQL Data Directory #589

Closed tommaso-borgato closed 1 month ago

tommaso-borgato commented 1 month ago

Fix issues-588 by setting the correct MySQL Data Directory;

Now you can use both the following images by setting the correct datadir:

xtf.mysql.image=registry.redhat.io/rhel9/mysql-80:latest
# the following value is the default value and can be omitted
xtf.mysql.datadir=/var/lib/mysql/data

or:

xtf.mysql.image=container-registry.oracle.com/mysql/community-server:8.0
xtf.mysql.datadir=/var/lib/mysql

Please make sure your PR meets the following requirements:

tommaso-borgato commented 1 month ago

CI Runs:

simkam commented 1 month ago

I'm unsure about this. We might need two different implementations for RH and non-RH images. RH images are often (always?) different from community or official images. They are created for S2I and OpenShift, the other images are more generic.

tommaso-borgato commented 1 month ago

I'm unsure about this. We might need two different implementations for RH and non-RH images. RH images are often (always?) different from community or official images. They are created for S2I and OpenShift, the other images are more generic.

I just checked that RH image has /var/lib/mysql/data as tdathe default a dir while oracle image has /var/lib/mysql:

container-registry.oracle.com/mysql/community-server:8.0:

sh-5.1$ cd /var/lib/mysql/
sh-5.1$ ls -la
total 97744
-rw-r-----. 1 1000900000 root   196608 Oct  7 13:14 '#ib_16384_0.dblwr'
-rw-r-----. 1 1000900000 root  8585216 Oct  7 13:11 '#ib_16384_1.dblwr'
drwxr-x---. 2 1000900000 root     4096 Oct  7 13:12 '#innodb_redo'
drwxr-x---. 2 1000900000 root      187 Oct  7 13:11 '#innodb_temp'
drwxrwx---. 1 mysql      root     4096 Oct  7 13:12  .
drwxr-xr-x. 1 root       root       38 Jul 23 06:48  ..
-rw-r-----. 1 1000900000 root       56 Oct  7 13:11  auto.cnf
-rw-r-----. 1 1000900000 root      180 Oct  7 13:11  binlog.000001
-rw-r-----. 1 1000900000 root      362 Oct  7 13:12  binlog.000002
-rw-r-----. 1 1000900000 root       32 Oct  7 13:12  binlog.index
-rw-------. 1 1000900000 root     1705 Oct  7 13:11  ca-key.pem
-rw-r--r--. 1 1000900000 root     1112 Oct  7 13:11  ca.pem
-rw-r--r--. 1 1000900000 root     1112 Oct  7 13:11  client-cert.pem
-rw-------. 1 1000900000 root     1705 Oct  7 13:11  client-key.pem
-rw-r-----. 1 1000900000 root     5623 Oct  7 13:11  ib_buffer_pool
-rw-r-----. 1 1000900000 root 12582912 Oct  7 13:12  ibdata1
-rw-r-----. 1 1000900000 root 12582912 Oct  7 13:12  ibtmp1
drwxr-x---. 2 1000900000 root      143 Oct  7 13:11  mysql
-rw-r-----. 1 1000900000 root 32505856 Oct  7 13:12  mysql.ibd
srwxrwxrwx. 1 1000900000 root        0 Oct  7 13:12  mysql.sock
-rw-------. 1 1000900000 root        2 Oct  7 13:12  mysql.sock.lock
drwxr-x---. 2 1000900000 root     8192 Oct  7 13:11  performance_schema
-rw-------. 1 1000900000 root     1705 Oct  7 13:11  private_key.pem
-rw-r--r--. 1 1000900000 root      452 Oct  7 13:11  public_key.pem
-rw-r--r--. 1 1000900000 root     1112 Oct  7 13:11  server-cert.pem
-rw-------. 1 1000900000 root     1705 Oct  7 13:11  server-key.pem
drwxr-x---. 2 1000900000 root       28 Oct  7 13:11  sys
drwxr-x---. 2 1000900000 root        6 Oct  7 13:11  test
-rw-r-----. 1 1000900000 root 16777216 Oct  7 13:14  undo_001
-rw-r-----. 1 1000900000 root 16777216 Oct  7 13:14  undo_002    

registry.redhat.io/rhel9/mysql-80:1-330:

sh-5.1$ cd /var/lib/mysql/
sh-5.1$ ls -la
total 12
drwxrwxr-x. 1 mysql      root  102 Oct  7 13:07 .
drwxr-xr-x. 1 root       root   19 Aug 28 12:56 ..
drwxrwxr-x. 1 mysql      root 4096 Oct  7 13:07 data
srwxrwxrwx. 1 1000900000 root    0 Oct  7 13:07 mysql.sock
-rw-------. 1 1000900000 root    2 Oct  7 13:07 mysql.sock.lock
srwxrwxrwx. 1 1000900000 root    0 Oct  7 13:07 mysqlx.sock
-rw-------. 1 1000900000 root    2 Oct  7 13:07 mysqlx.sock.lock

$ ls -la data
total 91600
-rw-r-----. 1 1000900000 root   196608 Oct  7 13:09 '#ib_16384_0.dblwr'
-rw-r-----. 1 1000900000 root  8585216 Oct  7 13:07 '#ib_16384_1.dblwr'
drwxr-x---. 2 1000900000 root     4096 Oct  7 13:07 '#innodb_redo'
drwxr-x---. 2 1000900000 root      187 Oct  7 13:07 '#innodb_temp'
drwxrwxr-x. 1 mysql      root     4096 Oct  7 13:07  .
drwxrwxr-x. 1 mysql      root      102 Oct  7 13:07  ..
-rw-r-----. 1 1000900000 root       56 Oct  7 13:07  auto.cnf
-rw-r-----. 1 1000900000 root     2138 Oct  7 13:07  binlog.000001
-rw-r-----. 1 1000900000 root      157 Oct  7 13:07  binlog.000002
-rw-r-----. 1 1000900000 root       32 Oct  7 13:07  binlog.index
-rw-------. 1 1000900000 root     1705 Oct  7 13:07  ca-key.pem
-rw-r--r--. 1 1000900000 root     1112 Oct  7 13:07  ca.pem
-rw-r--r--. 1 1000900000 root     1112 Oct  7 13:07  client-cert.pem
-rw-------. 1 1000900000 root     1705 Oct  7 13:07  client-key.pem
-rw-r-----. 1 1000900000 root     3739 Oct  7 13:07  ib_buffer_pool
-rw-r-----. 1 1000900000 root 12582912 Oct  7 13:07  ibdata1
-rw-r-----. 1 1000900000 root 12582912 Oct  7 13:07  ibtmp1
drwxr-x---. 2 1000900000 root      143 Oct  7 13:07  mysql
-rw-r-----. 1 1000900000 root        2 Oct  7 13:07  mysql-80-65bc4d4f46-7sdwz.pid
-rw-r-----. 1 1000900000 root 26214400 Oct  7 13:07  mysql.ibd
-rw-r--r--. 1 1000900000 root        7 Oct  7 13:07  mysql_upgrade_info
drwxr-x---. 2 1000900000 root     8192 Oct  7 13:07  performance_schema
-rw-------. 1 1000900000 root     1705 Oct  7 13:07  private_key.pem
-rw-r--r--. 1 1000900000 root      452 Oct  7 13:07  public_key.pem
-rw-r--r--. 1 1000900000 root     1112 Oct  7 13:07  server-cert.pem
-rw-------. 1 1000900000 root     1705 Oct  7 13:07  server-key.pem
drwxr-x---. 2 1000900000 root       28 Oct  7 13:07  sys
drwxr-x---. 2 1000900000 root        6 Oct  7 13:07  test
-rw-r-----. 1 1000900000 root 16777216 Oct  7 13:09  undo_001
-rw-r-----. 1 1000900000 root 16777216 Oct  7 13:09  undo_002