-
Notifications
You must be signed in to change notification settings - Fork 58
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
SNOW-1000828 Expose specific error messages as part of the channel invalidation exception #721
Conversation
src/main/resources/net/snowflake/ingest/ingest_error_messages.properties
Outdated
Show resolved
Hide resolved
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.
LGTM, just had a small nit about naming
@@ -82,14 +84,15 @@ void invalidateChannelIfSequencersMatch( | |||
String schemaName, | |||
String tableName, | |||
String channelName, | |||
Long channelSequencer) { | |||
Long channelSequencer, | |||
String invalidationCause) { |
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.
nit: in some methods it is invalidationCause and others it becomes errorMessage, would it be possible to reuse the same name so it is easier to follow?
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.
Agree that we should use invalidationCause or invalidationReason in the function signature, but sometimes a channel gets invalidated is because of an error, so it's ok to call it errorMessage for such cases when passing it into the function
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.
Left some minor comments, otherwise LGTM, thanks!
@@ -37,7 +37,9 @@ void addChannel(SnowflakeStreamingIngestChannelInternal<T> channel) { | |||
channels.put(channel.getName(), channel); | |||
// Invalidate old channel if it exits to block new inserts and return error to users earlier | |||
if (oldChannel != null) { | |||
oldChannel.invalidate("removed from cache"); | |||
String errorMessage = |
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.
Removing from cache is not an error, maybe let's call it invalidationReason or invalidationCause?
@@ -657,7 +657,7 @@ String getBlobPath(Calendar calendar, String clientPrefix) { | |||
* | |||
* @param blobData list of channels that belongs to the blob | |||
*/ | |||
<CD> void invalidateAllChannelsInBlob(List<List<ChannelData<CD>>> blobData) { | |||
<CD> void invalidateAllChannelsInBlob(List<List<ChannelData<CD>>> blobData, String errorMessage) { |
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.
invalidationReason or invalidationCause instead of errorMessage?
// The cause of channel invalidation | ||
private String invalidationCause; |
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.
Could we make it clear in the comment that this is the latest cause that we see since a channel could get invalidated multiple times?
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.
Thanks!
When a channel is invalidated, the original SDK does not throw a visible enough error. This PR makes SDK show more specific details for user when
INVALID_CHANNEL
is thrown.JIRA