Database Cluster Support
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 20/100
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
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from zubzet/framework
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
First-party extensions: monorepo layout, split publishing, selective CI, governance, zubzet/s3 pilotOpenfeature
Difficulty 5/5 Over a week Newbie friendliness 8/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Fix small bugs in session lifetime, migrator, login mail and root pathPossibly taken @Denetor03 claimed this 14 days ago. Open#module-authentication bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
All issues in zubzet/framework
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Automattic/blocks-engine#2866 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
community-scripts/ProxmoxVE#17944 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
EasyCorp/EasyAdminBundle#7861 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
backend gamification P0
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
semanadeinformatica/website#461 ·