oxidecomputer / oxidecomputer/omicron

Avoid transaction when setting a new primary network interface

Open
#1,204 0 comments 0 reactions 1 assignee View on GitHub

@bnaecker is already working on this.

Since Jun 13, 2022.

database networking
Dominant language
Rust
Stars
572
Forks
97
Avg merge
2d 12h
Merged PRs (30d)
96

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.