Skip to content

Conversation

@provokateurin
Copy link
Member

@provokateurin provokateurin commented Dec 9, 2025

oc_mounts no longer has a unique index since #32877, so the insertIfNotExist does not work properly and depends on consistent reads always getting the same data, which is not possible with READ_COMMITTED (https://dev.mysql.com/doc/refman/9.2/en/innodb-transaction-isolation-levels.html).

The proper fix is to add back the unique index, but with a hash of the mountpoint column (which was too long for the index and was the reason the unique index was removed). This type of workaround is already used for the share_external table.

All other insertIfNotExist in server are fine, because they operate on tables with a unique index.

@provokateurin provokateurin added this to the Nextcloud 33 milestone Dec 9, 2025
@provokateurin provokateurin requested a review from a team as a code owner December 9, 2025 09:59
@provokateurin provokateurin requested review from CarlSchwan, icewind1991, salmart-dev and yemkareems and removed request for a team December 9, 2025 09:59
@provokateurin provokateurin added bug 3. to review Waiting for reviews labels Dec 9, 2025
…olation

Signed-off-by: provokateurin <kate@provokateurin.de>
…AD before executing insertIfNotExist without unique index

Signed-off-by: provokateurin <kate@provokateurin.de>
@provokateurin provokateurin force-pushed the fix/UserMountCache/transaction-isolation-level branch from 6bd8f19 to 8fac473 Compare December 9, 2025 10:20
@SystemKeeper
Copy link
Contributor

Tested it locally like this:

  • Set a breakpoint at
    $this->connection->commit();
  • Truncate oc_mounts
  • Run occ files:mount:refresh admin with Xdebug (so it stops at the breakpoint above)
  • Run occ files:mount:refresh admin without Xdebug
  • Continue execution of the first occ command

Without this PR
The second command finishes before the execution of the first is continued, resulting in duplicated mounts

With this PR
The second command "hangs" and only finishes after the execution of the first one is continued. Resulting in non duplicated mounts.

@provokateurin provokateurin marked this pull request as draft December 9, 2025 12:22
@provokateurin
Copy link
Member Author

This can be used as a patch to mitigate the issue, but the real fix is still under development.

@provokateurin
Copy link
Member Author

Closing in favor of #56933

@provokateurin provokateurin deleted the fix/UserMountCache/transaction-isolation-level branch December 9, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants