Skip to content

kvserver: improve logs during adminScatter #147359

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

wenyihu6
Copy link
Contributor

@wenyihu6 wenyihu6 commented May 27, 2025

Previously, the logs in adminScatter included the message "failed to scatter",
which could be misleading, as these are not always true failures and depend on
context. For example, hitting a terminating error during a retry after
rebalancing the leaseholder away doesn’t necessarily indicate a failure without
further assessment. This patch updates the log message to avoid confusion for
users searching in logs. In addition, it also changes the logging call from
log.Eventf to log.Infof, since Eventf was a mistake and not included in logs
by default.

Epic: none
Release note: none

Copy link

blathers-crl bot commented May 27, 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

@wenyihu6 wenyihu6 changed the title betterlogs kvserver: improve logs during adminScatter May 27, 2025
@wenyihu6 wenyihu6 marked this pull request as ready for review May 28, 2025 15:53
@wenyihu6 wenyihu6 requested a review from a team as a code owner May 28, 2025 15:53
@wenyihu6 wenyihu6 requested a review from kvoli May 28, 2025 15:53
Copy link
Contributor

@kvoli kvoli left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @wenyihu6)


pkg/kv/kvserver/replica_command.go line 4223 at r1 (raw file):

			// The replica can not be processed, so skip it.
			log.Warningf(ctx,
				"cannot process range (%v) due to %v at %dth attempt",

nit: the dth attempt here and below will be odd to read for attempts < 4 (1th/2th/3th). Consider reformatting.

Previously, the logs in adminScatter included the message "failed to scatter",
which could be misleading, as these are not always true failures and depend on
context. For example, hitting a terminating error during a retry after
rebalancing the leaseholder away doesn’t necessarily indicate a failure without
further assessment. This patch updates the log message to avoid confusion for
users searching in logs. In addition, it also changes the logging call from
log.Eventf to log.Infof, since Eventf was a mistake and not included in logs
by default.

Epic: none
Release note: none
Copy link
Contributor Author

@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 (and 1 stale) (waiting on @kvoli)


pkg/kv/kvserver/replica_command.go line 4223 at r1 (raw file):

Previously, kvoli (Austen) wrote…

nit: the dth attempt here and below will be odd to read for attempts < 4 (1th/2th/3th). Consider reformatting.

Done.

Copy link
Contributor

@kvoli kvoli left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @wenyihu6)

@wenyihu6
Copy link
Contributor Author

TFTR!

bors r=kvoli

@craig
Copy link
Contributor

craig bot commented May 28, 2025

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