storage: don't panic on unknown (batch) request#21466
Conversation
|
NB: I'm planning to cherry-pick this to v1.1., though I can be convinced otherwise. |
|
I'm -1 on cherry-picking to 1.1. If we make sure we have migrations for everything in 2.0, it's unnecessary. We currently allow upgrading from any 1.1.x release to 2.0.y; I'd rather not introduce a requirement that the cluster be upgraded to at least 1.1.5 before 2.0 unless we have to. Reviewed 4 of 4 files at r1. pkg/acceptance/version_upgrade_test.go, line 70 at r1 (raw file):
So the idea behind this block is that the first new command in 2.1 should uncomment the ba.Add line with the new command to provide a test that it doesn't crash the old node? pkg/server/node.go, line 835 at r1 (raw file):
I think it would be best if this was a roachpb.Error so we can cleanly catch it on the client side (for example with RecomputeStats, we could simply fail silently whenever we get the old-version error) Comments from Reviewable |
When a new BatchRequest type is introduced, we have to be careful to not send it to older versions of CockroachDB because the new request will simply be dropped when unmarshaling the proto. This leads to a `ba.Requests` slice containing zero values, which leads to panics. This commit adds a guard against unknown requests into `(*Node).Batch` so that beginning in v2.0, it is less dramatic to forget the correct cluster migration which gates use of new request types properly. (I am not suggesting leaving out these migrations when this commit has matured). See: cockroachdb#21345 (comment). Release note: None
|
Agreed. I was suggesting the cherry-pick mostly to be able to cash in on the Review status: 0 of 6 files reviewed at latest revision, 2 unresolved discussions. pkg/server/node.go, line 835 at r1 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Good idea, done. pkg/acceptance/version_upgrade_test.go, line 70 at r1 (raw file): Previously, bdarnell (Ben Darnell) wrote…
Yeah. I removed this though, doesn't seem to add anything given TestNodeSendUnknownBatchRequest. Comments from Reviewable |
|
LGTM Review status: 0 of 6 files reviewed at latest revision, 2 unresolved discussions, some commit checks pending. Comments from Reviewable |
When a new BatchRequest type is introduced, we have to be careful to
not send it to older versions of CockroachDB because the new request
will simply be dropped when unmarshaling the proto. This leads to a
ba.Requestsslice containing zero values, which leads to panics.This commit adds a guard against unknown requests into
(*Node).Batchso that beginning in v2.0, it is less dramatic to forget the correct
cluster migration which gates use of new request types properly.
(I am not suggesting leaving out these migrations when this commit
has matured).
See:
#21345 (comment).
Release note: None