Skip to content

Conversation

@sumeerbhola
Copy link
Collaborator

  • subsumesChanges no longer needs the prev state as a parameter, since subsumption is only a function of the observed state and expected next state. The existing comparison with prev.IsLeaseholder was unnecessary and flawed.

  • Removed the todo around the panic in applyReplicaChange, since the expectation is that the range and store must exist. The callers are responsible for ensuring that. There was an old flawed idea that we would try to add the range at this point in the code, which we had long abandoned, but never removed from the code comment.

Epic: CRDB-55052

Release note: None

- subsumesChanges no longer needs the prev state as a parameter, since
  subsumption is only a function of the observed state and expected next
  state. The existing comparison with prev.IsLeaseholder was unnecessary
  and flawed.

- Removed the todo around the panic in applyReplicaChange, since the
  expectation is that the range and store must exist. The callers are
  responsible for ensuring that. There was an old flawed idea that we
  would try to add the range at this point in the code, which we had long
  abandoned, but never removed from the code comment.

Epic: CRDB-55052

Release note: None
@sumeerbhola sumeerbhola requested review from tbg and wenyihu6 November 17, 2025 18:55
@sumeerbhola sumeerbhola requested review from a team as code owners November 17, 2025 18:56
@blathers-crl
Copy link

blathers-crl bot commented Nov 17, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@wenyihu6 wenyihu6 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @tbg)


-- commits line 7 at r1:
Apologies if this was already mentioned in comments. I need to catch up on the previous PR to get the full context. What made this check flawed, and did something change recently that allows us to remove it now? Or was this something we could have safely skipped from the start?

Copy link
Collaborator Author

@sumeerbhola sumeerbhola left a comment

Choose a reason for hiding this comment

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

TFTR!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @tbg and @wenyihu6)


-- commits line 7 at r1:

Previously, wenyihu6 (Wenyi Hu) wrote…

Apologies if this was already mentioned in comments. I need to catch up on the previous PR to get the full context. What made this check flawed, and did something change recently that allows us to remove it now? Or was this something we could have safely skipped from the start?

Nothing changed recently to allow us to remove it. What changed is that we've properly documented what ReplicaChange represents. Specifically, the next field represents the expected final state. There was already some doubt about the comparison with prev that is in the TODO that is removed in this PR.

Copy link
Contributor

@wenyihu6 wenyihu6 left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @sumeerbhola and @tbg)


-- commits line 7 at r1:

Previously, sumeerbhola wrote…

Nothing changed recently to allow us to remove it. What changed is that we've properly documented what ReplicaChange represents. Specifically, the next field represents the expected final state. There was already some doubt about the comparison with prev that is in the TODO that is removed in this PR.

Ack.

@wenyihu6
Copy link
Contributor

bors r+

@craig
Copy link
Contributor

craig bot commented Nov 17, 2025

@craig craig bot merged commit e837db7 into cockroachdb:master Nov 17, 2025
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants