:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(mysql): keep a mid-stream Vitess gRPC cancellation retryable (#106106)
Tom Owers16178198eb80
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.pyindex cf75f467a621..40e8fc2938c2 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/source.py@@ -448,6 +448,15 @@ class MySQLSource(SQLSource[MySQLSourceConfig], SSHTunnelMixin, ValidateDatabase# the rare case where it exhausts that budget so Temporal's own activity retry# can recover it rather than surfacing it as error-tracking noise."TiProxy fails to connect to TiDB",+ # Vitess/PlanetScale vtgate error 1105 raised while a streaming query is in flight:+ # vtgate's own gRPC client to the backend vttablet was already closing (a tablet+ # swap during a failover, reparent, or health-check-triggered pool recycle) when the+ # query's RPC was submitted. Same transient, self-healing class as `code = Unavailable`+ # and "reparent operation in progress" above, but hits mid-stream — a path with no+ # in-process retry wrapper of its own — so there's nothing to backstop; this entry is+ # the only classification. Match the stable gRPC-go message, excluding the volatile+ # keyspace/shard/tablet-type target prefix that precedes it.+ "grpc: the client connection is closing",}def reconcile_schema_metadata(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.pyindex d9dacb1ec752..a617893cc73a 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/tests/test_mysql.py@@ -2521,6 +2521,24 @@ class TestMySQLSourceNonRetryableErrors:is_retryable = any(pattern in error_msg for pattern in retryable)assert is_retryable, f"Vitess reparent error should be classified retryable: {error_msg}"+ @pytest.mark.parametrize(+ "error_msg",+ [+ "(1105, 'unknown: target: v2.-.replica: vttablet: rpc error: code = Canceled "+ "desc = grpc: the client connection is closing')",+ "grpc: the client connection is closing",+ ],+ )+ def test_vitess_grpc_client_connection_closing_is_classified_retryable(self, source, error_msg):+ # Hits mid-stream, when vtgate's gRPC client to the backend vttablet was already closing+ # (a tablet swap during a failover, reparent, or pool recycle) as the query's RPC was+ # submitted. Unlike the other Vitess 1105 cases, no in-process retry wraps the streaming+ # query, so without this classification `_handle_import_error` logs it at `exception` on+ # every occurrence, flooding error tracking with a self-recovering failover blip.+ retryable = source.get_retryable_errors()+ is_retryable = any(pattern in error_msg for pattern in retryable)+ assert is_retryable, f"Vitess gRPC client-connection-closing error should be classified retryable: {error_msg}"+class TestMySQLSourceValidateCredentials:@pytest.fixture