-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Source-mysql] : Implement WASS algo (#38240)
Co-authored-by: Evan Tahler <evan@airbyte.io>
- Loading branch information
1 parent
68903b4
commit 310e6bd
Showing
20 changed files
with
371 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
airbyte-cdk/java/airbyte-cdk/core/src/main/resources/version.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
version=0.40.11 | ||
version=0.41.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...src/main/kotlin/io/airbyte/cdk/integrations/source/relationaldb/InitialLoadTimeoutUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (c) 2024 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.cdk.integrations.source.relationaldb | ||
|
||
import com.fasterxml.jackson.databind.JsonNode | ||
import io.github.oshai.kotlinlogging.KotlinLogging | ||
import java.time.Duration | ||
import java.util.* | ||
|
||
private val LOGGER = KotlinLogging.logger {} | ||
|
||
object InitialLoadTimeoutUtil { | ||
|
||
val MIN_INITIAL_LOAD_TIMEOUT: Duration = Duration.ofHours(4) | ||
val MAX_INITIAL_LOAD_TIMEOUT: Duration = Duration.ofHours(24) | ||
val DEFAULT_INITIAL_LOAD_TIMEOUT: Duration = Duration.ofHours(8) | ||
|
||
@JvmStatic | ||
fun getInitialLoadTimeout(config: JsonNode): Duration { | ||
val isTest = config.has("is_test") && config["is_test"].asBoolean() | ||
var initialLoadTimeout = DEFAULT_INITIAL_LOAD_TIMEOUT | ||
|
||
val initialLoadTimeoutHours = getInitialLoadTimeoutHours(config) | ||
|
||
if (initialLoadTimeoutHours.isPresent) { | ||
initialLoadTimeout = Duration.ofHours(initialLoadTimeoutHours.get().toLong()) | ||
if (!isTest && initialLoadTimeout.compareTo(MIN_INITIAL_LOAD_TIMEOUT) < 0) { | ||
LOGGER.warn { | ||
"Initial Load timeout is overridden to ${MIN_INITIAL_LOAD_TIMEOUT.toHours()} hours, " + | ||
"which is the min time allowed for safety." | ||
} | ||
initialLoadTimeout = MIN_INITIAL_LOAD_TIMEOUT | ||
} else if (!isTest && initialLoadTimeout.compareTo(MAX_INITIAL_LOAD_TIMEOUT) > 0) { | ||
LOGGER.warn { | ||
"Initial Load timeout is overridden to ${MAX_INITIAL_LOAD_TIMEOUT.toHours()} hours, " + | ||
"which is the max time allowed for safety." | ||
} | ||
initialLoadTimeout = MAX_INITIAL_LOAD_TIMEOUT | ||
} | ||
} | ||
|
||
LOGGER.info { "Initial Load timeout: ${initialLoadTimeout.seconds} seconds" } | ||
return initialLoadTimeout | ||
} | ||
|
||
fun getInitialLoadTimeoutHours(config: JsonNode): Optional<Int> { | ||
val replicationMethod = config["replication_method"] | ||
if (replicationMethod != null && replicationMethod.has("initial_load_timeout_hours")) { | ||
val seconds = config["replication_method"]["initial_load_timeout_hours"].asInt() | ||
return Optional.of(seconds) | ||
} | ||
return Optional.empty() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.