jbergstroem / mariadb-alpine

A tiny and fast MariaDB container
MIT License
73 stars 19 forks source link

ERROR: unsatisfiable constraints: #12

Closed kklepper closed 5 years ago

kklepper commented 5 years ago

Hello, great work indeed!

But I can't reproduce:

docker@boot2docker:/d/test/mariadb$ docker build -f Dockerfile$dver -t kklepper/${PWD##*/}$dver:alpine . && docker images | grep 'none>'| awk {'print $3'} |xargs docker rmi

 ---> Running in ac9d7ff560e6
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  mariadb-10.3.17-r0:

Changing from

RUN apk add --no-cache mariadb=10.3.15-r0 \

to

RUN apk add --no-cache mariadb \

yields

fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
(1/11) Installing mariadb-common (10.3.17-r0)
(2/11) Installing libaio (0.3.111-r0)
(3/11) Installing xz-libs (5.2.4-r0)
(4/11) Installing ncurses-terminfo-base (6.1_p20190105-r0)
(5/11) Installing ncurses-terminfo (6.1_p20190105-r0)
(6/11) Installing ncurses-libs (6.1_p20190105-r0)
(7/11) Installing pcre (8.42-r1)
(8/11) Installing libgcc (8.3.0-r0)
(9/11) Installing libstdc++ (8.3.0-r0)
(10/11) Installing libxml2 (2.9.9-r1)
(11/11) Installing mariadb (10.3.17-r0)

So that's what we want.

Adding mariadb-client increases the size considerably (kklepper/mariadb2 ):

docker@boot2docker:/d/test/mariadb2$ docker images | grep "maria"
kklepper/mariadb                                                     alpine              e16c340d3970        12 seconds ago      38.2MB
kklepper/mariadb2                                                    alpine              1fe8654c7051        6 minutes ago       60.6MB
jbergstroem/mariadb-alpine                                           latest              5db0a68bf6f6        3 months ago         38.1MB

Ok as well.

Running either version reveals errors:

2019-10-02 12:30:38 0 [Note] /usr/bin/mysqld (mysqld 10.3.17-MariaDB-log) starting as process 11 ...
2019-10-02 12:30:38 0 [ERROR] mysqld: Can't open shared library '/usr/lib/mariadb/plugin/ha_sphinx.so' (errno: 2, Error loading shared library /usr/lib/mariadb/plugin/ha_sphinx.so: No such file or directory)

...

2019-10-02 12:30:38 0 [ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT'), found type set('ALLOW_INVALID_DATES','ANSI','ANSI_QUOTES','DB2','EMPTY_STRING_IS_NULL','ERROR_FOR_DIVISION_BY_ZERO','HIGH_NOT_PRECEDENCE','IGNORE_BAD_TABLE_OPTIONS','IGNORE_SPACE','MAXDB','MSSQL','MYSQL323','MYSQL40','NO_AUTO_CREATE_USER','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','NO_DIR_IN_CREATE','NO_EN
2019-10-02 12:30:38 0 [ERROR] mysqld: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.

I cannot fix any of these.

I tried to fix the second with what is given on https://support.plesk.com/hc/en-us/articles/360004067893-Error-in-MySQL-log-files-Incorrect-definition-of-table-mysql-event-expected-column-sql-mode-at-position-14 to no avail. https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-11.html might give a hint, though.

I find https://dba.stackexchange.com/questions/56267/incorrect-definition-of-table-mysql-event-after-migrating-database-to-mariadb

On centos 7:

mysql Ver 15.1 Distrib 5.5.50-MariaDB, for Linux (x86_64) using readline 5.1

mysql_upgrade -u root -p

This issue is fixed.

but cannot make sense of it.

Most important for me is error 1 as I heavily use sphinx search.

alpine 3.3 has /usr/lib/mysql/plugin/ha_sphinx.so, https://pkgs.alpinelinux.org/contents?branch=v3.3&name=mariadb&arch=x86&repo=main, the newer versions don't. The reason maybe is found in https://mariadb.com/kb/en/library/documentation/columns-storage-engines-and-plugins/storage-engines/tokudb/tokudb-engine-installation-problem/ where it states

The downloads page offers two x86_64.tar.gz files: "mariadb-10.0.10-linux-x86_64.tar.gz" and "mariadb-10.0.10-linux-x86_64.tar.gz (requires GLIBC_2.14+)".

GLIBC isn't for alpine...

But 3.3 produces a new error:

(8/9) Installing mariadb (10.1.26-r0)
Executing mariadb-10.1.26-r0.pre-install
(9/9) Installing mariadb-client (10.1.26-r0)
Executing busybox-1.24.2-r2.trigger
OK: 207 MiB in 20 packages
find: /usr/share/mariadb/: No such file or directory
touch: /usr/share/mariadb/mysql_system_tables_data.sql: No such file or directory

So I got ha_sphinx.so from somewhere. Adding COPY files/ha_sphinx.so /usr/lib/mariadb/plugin produces a strange error

Step 7/12 : COPY files/ha_sphinx.so /usr/lib/mariadb/plugin COPY failed: stat /mnt/sda1/var/lib/docker/tmp/docker-builder670482555/files/ha_sphinx.so: no such file or directory

while

docker@boot2docker:/c/kklepper/test/mariadb2$ ll files/
total 6004
-rwxr-xr-x    1 docker   staff      6145496 Sep 30 22:42 ha_sphinx.so

Even adding RUN ls -altrh /c/kklepper/test/mariadb2/files/ha_sphinx.so shows

Step 7/13 : RUN ls -altrh /c/kklepper/test/mariadb2/files/ha_sphinx.so
 ---> Running in b3bf7208524e
ls: /c/kklepper/test/mariadb2/files/ha_sphinx.so: No such file or directory
The command '/bin/sh -c ls -altrh /c/kklepper/test/mariadb2/files/ha_sphinx.so' returned a non-zero code: 1

I'm stuck. Any idea?

jbergstroem commented 5 years ago

Hello, great work indeed!

Thanks!

Changing from RUN apk add --no-cache mariadb=10.3.15-r0 to RUN apk add --no-cache mariadb yields ...

The linter (hadolint) doesn't like implicit versioning. I need to bump version, is all.

Most important for me is error 1 as I heavily use sphinx search.

One goal with this container is that I optimized for size, meaning I removed a lot of plugins. Let me have a look at this specific case and perhaps re-add it (the balance I'm trying to find is to heavily optimize for size/bootup but not cripple a developer experience)!

kklepper commented 5 years ago

Found out...

1:

ALTER TABLE mysql.eventCHANGEsql_mode`sql_mode SET('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';`

2:

remove * in .dockerignore

Now COPY ha_sphinx.so /usr/lib/mariadb/plugin works.

BTW, the ha_sphinx.so files I found had extremely different sizes. The right size for me is

docker@boot2docker:/c/kklepper/test/mariadb2$ ls -latr ha_sphinx.so
-rwxr-xr-x    1 docker   staff        96320 Oct  2 19:12 ha_sphinx.so

I picked it from a working container based on alpine 3.3.

Now I need to integrate this into my stack... This container keeps quitting after some minutes.


docker@boot2docker:/c/kklepper/voxx/vx$ docker ps -a | grep "db2:"
239ca11b115f        kklepper/mariadb2:alpine                                     "/start-v2.sh"           24 seconds ago       Up 18 seconds               3306/tcp                    vx_master.1.kj33vmuv4edlsrkr73ro5hy1c
9458327dfdd7        kklepper/mariadb2:alpine                                     "/start-v2.sh"           About a minute ago   Exited (1) 26 seconds ago                               vx_master.1.o2o8uq7cbagsasetyrbigu2co

I'll find out, too.

jbergstroem commented 5 years ago

If you don't mind, I'll repoen this and have a look at fixing sphinx!

jbergstroem commented 5 years ago

So, I had a look at this. Sphinx actually looks like its available as a separate package, but it has additional dependencies on top of mariadb which doubles the size of the container. I'm thinking this is wandering a bit too far off from the goals of this specific project:

~ # apk add sphinx
(1/9) Installing expat (2.2.8-r0)
(2/9) Installing mariadb-connector-c (3.0.10-r0)
(3/9) Installing readline (8.0.0-r0)
(4/9) Installing unixodbc (2.3.7-r1)
(5/9) Installing db (5.3.28-r1)
(6/9) Installing libsasl (2.1.27-r3)
(7/9) Installing libldap (2.4.48-r0)
(8/9) Installing libpq (11.5-r1)
(9/9) Installing sphinx (2.2.11-r1)

For your use case, perhaps check if apk add mariadb sphinx works fine?

kklepper commented 5 years ago

This is my solution:

a. based on

jbergstroem/mariadb-alpine            3 months ago        38.1MB
kklepper/mariadb(unchanged)           28 hours ago        38.2MB
kklepper/mariadb2(client)             About an hour ago   79.2MB

b. switched to alpine 3.3 which has ha_sphinx.so and no problems with mysql.event:

kklepper/mariadb33                    16 minutes ago      90.1MB
kklepper/mariadb33(client)            3 minutes ago       112MB

My previous solution based on alpine 3.3 (client):

kklepper/mariadb-10.1-ms-mha.33       25 hours ago        217MB