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

kv: stop sending InitPut, replace with CPut #88519

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nvanbenschoten
Copy link
Member

First half of #71074.

This commit replaces all client-side use of InitPut request with the equivalent use of CPut. It uses the following equivalence to perform this mapping:

InitPut(key, value) -> CPutAllowingIfNotExists(key, value, value)

A future change in v23.2 (or do we now allow skipping one major version?) can remove the server-side handling of InitPut and remove the proto message entirely, once we no longer need to ensure mixed-version compatibility with v22.2.

This is primarily a clean-up that reduces the KV API surface area. However, it's also a useful simplification for #72614.

Release justification: None.

Release note: None.

@nvanbenschoten nvanbenschoten requested a review from a team as a code owner September 22, 2022 22:03
@nvanbenschoten nvanbenschoten requested a review from a team September 22, 2022 22:03
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner September 22, 2022 22:03
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/deleteInitPut branch from faa1492 to 394c2aa Compare September 22, 2022 23:30
First half of cockroachdb#71074.

This commit replaces all client-side use of InitPut request with the
equivalent use of CPut. It uses the following equivalence to perform
this mapping:
```
InitPut(key, value) -> CPutAllowingIfNotExists(key, value, value)
```

A future change in v23.2 (or do we now allow skipping one major
version?) can remove the server-side handling of InitPut and remove the
proto message entirely, once we no longer need to ensure mixed-version
compatibility with v22.2.

This is primarily a clean-up that reduces the KV API surface area.
However, it's also a useful simplification for cockroachdb#72614.

Release justification: None.

Release note: None.
@nvanbenschoten nvanbenschoten force-pushed the nvanbenschoten/deleteInitPut branch from 394c2aa to f7f014d Compare September 23, 2022 03:29
Copy link
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Will defer to the others on caller migrations.

@dt
Copy link
Member

dt commented Apr 25, 2023

Is this abandoned?

@nvanbenschoten
Copy link
Member Author

It's stale, but I'm happy to rebase it. Just needed a reviewer for the caller changes.

Copy link
Contributor

@chengxiong-ruan chengxiong-ruan left a comment

Choose a reason for hiding this comment

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

LGTM! from schema

Copy link
Collaborator

@mgartner mgartner left a comment

Choose a reason for hiding this comment

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

LGTM, just a few questions.

@@ -69,7 +70,11 @@ func CreateSystemTableInTxn(
b.CPut(tKey, desc.GetID(), nil)
b.CPut(catalogkeys.MakeDescMetadataKey(codec, desc.GetID()), desc.DescriptorProto(), nil)
if desc.IsSequence() {
b.InitPut(codec.SequenceKey(uint32(desc.GetID())), desc.GetSequenceOpts().Start, false /* failOnTombstones */)
// TODO DURING REVIEW: @ajwerner, why was this an InitPut instead of a
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does anyone on @cockroachdb/sql-schema have ideas about this?

// NOTE: InitPutRequest is now deprecated and should no longer be used. See
// #71074. The request type still exists for compatibility with v22.2 and
// earlier releases. The server-side handling code can be deleted once
// compatibility with v22.2 is no longer needed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I think the "v22.2" references here should now be "v23.1".

@@ -222,24 +222,24 @@ query T kvtrace
INSERT INTO t VALUES (5, 4, 'bar')
----
CPut /Table/112/1/5/0 -> /TUPLE/2:2:Int/4/1:3:Bytes/bar
InitPut /Table/112/2/4/5/0 -> /BYTES/
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not obvious to me why these were InitPuts in the first place - these secondary index keys should not already exist. Was there a performance benefit to only using CPut for the primary index to catch conflicts? Does the same benefit still exist for CPut vs CPutAllowingIfNotExists? If so, should we differentiate between the two types of CPuts int traces like this? And if there is no benefit toCPut over CPutAllowingIfNotExists, should we convert these secondary index puts into CPuts?

@michae2
Copy link
Collaborator

michae2 commented Jan 10, 2025

This PR was superseded by #138707.

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.

7 participants