-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
JDBC Destinations: improve error message for conflicting streams #21342
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5e31b4e
catch conflicting streams as configerror
edgao 182d416
add test
edgao 8707685
bump version + changelog
edgao 6deb8b5
Merge branch 'master' into edgao/config_error_duplicate_stream
edgao a678556
derp, fix test setup
edgao 281b094
derp
edgao 026775d
auto-bump connector version
octavia-squidington-iii 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 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
34 changes: 34 additions & 0 deletions
34
...src/test/java/io/airbyte/integrations/destination/staging/StagingConsumerFactoryTest.java
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,34 @@ | ||
package io.airbyte.integrations.destination.staging; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import io.airbyte.commons.exceptions.ConfigErrorException; | ||
import io.airbyte.integrations.destination.jdbc.WriteConfig; | ||
import java.util.List; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class StagingConsumerFactoryTest { | ||
|
||
@Test() | ||
void detectConflictingStreams() { | ||
final StagingConsumerFactory f = new StagingConsumerFactory(); | ||
|
||
final ConfigErrorException configErrorException = assertThrows( | ||
ConfigErrorException.class, | ||
() -> f.flushBufferFunction( | ||
null, | ||
null, | ||
List.of( | ||
new WriteConfig("example_stream", "source_schema", "destination_default_schema", null, null, null), | ||
new WriteConfig("example_stream", "source_schema", "destination_default_schema", null, null, null) | ||
), | ||
null | ||
)); | ||
|
||
assertEquals( | ||
"You are trying to write multiple streams to the same table. Consider switching to a custom namespace format using ${SOURCE_NAMESPACE}, or moving one of them into a separate connection with a different stream prefix. Affected streams: source_schema.example_stream, source_schema.example_stream", | ||
configErrorException.getMessage() | ||
); | ||
} | ||
|
||
} |
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
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.
This block seems to make sense in the
onStartFunction
since none of the values you're accessing here seem to be only isolated to theflushBufferFunction
sectionThe reason that this makes sense to me in the
onStartFunction
is primarily because you already have the writeConfig values (since we're setting up the temporary tables for each stream (synonymous with writeConfig) and the metadata for eachstreamIdentifier
will be known at setup timeIt also fits with what
onStartFunction
means which is set up so this is only called once as opposed to many times throughout the flushing of the buffer (N times where N can be infinitely large)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.
this block happens before the lambda gets created (i.e. it's not actually part of the flush buffer function), so I think it only gets executed once per sync
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.
That does make sense, although I would be hesitant to have this in the
flushBufferFunction
since it muddies the singular responsibility of the buffer flush. Also, since we know that the lambda foronStartFunction
is called only once and it already includeswriteConfigs
that it would be another suitable locationThat said, this isn't blocking