Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read-write autocommit transactions not possible after read-only transaction with postgres #324

Closed
mstilkerich opened this issue Nov 29, 2020 · 0 comments
Assignees
Labels
Milestone

Comments

@mstilkerich
Copy link
Owner

When executing a read-only transaction with postgres DB, it is afterwards not possible to do implicit (autocommit) read-write transaction anymore within the same DB session. The reason is that RCMCardDAV sets the transaction properties for the duration of the session in startTransaction, but for autocommit transactions this function is not used and thus the previously set transaction characteristics apply to autocommit transactions. If the last explicit transaction was a read-only transaction, this will cause following autocommit transactions to fail.

Currently, read-only transactions are used during the following operations:

  • Delete a contact
  • Add a contact to a group
  • Remove from group

Each of these operations is ended by a resync operation, that syncs back the changes from the server and will have its operations to the database fail. The result is that the resync operation fails and the changes are not visible in the local database. The data will be fixed during the next sync, but until then the old state will be visible in roundcube.

If the user tries the operation again because they see the change did not happen, it will fail:

  • In case of delete operations, the URI is not existent on the server anymore and will therefore trigger an error
  • In case of attempting to change a VCard, there will be an ETag mismatch, so the update will not be updated again.

To fix, reset the transaction settings to default in endTransaction and rollbackTransaction.

MySQL is not affected because the used statement only affects the individual transaction that is started, not the following ones. SQLite is not affected because we don't require any special transaction settings with it.

@mstilkerich mstilkerich self-assigned this Nov 29, 2020
@mstilkerich mstilkerich added this to the 4.1.0 milestone Nov 29, 2020
mstilkerich added a commit that referenced this issue Nov 29, 2020
mstilkerich added a commit that referenced this issue Nov 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant