Skip to content

: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.

fix(mysql): exclude vitess sidecar schema from sync-all-databases discovery (#127249)

Tom Owersd8cd14dcc645
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/mysql.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/mysql.py
index d329766a17a3..e86bc4dccd35 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/mysql.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mysql/mysql.py
@@ -213,7 +213,17 @@ class MySQLUnavoidableFilesortError(Exception):
# config error.
_CANT_CONNECT_CODE = 2003
-_SYSTEM_SCHEMAS = ("information_schema", "mysql", "performance_schema", "sys")
+_SYSTEM_SCHEMAS = (
+ "information_schema",
+ "mysql",
+ "performance_schema",
+ "sys",
+ # Vitess's internal sidecar database (vreplication/schema-tracking metadata). It shows
+ # up in `information_schema` like any other schema, but VTGate doesn't expose it as a
+ # routable keyspace, so a sync-all-databases discovery that picks it up fails every
+ # streaming read against it with "unknown database '_vt' in vschema" (VT05003).
+ "_vt",
+)
def _configured_schema(config: MySQLSourceConfig) -> str | None:
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.py
index 30a6447b5519..ac31f696f72a 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
@@ -337,7 +337,7 @@ class TestSchemaDiscovery:
}
sql, params = cursor.execute.call_args.args
assert "table_schema NOT IN %(system_schemas)s" in sql
- assert params["system_schemas"] == ("information_schema", "mysql", "performance_schema", "sys")
+ assert params["system_schemas"] == ("information_schema", "mysql", "performance_schema", "sys", "_vt")
def test_get_columns_filters_qualified_names_when_schema_blank(self, impl, cursor):
cursor.fetchall.return_value = [