Closed Bug 759038 Opened 12 years ago Closed 12 years ago

retry the query when the connection is invalidated

Categories

(Cloud Services Graveyard :: Server: Sync, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: rfkelly, Assigned: rfkelly)

Details

(Whiteboard: [qa+])

Attachments

(3 files)

SyncServer and AITC should re-try the query if they receive a disconnection error from the database.

This basically extends the functionality from Bug 692789 so that it covers more types of error, including (2006, "MySQL server has gone away") and (2013, "Lost connection to MySQL server during query).  The error codes that SQLAlchemy currently identifies as "connection_invalidated" for MySQL are (2006, 2013, 2014, 2045, 2055).

I'm attaching patches for both sync1.1/server-core, which has Bug 692789 in production but not on tip, and for sync2.0/AITC which did not include this fix when they were ported to pyramid.
Attachment #627621 - Flags: review?(telliott)
Attachment #627621 - Flags: feedback?(rsoderberg)
Assignee: nobody → rfkelly
Wow, that's a big list of invalidated.

Does this retry *once*, or *more than once*, before stack tracing and 50x'ing the user request?  It's important that it be once, only.
(In reply to Richard Soderberg [:atoll] from comment #2)
> Does this retry *once*, or *more than once*, before stack tracing and
> 50x'ing the user request?  It's important that it be once, only.

Each incoming request will attempt to execute a query, retry it once if that fails, then error out with a 50x if that fails a second time.
Okay. Seems reasonable to me. I don't suppose it's possible to prepend "/* retried */" so we can see them in the process list? But that's not a requirement, just a wishful.
Whiteboard: [qa+]
Attachment #627622 - Flags: review?(telliott)
Attachment #627622 - Flags: review?(telliott) → review+
Attachment #627621 - Flags: review?(telliott) → review+
During loadtesting of AITC I discovered a problem with the previous patch - TimeoutError does not have a "connection_invalidated" attribute.  The attached fix restricts the innermost try-except to catch only those exceptions that have such an attribute.
Attachment #629043 - Flags: review?(telliott)
Attachment #629043 - Flags: review?(telliott) → review+
Attachment #627621 - Flags: feedback?(rsoderberg)
Looks like this needs to be verified for Sync 1.1, 2.0, and AITC.
Product: Cloud Services → Cloud Services Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: