Repository navigation
fix(process): coordinate Syslog processing through the process registry instead of GET_LOCK (#479) - #495
Merged
somethingwithproof merged 3 commits intoDec 3, 2026
Conversation
) syslog_wait_workers() held the master in its registration stage until every launched worker was registered and running. Workers that had already finished, or exited because the processing lock check failed, were never counted, so each parallel phase waited the full ten seconds. A worker now counts once it is registered or has recorded statistics, read from the settings table rather than the read_config_option() cache, and the completion check uses the same fresh read. A worker that finds the processing lock no longer held by its master records a failed statistics row so the master stops waiting, and logs the expected owner and the holder IS_USED_LOCK() reported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review on Cacti#494. A child of an earlier run could report after the next run cleared the statistics rows and end its registration wait or be counted as its result. The wait, the completion check and the transfer aggregation now count only reports whose run_id and phase match, and a child that fails the lock check records its failure only while the lock is free, so it never overwrites a newer run's rows. The double-count regression test now asserts the exact poll count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ry instead of GET_LOCK (Cacti#479) Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
xmacan
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Replaces the
GET_LOCK()-based Syslog processing lock with Cacti's processregistry (
register_process_start), and has transfer workers verify theirmaster by process id instead of
IS_USED_LOCK().Why (#479)
The processing lock was taken with
GET_LOCK()on a dedicated connection, andeach transfer worker checked
IS_USED_LOCK()on its own Syslog connection toconfirm the master still held it. Named locks are session-bound and
server-local: behind a proxy in front of a Galera cluster, the master's lock
connection and a worker's connection can land on different nodes, so the worker
sees the lock as unheld, logs "no longer holds the processing lock" and exits
without writing — the failure reported in #479.
How
register_process_start('syslog', 'master', <poller_id>)registration is now the single-master mutex; it also excludes partition
rebuilds, which register the same task.
cli/upgrade_partitioning.phpand on-demand table repair inincludes/schema.phpnow coordinate throughregister_process_start(...)instead of
GET_LOCK(syslog_processing_lock_name()).--master-pidinstead of--lock-ownerand verify themaster with
syslog_processing_master_alive()(a localcacti_process_still_running()check), which does not depend on which node aconnection is routed to. The
syslog_processing_lock_*helpers are removed.Relationship to #494
This stacks on #494 (
fix/worker-wait-exited-479): its commits appear inthis PR's diff until #494 merges, then rebase away. This change supersedes the
lock mechanism #494 improves, so the two overlap — merge order is yours; I
have not touched the #494 branch.
Correctness caveat (for your call)
Cacti's
processestable isENGINE=MEMORY(node-local), so this changeremoves the session-lock fragility and adopts the idiomatic registry plus a
local pid check — the right fix for #479 as reported. It does not by itself
give true cross-node HA for the registration rows; genuine multi-node
coordination would want the InnoDB
process_locksprimitive. Flagging it so youcan decide whether #479's scope stops at the session-lock fix or should go
further.
Tests
tests/Unit/ProcessingRegistryTest.php; removedProcessingLockTest.php.PartitionRebuildTest.phpand the twotests/regression/*harnessesfrom the lock to the registry.
macOS
/procwarning). The two live-DB regression scripts were adapted andlint-clean but need a MariaDB server to execute.