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

HA: Reduce deadlocks via exclusive locking (SELECT ... FOR UPDATE) #830

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Oct 25, 2024

  1. HA: Reduce deadlocks via exclusive locking (SELECT ... FOR UPDATE)

    Within the HA transaction, we always retrieve rows from the
    `icingadb_instance` table to determine responsibility between the
    instances. Previously, this selection was performed using a shared lock
    (`SELECT ... LOCK IN SHARE MODE`). Although selectin rows is generally
    not an issue, both Icinga DB instances perform an upsert on the same
    table right after the select statement, resulting in deadlock errors
    most of the time. In order to reduce the deadlocks on both sides, an
    exclusive lock on the selected rows is necessary, which can be achieved
    using the `SELECT ... FOR UDPATE` command. However, deadlocks can still
    occur if the `icingadb_instance` table is empty, i.e. when rows are
    available to lock exclusively.
    Al2Klimov authored and yhabteab committed Oct 25, 2024
    Configuration menu
    Copy the full SHA
    c9deda3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    04dd8ff View commit details
    Browse the repository at this point in the history