Skip to content

Commit

Permalink
Implemented transient error handling for system errors in MSSQL (#48484)
Browse files Browse the repository at this point in the history
  • Loading branch information
yardencarmeli authored Nov 13, 2024
1 parent bb880c4 commit 806f810
Show file tree
Hide file tree
Showing 5 changed files with 207 additions and 168 deletions.
4 changes: 4 additions & 0 deletions airbyte-integrations/connectors/source-mssql/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ dependencies {
testImplementation 'org.hamcrest:hamcrest-all:1.3'
testImplementation 'org.testcontainers:mssqlserver:1.19.0'
}

compileKotlin {

}
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-mssql/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ data:
connectorSubtype: database
connectorType: source
definitionId: b5ea17b1-f170-46dc-bc31-cc744ca984c1
dockerImageTag: 4.1.15
dockerImageTag: 4.1.16
dockerRepository: airbyte/source-mssql
documentationUrl: https://docs.airbyte.com/integrations/sources/mssql
githubIssueLabel: source-mssql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,9 @@ public JdbcDatabase createDatabase(final JsonNode sourceConfig) throws SQLExcept

public static void main(final String[] args) throws Exception {
final Source source = MssqlSource.sshWrappedSource(new MssqlSource());
final MSSqlSourceExceptionHandler exceptionHandler = new MSSqlSourceExceptionHandler();
LOGGER.info("starting source: {}", MssqlSource.class);
new IntegrationRunner(source).run(args);
new IntegrationRunner(source).run(args, exceptionHandler);
LOGGER.info("completed source: {}", MssqlSource.class);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024 Airbyte, Inc., all rights reserved.
*/

package io.airbyte.integrations.source.mssql

import io.airbyte.cdk.integrations.util.ConnectorErrorProfile
import io.airbyte.cdk.integrations.util.ConnectorExceptionHandler
import io.airbyte.cdk.integrations.util.FailureType

class MSSqlSourceExceptionHandler : ConnectorExceptionHandler() {
override fun initializeErrorDictionary() {

val DATABASE_READ_ERROR = "Encountered an error while reading the database, will retry"

// include common error profiles
super.initializeErrorDictionary()

// adding connector specific error profiles
add(
ConnectorErrorProfile(
errorClass = "MS SQL Exception", // which should we use?
regexMatchingPattern =
".*returned an incomplete response. The connection has been closed.*",
failureType = FailureType.TRANSIENT,
externalMessage = DATABASE_READ_ERROR,
sampleInternalMessage =
"com.microsoft.sqlserver.jdbc.SQLServerException: SQL Server returned an incomplete response. The connection has been closed.",
referenceLinks = listOf("https://github.com/airbytehq/oncall/issues/6623")
)
)
}
}
Loading

0 comments on commit 806f810

Please sign in to comment.