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

lease: unredact lease struct #138800

Merged
merged 1 commit into from
Jan 27, 2025
Merged

Conversation

aa-joshi
Copy link
Contributor

Previously, ID from lease was getting redacted in logs. This was creating challenge to support team to debug issues. This change makes sure that SafeFormat is getting invoked during logging.

Epic: CRDB-37533
Part of: CRDB-44885
Release note: None

@aa-joshi aa-joshi added backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3 labels Jan 10, 2025
@aa-joshi aa-joshi requested review from a team and removed request for a team January 10, 2025 06:16
@aa-joshi aa-joshi requested a review from a team as a code owner January 10, 2025 06:16
@aa-joshi aa-joshi requested a review from arjunmahishi January 10, 2025 06:16
Copy link

blathers-crl bot commented Jan 10, 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

@arjunmahishi arjunmahishi left a comment

Choose a reason for hiding this comment

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

Oh nice find!

Copy link
Collaborator

@rafiss rafiss 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 @aa-joshi)


pkg/sql/catalog/lease/descriptor_version_state.go line 39 at r1 (raw file):

// SafeFormat implements redact.SafeFormatter.
func (s storedLease) SafeFormat(w redact.SafePrinter, _ rune) {

could you say more about how this fixes it? i did a quick search in the code, and we seem to use the pointer type mostly. also i see above that the String() method uses a pointer receiver.

Copy link
Contributor Author

@aa-joshi aa-joshi 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 @rafiss)


pkg/sql/catalog/lease/descriptor_version_state.go line 39 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

could you say more about how this fixes it? i did a quick search in the code, and we seem to use the pointer type mostly. also i see above that the String() method uses a pointer receiver.

When we are printing the arguments, we are validating the SafeFormat method on object type. Previously, it couldn't find the method. Hence it was getting redacted.

Copy link
Collaborator

@rafiss rafiss 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 @aa-joshi)


pkg/sql/catalog/lease/descriptor_version_state.go line 39 at r1 (raw file):

Previously, aa-joshi (Akshay Joshi) wrote…

When we are printing the arguments, we are validating the SafeFormat method on object type. Previously, it couldn't find the method. Hence it was getting redacted.

Right, but what I am saying is that in all the code I have found, we use the type *storedLease. Can you link me to an area of the code that uses the type storedLease?

Copy link
Contributor Author

@aa-joshi aa-joshi 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 @rafiss)


pkg/sql/catalog/lease/descriptor_version_state.go line 39 at r1 (raw file):

Previously, rafiss (Rafi Shamim) wrote…

Right, but what I am saying is that in all the code I have found, we use the type *storedLease. Can you link me to an area of the code that uses the type storedLease?

Apologies, I misunderstood. Here it is:

log.Infof(ctx, "released orphaned lease: %+v", lease)

It was flagged by support team as overly redacted info.

Previously, ID from lease was getting redacted in logs. This was creating
challenge to support team to debug issues. This change makes sure that
SafeFormat is getting invoked during logging.

Epic: CRDB-37533
Part of: CRDB-44885
Release note: None
Copy link
Contributor Author

@aa-joshi aa-joshi 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 @rafiss)


pkg/sql/catalog/lease/descriptor_version_state.go line 39 at r1 (raw file):

Previously, aa-joshi (Akshay Joshi) wrote…

Apologies, I misunderstood. Here it is:

log.Infof(ctx, "released orphaned lease: %+v", lease)

It was flagged by support team as overly redacted info.

I have updated to pointer as it makes more sense to have it as pointer.

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

nice find!

would we want to backport this change? seems like it might help with supportability.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@aa-joshi
Copy link
Contributor Author

TFTR!
bors r+

@craig craig bot merged commit e8189e1 into cockroachdb:master Jan 27, 2025
22 checks passed
Copy link

blathers-crl bot commented Jan 27, 2025

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error creating merge commit from 019a20f to blathers/backport-release-23.2-138800: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict []

you may need to manually resolve merge conflicts with the backport tool.

Backport to branch 23.2.x failed. See errors above.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-23.2.x Flags PRs that need to be backported to 23.2. backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants