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

sql,kv: replace InitPuts with CPuts #137808

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yuzefovich
Copy link
Member

@yuzefovich yuzefovich commented Dec 20, 2024

sql: replace InitPut with CPut

CPut with empty expValue parameter is the same as InitPut (with failOnTombstones=false), so we replace the latter with the former throughout the code base. This paves the way to deprecating the InitPut request altogether.

kv: extend CPut with FailOnTombstones option

This commit extends the CPut command with FailOnTombstones option that we already have in the InitPut - it makes it so that the CPut fails with a ConditionFailedError if it encounters a tombstone. This begins the process of folding all usages of InitPuts into CPuts. (We actually have only one place where we use InitPuts with this flag set - in the sql liveness system which allows us to ensure that after a session is dead, it cannot be resurrected, which allows us to keep the dead session cache easily.)

InitPut request was introduced long time ago in 1a95630 when we considered extending CPut with a boolean for special tombstone handling too burdensome and ugly. Since then we have been extending the CPut with a few options, so adding an extra one doesn't seem like a big deal anymore. On the plus side, it removes the confusion that I personally had for why we used InitPut as opposed to CPut with nil expected value in a few places (all were removed in the previous commit).

The deprecation was alluded to during the review of #35157.

In terms of deprecating the InitPut altogether here is the expected timeline:

  • sometime after compatibility with 25.1 is no longer needed (so 25.3+), we will remove the last spot were we still issue InitPut in the sql liveness system
  • sometime after compatibilty with the version mentioned above (say 26.1+), we'll be able to remove all InitPut-related code.

TODO: can we do it faster?

Release note: None

Epic: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@yuzefovich yuzefovich force-pushed the init-put-removal branch 2 times, most recently from cb96693 to 17f610d Compare December 20, 2024 04:47
@yuzefovich yuzefovich changed the title WIP on extending CPut with FailOnTombstones sql,kv: replace InitPuts with CPuts Dec 20, 2024
CPut with empty `expValue` parameter is the same as InitPut (with
`failOnTombstones=false`), so we replace the latter with the former
throughout the code base. This paves the way to deprecating the InitPut
request altogether.

Release note: None
This commit extends the CPut command with FailOnTombstones option that
we already have in the InitPut - it makes it so that the CPut fails with
a ConditionFailedError if it encounters a tombstone. This begins the
process of folding all usages of InitPuts into CPuts. (We actually have
only one place where we use InitPuts with this flag set - in the sql
liveness system which allows us to ensure that after a session is dead,
it cannot be resurrected, which allows us to keep the dead session cache
easily.)

InitPut request was introduced long time ago in
1a95630 when we considered extending
CPut with a boolean for special tombstone handling too burdensome and
ugly. Since then we have been extending the CPut with a few options, so
adding an extra one doesn't seem like a big deal anymore. On the plus
side, it removes the confusion that I personally had for why we used
InitPut as opposed to CPut with nil expected value in a few places (all
were removed in the previous commit).

The deprecation was alluded to during the review of cockroachdb#35157.

In terms of deprecating the InitPut altogether here is the expected
timeline:
- sometime after compatibility with 25.1 is no longer needed (so 25.3+),
we will remove the last spot were we still issue InitPut in the sql
liveness system
- sometime after compatibilty with the version mentioned above (say
26.1+), we'll be able to remove all InitPut-related code.

Release note: None
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.

2 participants