Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Database Cluster Support

Open
#80 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@alexander-zierhut is already working on this.

Since Jul 2, 2026.

  • #181 by @alexander-zierhut — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
20/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
php, sql
Domain
database

Research direction

Start with the existing exec method in the database layer and the mysqli_sql_exception it throws, then review open pull request #181, which already targets this issue and should be checked before any new work. The issue proposes an execWithRetry wrapper plus an isRetryable check for Galera error codes 1213, 1205 and SQLSTATE 40001. Done means retryable errors are retried with a randomized backoff, other errors propagate, and tests cover both cases.

Written by the indexing model from the issue text.

Description

#module-database enhancement

The current exec method has no retry logic, although there are errors which need to be retried on cluster setups.

Example retry logic:
public function execWithRetry($query, ...$params) {
    $maxRetries = 3;
    $attempt = 0;

    while (true) {
        try {
            return $this->exec($query, ...$params);
        } catch (\mysqli_sql_exception $e) {

            if ($attempt >= $maxRetries || !$this->isRetryable($e)) {
                throw $e;
            }

            $attempt++;

            // Small randomized backoff (VERY important)
            usleep(random_int(10_000, 50_000));
        }
    }
}
Example to check error for retry-able
const GALERA_RETRY_ERRORS = [
    1213, // Deadlock found
    1205, // Lock wait timeout
    40001 // Serialization failure (SQLSTATE)
];

private function isRetryable(\mysqli_sql_exception $e): bool {
    if (in_array($e->getCode(), self::GALERA_RETRY_ERRORS, true)) {
        return true;
    }

    // SQLSTATE 40001 = serialization failure
    if ($e->getSqlState() === '40001') {
        return true;
    }

    return false;
}
Dominant language
PHP
Stars
15
Forks
8
Avg merge
21h 23m
Merged PRs (30d)
6

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from zubzet/framework

All issues in zubzet/framework

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.