Skip to content

fix: avoid duplicate table creation during upgrades - #454

Merged
TheWitness merged 1 commit into
developfrom
fix/syslog-440-schema-repeat
Nov 16, 2026
Merged

TheWitness merged 1 commit into
developfrom
fix/syslog-440-schema-repeat

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Ref #440.

An upgrade can create dashboard tables and then try to create them again in the same request. Cacti retains the earlier negative table-existence result. Skip an identical schema operation that already succeeded for the same connection, and let install/upgrade callers create the tables before seeding the dashboard. Failed operations remain retryable; changed definitions and missing tables still run.

This covers the adjacent connect-then-upgrade path as well as repeated dashboard seeding, while retaining the older-Cacti primary-key compatibility fix from #439.

Verified with real Cacti schema helpers on MariaDB 11.8: two schema passes and two seed calls issue two CREATEs total, without errors, and leave one dashboard and five panels. PHP 8.2 Linux: 659 tests passed, one permission-dependent skip, one existing /proc probe warning. PHP syntax, manifest and translation checks pass. The current coverage filter does not measure these entrypoints. Static analysis has existing/environment diagnostics; no diagnostic lands on a changed line. The repository-requested graphify command is unavailable locally.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit 305f18f into develop Nov 16, 2026
3 of 8 checks passed
@TheWitness
TheWitness deleted the fix/syslog-440-schema-repeat branch November 16, 2026 16:55
TheWitness added a commit that referenced this pull request Nov 16, 2026
…eate memo

The memo added in #454 returned early for any previously successful
db_update_table() call, so an owner column narrowed after the first check
was never widened in the same process and the database regression test
failed on every PHP version. Remember creations only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TheWitness added a commit that referenced this pull request Nov 16, 2026
…#453) (#455)

* fix: resolve legacy hostField and collector status query failures (#451, #452, #453)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: keep detecting schema drift on existing tables after the #454 create memo

The memo added in #454 returned early for any previously successful
db_update_table() call, so an owner column narrowed after the first check
was never widened in the same process and the database regression test
failed on every PHP version. Remember creations only.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: cover repeated updates of an existing table in syslog_db_update_table()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants