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

Avoid transaction when setting a new primary network interface #1204

Open
bnaecker opened this issue Jun 13, 2022 · 0 comments
Open

Avoid transaction when setting a new primary network interface #1204

bnaecker opened this issue Jun 13, 2022 · 0 comments
Assignees
Labels
database Related to database access networking Related to the networking.

Comments

@bnaecker
Copy link
Collaborator

bnaecker commented Jun 13, 2022

The work in #1186 adds an API for modifying a network interface, including setting a new primary interface. The implementation there uses a transaction, since setting a primary involves modifying two rows (old / new primary) in slightly different ways.

It is possible to implement this in a single query, using two common table expressions that update each of these rows accordingly. However, doing that in the current version of CRDB yields the following error:

ERROR: multiple modification subqueries of the same table "network_interface" are not supported unless they all use INSERT without ON CONFLICT; this is to prevent data corruption, see documentation of sql.multiple_modifications_of_table.enabled

That's related to this bug, where multiple statements modifying the same row in a query cause data corruption. Now our query would modify two different rows, so we could reasonably expect that the bug itself wouldn't matter. However, even running the query relies on a cluster setting that we'd need to set.

This issue tracks updating the internals of this query, which we should wait to do until that CRDB bug is resolved. The basic outlines of the query can be found in this comment.

@bnaecker bnaecker self-assigned this Jun 13, 2022
@bnaecker bnaecker added networking Related to the networking. database Related to database access labels Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Related to database access networking Related to the networking.
Projects
None yet
Development

No branches or pull requests

1 participant