Skip to content

Commit

Permalink
Merge pull request #5318 from onflow/petera/script-exec-failover-always
Browse files Browse the repository at this point in the history
[Access] Always failover to EN on script exec err - v0.32
  • Loading branch information
peterargue authored Jan 30, 2024
2 parents ed7eec5 + 289cd3c commit a8bc12d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion engine/access/rpc/backend/backend_scripts.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ func (b *backendScripts) executeScript(

case IndexQueryModeFailover:
localResult, localDuration, localErr := b.executeScriptLocally(ctx, scriptRequest)
if localErr == nil || isInvalidArgumentError(localErr) || status.Code(localErr) == codes.Canceled {
// Note: temporarily ignoring error types and falling back to ENs for ALL errors
// This should only fallback for non-cadence errors, but on v0.32, some errors are hidden
// within a cadence runtime error, resulting in the incorrect error type being returned.
if localErr == nil || status.Code(localErr) == codes.Canceled {
return localResult, localErr
}
// Note: scripts that timeout are retried on the execution nodes since ANs may have performance
Expand Down
9 changes: 5 additions & 4 deletions engine/access/rpc/backend/backend_scripts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,11 @@ func (s *BackendScriptsSuite) TestExecuteScriptWithFailover_SkippedForCorrectCod
err error
statusCode codes.Code
}{
{
err: cadenceErr,
statusCode: codes.InvalidArgument,
},
// Skipping failover for InvalidArgument temporarily disabled
// {
// err: cadenceErr,
// statusCode: codes.InvalidArgument,
// },
{
err: ctxCancelErr,
statusCode: codes.Canceled,
Expand Down

0 comments on commit a8bc12d

Please sign in to comment.