OCL module — no deadlock retry on Galera causes noisy first-startup errors

On a fresh Galera MariaDB cluster, the OCL module’s saveMapping() method hits deadlock error 1213 due to concurrent Galera certification conflicts and has zero retry logic€” the exception is caught, wrapped in ImportException, and the mapping is permanently recorded as ItemState.ERROR. On first boot, this floods logs with hundreds of deadlock stack traces and permanently skips a small fraction of mappings. saveConcept() has a single generic retry (2 attempts max) but no deadlock-specific handling it catches any Exception with no backoff or error-code check.

Proposed fix

Retry saveMapping() on SQLTransactionRollbackException (error 1213) with exponential backoff. Deadlock retry is a well-established pattern for Galera€” transient conflicts resolve within milliseconds and a retry immediately succeeds.

2 Likes

If you tested the proposed fix and confirmed that it solved the problem that you are reporting, then a ticket and pull request would be highly welcome! :slight_smile:

2 Likes

@suubi7 it’s not just Galera. It happens on a single MariaDB instance as well for me. Retry may help, yet it feels that API should be improved to be able to handle concurrency without running into such issues. The OCL module uses parallel processing to persist data into DB thus reveals the issue.

Having said that adding retry is better than nothing so if you have time to create a PR, it would be great!

3 Likes