Skip to content

Commit 98b1080

Browse files
authored
[Source-mssql] : TImeout for building schema should be tied to the configured wait time (#40558)
1 parent a50847a commit 98b1080

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ data:
99
connectorSubtype: database
1010
connectorType: source
1111
definitionId: b5ea17b1-f170-46dc-bc31-cc744ca984c1
12-
dockerImageTag: 4.0.31
12+
dockerImageTag: 4.0.32
1313
dockerRepository: airbyte/source-mssql
1414
documentationUrl: https://docs.airbyte.com/integrations/sources/mssql
1515
githubIssueLabel: source-mssql

airbyte-integrations/connectors/source-mssql/src/main/java/io/airbyte/integrations/source/mssql/cdc/MssqlDebeziumStateUtil.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import io.airbyte.cdk.integrations.debezium.internals.DebeziumPropertiesManager;
1717
import io.airbyte.cdk.integrations.debezium.internals.DebeziumRecordPublisher;
1818
import io.airbyte.cdk.integrations.debezium.internals.DebeziumStateUtil;
19+
import io.airbyte.cdk.integrations.debezium.internals.RecordWaitTimeUtil;
1920
import io.airbyte.cdk.integrations.debezium.internals.RelationalDbDebeziumPropertiesManager;
2021
import io.airbyte.commons.json.Jsons;
2122
import io.airbyte.protocol.models.v0.ConfiguredAirbyteCatalog;
@@ -107,8 +108,15 @@ public static synchronized JsonNode constructInitialDebeziumState(final Properti
107108
break;
108109
}
109110

110-
if (Duration.between(engineStartTime, Instant.now()).compareTo(Duration.ofMinutes(5)) > 0) {
111-
LOGGER.error("No record is returned even after {} seconds of waiting, closing the engine", 300);
111+
Duration initialWaitingDuration = Duration.ofMinutes(5L);
112+
// If initial waiting seconds is configured and it's greater than 5 minutes, use that value instead
113+
// of the default value
114+
final Duration configuredDuration = RecordWaitTimeUtil.getFirstRecordWaitTime(database.getSourceConfig());
115+
if (configuredDuration.compareTo(initialWaitingDuration) > 0) {
116+
initialWaitingDuration = configuredDuration;
117+
}
118+
if (Duration.between(engineStartTime, Instant.now()).compareTo(initialWaitingDuration) > 0) {
119+
LOGGER.error("Schema history not constructed after {} seconds of waiting, closing the engine", initialWaitingDuration.getSeconds());
112120
publisher.close();
113121
throw new RuntimeException(
114122
"Building schema history has timed out. Please consider increasing the debezium wait time in advanced options.");

docs/integrations/sources/mssql.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ WHERE actor_definition_id ='b5ea17b1-f170-46dc-bc31-cc744ca984c1' AND (configura
422422

423423
| Version | Date | Pull Request | Subject |
424424
|:--------|:-----------|:------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------------------------------------------------|
425+
| 4.0.32 | 2024-06-26 | [40558](https://github.com/airbytehq/airbyte/pull/40558) | Handle DatetimeOffset correctly. |
425426
| 4.0.31 | 2024-06-14 | [39419](https://github.com/airbytehq/airbyte/pull/39419) | Handle DatetimeOffset correctly. |
426427
| 4.0.30 | 2024-06-14 | [39349](https://github.com/airbytehq/airbyte/pull/39349) | Full refresh stream sending internal count metadata. |
427428
| 4.0.29 | 2024-06-14 | [39506](https://github.com/airbytehq/airbyte/pull/39506) | Adopt latest CDK. |

0 commit comments

Comments
 (0)