-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Open
Labels
A-cc-enablementPertains to current CC production issues or short-term projectsPertains to current CC production issues or short-term projectsA-error-handlingError messages, error propagations/annotationsError messages, error propagations/annotationsA-kv-serverRelating to the KV-level RPC serverRelating to the KV-level RPC serverA-server-networkingPertains to network addressing,routing,initializationPertains to network addressing,routing,initializationC-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.T-kvKV TeamKV TeamT-server-and-securityDB Server & SecurityDB Server & Security
Description
We currently have code in CRDB that looks like the following:
Lines 356 to 364 in 9ba4404
// Are we trying to re-initialize an initialized cluster? | |
if strings.Contains(err.Error(), server.ErrClusterInitialized.Error()) { | |
// We really want to use errors.Is() here but this would require | |
// error serialization support in gRPC. | |
// This is not yet performed in CockroachDB even though the error | |
// library now has infrastructure to do so, see: | |
// https://github.com/cockroachdb/errors/pull/14 | |
return server.ErrClusterInitialized | |
} |
We're essentially string matching on the specific error and using that in our control flow; it makes for fragile code. As of cockroachdb/errors#14, our errors package now has the infrastructure to support error serialization in gRPC. It'd be nice to implement it and start promoting this errors.Is(...)
usage pattern across RPC boundaries, in the same way we do for "local" errors.
Jira issue: CRDB-2971
Metadata
Metadata
Assignees
Labels
A-cc-enablementPertains to current CC production issues or short-term projectsPertains to current CC production issues or short-term projectsA-error-handlingError messages, error propagations/annotationsError messages, error propagations/annotationsA-kv-serverRelating to the KV-level RPC serverRelating to the KV-level RPC serverA-server-networkingPertains to network addressing,routing,initializationPertains to network addressing,routing,initializationC-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.Tech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.T-kvKV TeamKV TeamT-server-and-securityDB Server & SecurityDB Server & Security