Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to detect full initialization of the database, healthcheck.sh always returns code 0 #76241

Open
olivierboudet opened this issue Jan 14, 2025 · 2 comments
Assignees
Labels
in-progress mariadb tech-issues The user has a technical issue about an application

Comments

@olivierboudet
Copy link

olivierboudet commented Jan 14, 2025

Name and Version

bitnami/mariadb:10.11

What architecture are you using?

None

What steps will reproduce the bug?

  1. Run mariadb with a lot of sql files which slow down initialization with a compose file like this :
  db:
    image: bitnami/mariadb:10.11
    environment:
      BITNAMI_DEBUG: true
      ALLOW_EMPTY_PASSWORD: "true"
      MARIADB_SKIP_TEST_DB: "yes"
      MARIADB_USER: root
      MARIADB_PASSWORD: password
      MARIADB_DATABASE: bitnami
      MARIADB_ROOT_PASSWORD: password
    ports:
      - 3306:3306
    healthcheck:
      test: [ "CMD", "/opt/bitnami/scripts/mariadb/healthcheck.sh", "--connect", "--innodb_initialized" ]
      start_period: 10s
      interval: 10s
      timeout: 5s
      retries: 10
    volumes:
      - ./sql/:/docker-entrypoint-initdb.d/
  1. we expect the container to be ready only when initialization is completed. In the official mariadb image, initialization of the db is executed with the server running with --skip-networking flag. In this case, healthcheck.sh --connect fails and the container is not in a ready state.
    With the bitnami image, the --skip-networking flag is not used, which prevents to detect the full initialization of the database

What is the expected behavior?

healthcheck.sh --connect should allow to detect the full initialization of the database

What do you see instead?

There is no way to detect the real ready state of the database

Additional information

If this bug is valid and the proposal to use --skip-networking during setup is accepted, I am willing to contribute to this, please tell me.

@olivierboudet olivierboudet added the tech-issues The user has a technical issue about an application label Jan 14, 2025
@github-actions github-actions bot added the triage Triage is needed label Jan 14, 2025
@github-actions github-actions bot removed the triage Triage is needed label Jan 14, 2025
@github-actions github-actions bot assigned alvneiayu and unassigned carrodher Jan 14, 2025
@alvneiayu
Copy link
Contributor

hi @olivierboudet

I think that I am reproducing the error. Could you send me logs reproducing the problem, please? Just to be aligned.

Thanks a lot

Álvaro

@olivierboudet
Copy link
Author

hello @alvneiayu
I am not sure of what kind of logs you need, but here it is the startup logs when executing custom scripts :

db  | mariadb 10:03:15.87 INFO  ==> Running mysql_upgrade
db  | mariadb 10:03:15.89 INFO  ==> Loading user's custom files from /docker-entrypoint-initdb.d
db  | find: '/docker-entrypoint-startdb.d/': No such file or directory
db  | mariadb 10:04:34.21 INFO  ==> Stopping mariadb
db  | 2025-01-25 10:04:34 0 [Note] /opt/bitnami/mariadb/sbin/mysqld (initiated by: unknown): Normal shutdown

you can see that my script took more than 1 minute.

During this minute, I ran healthcheck.sh regularly :

I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 73  Threads: 7  Questions: 1012  Slow queries: 0  Opens: 762  Flush tables: 1  Open tables: 88  Queries per second avg: 13.863
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 75  Threads: 7  Questions: 1091  Slow queries: 0  Opens: 776  Flush tables: 1  Open tables: 97  Queries per second avg: 14.546
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 75  Threads: 7  Questions: 1212  Slow queries: 0  Opens: 787  Flush tables: 1  Open tables: 108  Queries per second avg: 16.160
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 76  Threads: 7  Questions: 1343  Slow queries: 0  Opens: 790  Flush tables: 1  Open tables: 111  Queries per second avg: 17.671
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 76  Threads: 7  Questions: 1451  Slow queries: 0  Opens: 796  Flush tables: 1  Open tables: 117  Queries per second avg: 19.092
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 77  Threads: 7  Questions: 1560  Slow queries: 0  Opens: 800  Flush tables: 1  Open tables: 121  Queries per second avg: 20.259
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 78  Threads: 7  Questions: 1691  Slow queries: 0  Opens: 814  Flush tables: 1  Open tables: 135  Queries per second avg: 21.679
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 78  Threads: 7  Questions: 1701  Slow queries: 0  Opens: 818  Flush tables: 1  Open tables: 135  Queries per second avg: 21.807
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 79  Threads: 7  Questions: 1769  Slow queries: 0  Opens: 831  Flush tables: 1  Open tables: 140  Queries per second avg: 22.392
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 
mysqld is alive
Uptime: 80  Threads: 7  Questions: 1823  Slow queries: 0  Opens: 840  Flush tables: 1  Open tables: 143  Queries per second avg: 22.787
I have no name!@5607c18d2932:/$ /opt/bitnami/scripts/mariadb/healthcheck.sh 

you can see that the number of tables increases as the scripts are executed, but the healthcheck is always returning a success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-progress mariadb tech-issues The user has a technical issue about an application
Projects
None yet
Development

No branches or pull requests

3 participants