Skip to content

kvserver: use messages on NotLeaseholderErrors everywhere#56334

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
andreimatei:nlhe-msg
Nov 12, 2020
Merged

kvserver: use messages on NotLeaseholderErrors everywhere#56334
craig[bot] merged 1 commit intocockroachdb:masterfrom
andreimatei:nlhe-msg

Conversation

@andreimatei
Copy link
Copy Markdown
Contributor

NLHE permits custom messages in it, but the field was rarely used. This
patch makes every instance where we instantiate the error provide a
message, since this error comes from a wide variety of conditions.

Release note: None

@andreimatei andreimatei requested a review from nvb November 5, 2020 18:54
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@nvb nvb left a comment

Choose a reason for hiding this comment

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

:lgtm_strong:

Reviewed 4 of 4 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei)


pkg/kv/kvserver/replica_application_result.go, line 217 at r1 (raw file):

			r.store.StoreID(),
			r.mu.state.Desc,
			"request's timestamp below closed timestamp",

Aren't we setting this two lines down? Maybe just move that message (which is a little better) in here?


pkg/kv/kvserver/replica_range_lease.go, line 1101 at r1 (raw file):

					log.VErrEventf(ctx, 2, "lease acquisition failed: %s", ctx.Err())
					return roachpb.NewError(newNotLeaseHolderError(nil, r.store.StoreID(), r.Desc(),
						"lease acquisition canceled"))

maybe add "because context canceled" to differentiate with next message.


pkg/kv/kvserver/replica_range_lease.go, line 1105 at r1 (raw file):

					llHandle.Cancel()
					return roachpb.NewError(newNotLeaseHolderError(nil, r.store.StoreID(), r.Desc(),
						"lease acquisition cancled because node is stopping"))

canceled

NLHE permits custom messages in it, but the field was rarely used. This
patch makes every instance where we instantiate the error provide a
message, since this error comes from a wide variety of conditions.

Release note: None
Copy link
Copy Markdown
Contributor Author

@andreimatei andreimatei 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! 1 of 0 LGTMs obtained


pkg/kv/kvserver/replica_application_result.go, line 217 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

Aren't we setting this two lines down? Maybe just move that message (which is a little better) in here?

done


pkg/kv/kvserver/replica_range_lease.go, line 1101 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

maybe add "because context canceled" to differentiate with next message.

done


pkg/kv/kvserver/replica_range_lease.go, line 1105 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

canceled

done

Copy link
Copy Markdown
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

bors r+

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

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 12, 2020

This PR was included in a batch that was canceled, it will be automatically retried

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 12, 2020

Build succeeded:

@craig craig bot merged commit a5e67b6 into cockroachdb:master Nov 12, 2020
@andreimatei andreimatei deleted the nlhe-msg branch December 16, 2021 19:34
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.

3 participants