Skip to content

[stable33] fix(Database): Use real idle-timer to prevent lastInsertId being reset on MariaDB/MySQL - #62713

Merged
AndyScherzinger merged 2 commits into
stable33from
backport/62697/stable33
Sep 2, 2026
Merged

[stable33] fix(Database): Use real idle-timer to prevent lastInsertId being reset on MariaDB/MySQL#62713
AndyScherzinger merged 2 commits into
stable33from
backport/62697/stable33

Conversation

@backportbot

@backportbot backportbot Bot commented Jul 30, 2026

Copy link
Copy Markdown

Backport of #62697

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot backportbot Bot added bug 3. to review Waiting for reviews tests Related to tests CI feature: database Database related DB AI assisted labels Jul 30, 2026
@backportbot backportbot Bot added this to the Nextcloud 33.0.8 milestone Jul 30, 2026
…set on MariaDB/MySQL

The previous implementation of the idle timer runs on a strict 30 second interval and sends a dummy `SELECT` statement to keep the connection open.

This generates issues with the `lastInsertId` on long-running tasks (like our CI pipeline), as the MariaDB documentation clearly states:

> If the last query wasn't an INSERT or UPDATE statement or if the modified table does not have a column with the AUTO_INCREMENT attribute and LAST_INSERT_ID was not used, this function will return zero.

Source: https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_insert_id

To mitigate that, this commit now uses a real idle-timer per connection instead.

Assisted-by: ClaudeCode:claude-fable-5
Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
@CarlSchwan
CarlSchwan force-pushed the backport/62697/stable33 branch from 3158966 to fbf7c77 Compare August 5, 2026 16:13
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan
CarlSchwan force-pushed the backport/62697/stable33 branch from fbf7c77 to 04c72dc Compare August 6, 2026 10:02
@CarlSchwan
CarlSchwan marked this pull request as ready for review August 6, 2026 10:07
@CarlSchwan
CarlSchwan requested a review from a team as a code owner August 6, 2026 10:07
@CarlSchwan
CarlSchwan requested review from Altahrim, leftybournes and salmart-dev and removed request for a team August 6, 2026 10:07
@DerDreschner

Copy link
Copy Markdown
Contributor

The failing tests are unrelated to my changes.

@joshtrichards joshtrichards added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 30, 2026
@AndyScherzinger
AndyScherzinger merged commit cff4608 into stable33 Sep 2, 2026
200 of 230 checks passed
@AndyScherzinger
AndyScherzinger deleted the backport/62697/stable33 branch September 2, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish AI assisted bug CI feature: database Database related DB tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants