Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap errors happening during PRS in a new vterrors code #17669

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

frouioui
Copy link
Member

@frouioui frouioui commented Jan 30, 2025

Description

This Pull Request adds a new vterrors code (VT15001) that will wrap the common errors found in the situation described by #17668.

The errors listed in #17668 now look like this:

target: ks.0.primary: vttablet: rpc error: code = FailedPrecondition desc = VT15001: session invalidated: close/reopen connection if applicable: wrong tablet type: PRIMARY, want: REPLICA or [] (errno 1105) (sqlstate HY000) during query: insert into vt_insert_test(id, msg) values (162, 'test 162')
target: ks.0.primary: VT15001: session invalidated: close/reopen connection if applicable: vttablet: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:7108: connect: connection refused" (errno 1105) (sqlstate HY000) during query: insert into vt_insert_test(id, msg) values (650, 'test 650')
target: ks.0.primary: VT15001: session invalidated: close/reopen connection if applicable: tablet: cell:"zone1" uid:101 is either down or nonexistent (errno 1105) (sqlstate HY000) during query: insert into vt_insert_test(id, msg) values (1029, 'test 1029')

Related Issue(s)

Copy link
Contributor

vitess-bot bot commented Jan 30, 2025

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Jan 30, 2025
@frouioui frouioui changed the title Wrap errors happening during PRS in a new vterrors error Wrap errors happening during PRS in a new vterrors code Jan 30, 2025
@frouioui frouioui added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: Query Serving and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Jan 30, 2025
@github-actions github-actions bot added this to the v22.0.0 milestone Jan 30, 2025
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 48.48485% with 17 lines in your changes missing coverage. Please review.

Project coverage is 67.74%. Comparing base (770dcf0) to head (a41541a).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vterrors/vterrorsgen/main.go 0.00% 10 Missing ⚠️
go/vt/vttablet/grpctabletconn/conn.go 50.00% 4 Missing ⚠️
go/vt/vtgate/executorcontext/vcursor_impl.go 0.00% 2 Missing ⚠️
go/vt/discovery/healthcheck.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17669      +/-   ##
==========================================
- Coverage   67.75%   67.74%   -0.02%     
==========================================
  Files        1587     1587              
  Lines      255778   255808      +30     
==========================================
- Hits       173309   173287      -22     
- Misses      82469    82521      +52     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -120,6 +120,8 @@ var (
VT14004 = errorWithoutState("VT14004", vtrpcpb.Code_UNAVAILABLE, "cannot find keyspace for: %s", "The specified keyspace could not be found.")
VT14005 = errorWithoutState("VT14005", vtrpcpb.Code_UNAVAILABLE, "cannot lookup sidecar database for keyspace: %s", "Failed to read sidecar database identifier.")

VT15001 = errorWithNoCode("VT15001", "session invalidated: close/reopen connection if applicable: %s", "This error means that the opened transaction should be closed by the application and re-opened.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"session invalidated" may be misleading

  • if you are in a transaction, that needs to be closed, and a new transaction opened.
  • if you are not in a transaction, a retry is probably what you need to do.
    @harshit-gangal wdyt?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the transaction which no longer exists. They can continue to use the same connection.
"rollback", followed by a retry is fine.
outside of transaction, retry is enough as Deepthi pointed.
All 3 error message should have different error code as they happen at different point in time of PRS/ERS

@deepthi
Copy link
Member

deepthi commented Jan 31, 2025

Notes from further offline discussion:

  • In order to close the transaction, you have to issue a COMMIT or a ROLLBACK from the client. Because the vtgate-level transaction is effectively pinned to the primary tablets of participating shards, these will also produce errors
  • An idea to mitigate these is for us to close the transaction at the vtgate level so that the ROLLBACK becomes a no-op instead of resulting in an error.

We need to spend some more time exploring these options.

@frouioui frouioui marked this pull request as draft January 31, 2025 22:15
Signed-off-by: Florent Poinsard <[email protected]>
Signed-off-by: Florent Poinsard <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Query Serving Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable applications to detect stalled connections during PRS
3 participants