store: tell a missing workload by its gRPC NotFound code - #142
Merged
Merged
Conversation
WorkloadExists string-matched core's error text (bad `Count` value / workload not exists). core now answers GetWorkload for a missing workload with codes.NotFound (projecteru2/core#757), so the check reads the status code; any other code, including the old per-RPC 1051, stays an error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WorkloadExistsdecided that a workload was gone by string-matching core's error text: eitherbad \Count` value, entity count invalidorworkload not exists`. Both strings are implementation details, and the first one disappeared in projecteru2/core#756.With projecteru2/core#757, core answers
GetWorkloadfor a missing workload with the standardcodes.NotFound. This PR switches the check to that code.workloadLookupResult(err):nilmeans the workload exists.codes.NotFoundmeans it is gone.coretypesimport is gone.google.golang.org/grpcbecomes a direct requirement at the same version (v1.83.2).TestWorkloadLookupResultcovers found, NotFound, the legacy per-RPC code and a transport error.Deploy order. Upgrade core to a release that contains #757 before this agent. Against an older core, a missing workload comes back as code 1051. The agent then reports an error instead of "gone". The monitor treats that as not confirmed and leaves the workload alone (
monitor.go:ownErr == nil && !owned), which is the safe side.Gates (
GOWORK=off)make fmt-check: passes.make lint: 0 issues on linux and darwin.asl: clean on linux and darwin.make test,make build: pass.