Search code examples
gearmandrizzlelibdrizzle

Does gearmand with libdrizzle work while mysql-database is down for a while?


Use-Case:

  • The gearmand is fully operational with libdrizzle as persistence-layer to a mysql-database
  • The drizzle connection crashes (e.g. the gearmand-database is locked for some minutes during nightly backups, or the mysql server crashes or network-problems to the database-server).

Question:

Does the gearmand work without the persistence in this moment (MySQL) and catch up later?


Solution

  • Answer

    No.

    Details

    /usr/local/sbin/gearmand -q mysql --mysql-user user1 --mysql-password pass1 --mysql-db gearmand

    Scenario #1

    Scenario:

    • Enable READ lock for gearman queue table

    Result:

    • The script, which creates the background tasks, is on hold.
    • After removing the READ lock, the script continues and creates all 5000 jobs successfully.
    • Note: I just tested the lock for some seconds. The script might crash due to a timeout.

    Scenario #2

    Scenario:

    • Stop the entire mysql server instance (with the gearman queue)

    Result:

    • Without the mysqld, the jobs cannot be created.
    • 3974 jobs out of 5000 have been created.
    • gearmand output:

      mysql_stmt_prepare failed: Can't connect to local MySQL server through socket X

    • PHP script output:

      PHP Warning: GearmanClient::doBackground(): gearman_client_run_tasks:QUEUE_ERROR:QUEUE_ERROR

    Unfortunately, with my test scenarios, the gearmand stops work if the mysql persistence layer is unavailable.