Skip to content

Conversation

Copy link

Copilot AI commented Jan 2, 2026

Partition management functions were querying the wrong table when operating on syslog_removed, causing "Duplicate partition name" and "VALUES LESS THAN value must be strictly increasing" errors during DST transitions and concurrent partition operations.

Changes

Three functions accept a $table parameter but had hardcoded 'syslog' in their SQL queries:

  • syslog_partition_create(): partition existence check
  • syslog_partition_remove(): partition count query
  • syslog_partition_check(): last partition lookup

Changed all three to use table_name='$table' instead of table_name='syslog'.

Example

Before:

function syslog_partition_create($table) {
    $exists = syslog_db_fetch_row("SELECT *
        FROM `information_schema`.`partitions`
        WHERE table_schema='" . $syslogdb_default . "'
        AND table_name='syslog'  // Wrong: ignores $table parameter
        ...");
}

After:

function syslog_partition_create($table) {
    $exists = syslog_db_fetch_row("SELECT *
        FROM `information_schema`.`partitions`
        WHERE table_schema='" . $syslogdb_default . "'
        AND table_name='$table'  // Correct: uses parameter
        ...");
}
Original prompt

This section details on the original issue you should resolve

<issue_title>[4.0] - Duplicate Partition name errors</issue_title>
<issue_description>Last night I saw the following errors on all of my Cacti instances
the only thing that I can think of is that day light savings times started last night

Different mariadb versions
different cacti versions

2022/11/06 00:58:05 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate partition name d20221106
2022/11/06 00:58:05 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_process.php[146]:syslog_partition_manage(), /plugins/syslog/functions.php[172]:syslog_partition_create(), /plugins/syslog/functions.php[208]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[272]:db_execute_prepared())
2022/11/06 00:58:05 - CMDPHP ERROR: A DB Exec Failed!, Error: VALUES LESS THAN value must be strictly increasing for each partition
2022/11/06 00:56:55 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_process.php[146]:syslog_partition_manage(), /plugins/syslog/functions.php[177]:syslog_partition_create(), /plugins/syslog/functions.php[208]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[272]:db_execute_prepared())
2022/11/06 00:56:55 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate partition name d20221106
2022/11/06 00:56:55 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_process.php[146]:syslog_partition_manage(), /plugins/syslog/functions.php[172]:syslog_partition_create(), /plugins/syslog/functions.php[208]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[272]:db_execute_prepared())
2022/11/06 00:56:55 - CMDPHP ERROR: A DB Exec Failed!, Error: VALUES LESS THAN value must be strictly increasing for each partition
2022/11/06 00:56:10 - CMDPHP SQL Backtrace: (/plugins/syslog/syslog_process.php[146]:syslog_partition_manage(), /plugins/syslog/functions.php[177]:syslog_partition_create(), /plugins/syslog/functions.php[208]:syslog_db_execute(), /plugins/syslog/database.php[69]:db_execute(), /lib/database.php[272]:db_execute_prepared())
2022/11/06 00:56:10 - CMDPHP ERROR: A DB Exec Failed!, Error: Duplicate partition name d20221106

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@bmfmancini bmfmancini marked this pull request as ready for review January 2, 2026 15:55
Co-authored-by: bmfmancini <13388748+bmfmancini@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix duplicate partition name errors in Cacti Fix duplicate partition errors caused by hardcoded table names Jan 2, 2026
Copilot AI requested a review from bmfmancini January 2, 2026 16:00
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.

[4.0] - Duplicate Partition name errors

2 participants