v2.1: [rpc] Fatal getSignaturesForAddress()
when Bigtable errors (backport of #3700)
#4443
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.
Problem
Consider a request to
getSignaturesForAddress()
. Imagine that there are no signatures in blockstore, but there are signatures in long-term storage (ie. Bigtable).Currently, if we fail to reach Bigtable – because of a timeout or a connection failure – we return whatever signatures we have. This means that people who query the RPC can't distinguish between the following cases:
Summary of Changes
get_confirmed_signatures_for_address
and thebefore
/until
can't be found, throw aSignatureNotFound
error instead ofRowNotFound
.SignatureNotFound
errors – return a JSON-RPC error in the event that long-term storage errors out.Test Plan
With the Bigtable emulator
Fetching a signature for an address that does not exist locally
Observe that the RPC goes out to Bigtable and fetches successfully (finds nothing)
Fetching a signature for an address and before signature that don't exist locally
Observe that Bigtable can't find the before signature, but doesn't fatal the request
Fetching a signature for an address that is completely available locally
Observe Bigtable is never contacted.
Fetching a signature for an address that does exist but with a bad
before
signatureObserve that Bigtable can't find the before signature, but doesn't fatal the request
Fetching a signature before the last signature, forcing the RPC to go to Bigtable where there is no data
Observe that the RPC goes out to Bigtable and fetches successfully (finds nothing)
With the Bigtable emulator shut down, simulating a connection failure
Fetching a signature for an address that does not exist locally
Fetching a signature for an address and before signature that don't exist locally
Observe that Bigtable experiences a connection error.
Fetching a signature for an address that is completely available locally
Observe Bigtable is never contacted.
Fetching a signature for an address that does exist but with a bad
before
signatureObserve that Bigtable experiences a connection error.
Fetching a signature before the last signature, forcing the RPC to go to Bigtable where there is no data
Observe that Bigtable experiences a connection error.
Fixes #3696
This is an automatic backport of pull request #3700 done by Mergify.