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

Record Crucible region ports in CRDB #5955

Merged
merged 12 commits into from
Jul 4, 2024

Conversation

jmpesp
Copy link
Contributor

@jmpesp jmpesp commented Jun 26, 2024

It was a mistake not to record the port that an Agent assigns a Region when it's created, and this PR rectifies that: ports are recorded when regions are ensured, and a background task will scan for regions that are missing a port, and attempt to contact the appropriate Agent in order to fill that in.

Fixes #5846

It was a mistake not to record the port that an Agent assigns a Region
when it's created, and this PR rectifies that: ports are recorded when
regions are ensured, and a background task will scan for regions that
are missing a port, and attempt to contact the appropriate Agent in
order to fill that in.

Fixes oxidecomputer#5846
@jmpesp jmpesp requested a review from smklein June 26, 2024 02:05
nexus-config/src/nexus_config.rs Show resolved Hide resolved
nexus/src/app/background/lookup_region_port.rs Outdated Show resolved Hide resolved
nexus/src/app/crucible.rs Outdated Show resolved Hide resolved
nexus/src/app/crucible.rs Outdated Show resolved Hide resolved
)
let maybe_addr = osagactx
.nexus()
.region_addr(log, params.request.old_region_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is calling the function defined in nexus/src/app/crucible.rs, which tries to access the port and set if if we don't have the value, right?

If this is already doing the work of contacting the agent and back-filling the port, why are we bothering to handle the match maybe_addr => None case below? Isn't that redundant with the work in nexus/src/app/crucible.rs's region_addr function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for region replacement to continue even if the agent is gone, this saga node makes the assumption that if there's a unique target with the dataset's address in the region set, then that's the region's port. It's not redundant in that there's an assumption made, not a lookup.

However, if it's good enough to make this assumption for region replacement, the question then becomes: if there is only one target using the dataset's address, should that target's port be recorded in the database as this region's port? I'm thinking yes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, the structure makes more sense to me. It's basically:

  • Backfill the port info if we can
  • If we can't, at least confirm that the address is known to be unique
  • If we can't do that, bail

nexus/src/app/crucible.rs Outdated Show resolved Hide resolved
)
let maybe_addr = osagactx
.nexus()
.region_addr(log, params.request.old_region_id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, the structure makes more sense to me. It's basically:

  • Backfill the port info if we can
  • If we can't, at least confirm that the address is known to be unique
  • If we can't do that, bail

Copy link
Collaborator

@smklein smklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jmpesp jmpesp enabled auto-merge (squash) June 28, 2024 20:32
@jmpesp jmpesp merged commit bb083ae into oxidecomputer:main Jul 4, 2024
14 checks passed
@jmpesp jmpesp deleted the record_region_ports branch July 5, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Record the port returned when creating a Region
2 participants