-
Notifications
You must be signed in to change notification settings - Fork 332
Few updates to RDS source plugin #5602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -8,7 +8,6 @@ | |
| import org.opensearch.dataprepper.model.source.coordinator.enhanced.EnhancedSourceCoordinator; | ||
| import org.opensearch.dataprepper.model.source.coordinator.enhanced.EnhancedSourcePartition; | ||
| import org.opensearch.dataprepper.plugins.source.rds.RdsSourceConfig; | ||
| import org.opensearch.dataprepper.plugins.source.rds.configuration.EngineType; | ||
| import org.opensearch.dataprepper.plugins.source.rds.coordination.partition.ExportPartition; | ||
| import org.opensearch.dataprepper.plugins.source.rds.coordination.partition.GlobalState; | ||
| import org.opensearch.dataprepper.plugins.source.rds.coordination.partition.LeaderPartition; | ||
|
|
@@ -116,21 +115,6 @@ public void run() { | |
|
|
||
| public void shutdown() { | ||
| shutdownRequested = true; | ||
|
|
||
| // Clean up publication and replication slot for Postgres | ||
| if (streamPartition != null) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you plan to clean up long term when the RDS source is deleted ?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a good plan on this yet. We can discuss this offline. |
||
| streamPartition.getProgressState().ifPresent(progressState -> { | ||
| if (EngineType.fromString(progressState.getEngineType()).isPostgres()) { | ||
| final PostgresStreamState postgresStreamState = progressState.getPostgresStreamState(); | ||
| final String publicationName = postgresStreamState.getPublicationName(); | ||
| final String replicationSlotName = postgresStreamState.getReplicationSlotName(); | ||
| LOG.info("Cleaned up logical replication slot {} and publication {}", | ||
| replicationSlotName, publicationName); | ||
| ((PostgresSchemaManager) schemaManager).deleteLogicalReplicationSlot( | ||
| publicationName, replicationSlotName); | ||
| } | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| private void init() { | ||
|
|
||
This file contains hidden or 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 hidden or 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
35 changes: 35 additions & 0 deletions
35
...ource/src/main/java/org/opensearch/dataprepper/plugins/source/rds/schema/VersionUtil.java
This file contains hidden or 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,35 @@ | ||
| /* | ||
| * Copyright OpenSearch Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.dataprepper.plugins.source.rds.schema; | ||
|
|
||
| public class VersionUtil { | ||
| /* Compares two version strings. | ||
| * Returns -1 if version1 is less than version2, 0 if they are equal, and 1 if version1 is greater than version2. | ||
| */ | ||
| public static int compareVersions(String version1, String version2) { | ||
| String[] v1Parts = version1.split("\\."); | ||
| String[] v2Parts = version2.split("\\."); | ||
|
|
||
| int maxLength = Math.max(v1Parts.length, v2Parts.length); | ||
|
|
||
| for (int i = 0; i < maxLength; i++) { | ||
| int v1Part = i < v1Parts.length ? Integer.parseInt(v1Parts[i]) : 0; | ||
| int v2Part = i < v2Parts.length ? Integer.parseInt(v2Parts[i]) : 0; | ||
|
|
||
| if (v1Part < v2Part) { | ||
| return -1; | ||
| } | ||
| if (v1Part > v2Part) { | ||
| return 1; | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change made because we don't support the use case of table join across database ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change in this PR is just moving the option out of TableFilterConfig, it was added in a previous PR. And yes, the
databaseoption is to limit the range of tables within one database. We don't support cross database in a single pipeline.