Skip to content

Commit 7c51ec1

Browse files
authored
[source-mysql] More meaningful errors for variables used in extra checks for CDC (#55731)
1 parent 9777bd8 commit 7c51ec1

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

airbyte-integrations/connectors/source-mysql/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ data:
99
connectorSubtype: database
1010
connectorType: source
1111
definitionId: 435bb9a5-7887-4809-aa58-28c27df0d7ad
12-
dockerImageTag: 3.11.8
12+
dockerImageTag: 3.11.9
1313
dockerRepository: airbyte/source-mysql
1414
documentationUrl: https://docs.airbyte.com/integrations/sources/mysql
1515
githubIssueLabel: source-mysql

airbyte-integrations/connectors/source-mysql/src/main/kotlin/io/airbyte/integrations/source/mysql/MySqlSourceMetadataQuerier.kt

+23-7
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,24 @@ class MySqlSourceMetadataQuerier(
3232
base.extraChecks()
3333
if (base.config.global) {
3434
// Extra checks for CDC
35-
var cdcVariableCheckQueries: List<Pair<String, String>> =
35+
var cdcVariableCheckQueries: List<Triple<String, String, String>> =
3636
listOf(
37-
Pair("show variables where Variable_name = 'log_bin'", "ON"),
38-
Pair("show variables where Variable_name = 'binlog_format'", "ROW"),
39-
Pair("show variables where Variable_name = 'binlog_row_image'", "FULL"),
37+
Triple("log_bin", "show variables where Variable_name = 'log_bin'", "ON"),
38+
Triple(
39+
"binlog_format",
40+
"show variables where Variable_name = 'binlog_format'",
41+
"ROW"
42+
),
43+
Triple(
44+
"binlog_row_image",
45+
"show variables where Variable_name = 'binlog_row_image'",
46+
"FULL"
47+
),
4048
)
4149

42-
cdcVariableCheckQueries.forEach { runVariableCheckSql(it.first, it.second, base.conn) }
50+
cdcVariableCheckQueries.forEach {
51+
runVariableCheckSql(it.first, it.second, it.third, base.conn)
52+
}
4353

4454
// Note: SHOW MASTER STATUS has been deprecated in latest mysql (8.4) and going forward
4555
// it should be SHOW BINARY LOG STATUS. We will run both - if both have been failed we
@@ -62,7 +72,12 @@ class MySqlSourceMetadataQuerier(
6272
}
6373
}
6474

65-
private fun runVariableCheckSql(sql: String, expectedValue: String, conn: Connection) {
75+
private fun runVariableCheckSql(
76+
variable: String,
77+
sql: String,
78+
expectedValue: String,
79+
conn: Connection
80+
) {
6681
try {
6782
conn.createStatement().use { stmt: Statement ->
6883
stmt.executeQuery(sql).use { rs: ResultSet ->
@@ -73,7 +88,8 @@ class MySqlSourceMetadataQuerier(
7388
if (!resultValue.equals(expectedValue, ignoreCase = true)) {
7489
throw ConfigErrorException(
7590
String.format(
76-
"The variable should be set to \"%s\", but it is \"%s\"",
91+
"The variable \"%s\" should be set to \"%s\", but it is \"%s\"",
92+
variable,
7793
expectedValue,
7894
resultValue,
7995
),

docs/integrations/sources/mysql.md

+1
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ Any database or table encoding combination of charset and collation is supported
226226

227227
| Version | Date | Pull Request | Subject |
228228
|:------------|:-----------|:-----------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------|
229+
| 3.11.9 | 2025-03-14 | [55731](https://github.com/airbytehq/airbyte/pull/55731) | More meaningful errors for variables used in extra checks for CDC |
229230
| 3.11.8 | 2025-03-14 | [55761](https://github.com/airbytehq/airbyte/pull/55761) | Do not perform complex sampling for source-mysql |
230231
| 3.11.7 | 2025-03-12 | [55734](https://github.com/airbytehq/airbyte/pull/55734) | Expose additional stream context for debezium properties at startup |
231232
| 3.11.6 | 2025-03-06 | [55237](https://github.com/airbytehq/airbyte/pull/55237) | [Fix fetching binlog status for version >=8.4](https://github.com/airbytehq/airbyte/pull/55237#top) |

0 commit comments

Comments
 (0)