SNOW-2193898 Recreate streaming ingest client on CLIENT_CLOSED error #1185
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.
Overview
SNOW-2193898 Transparent handling of failover with client redirect in streaming ingest
Problem
When Streaming Ingest SDK returns a
CLOSED_CLIENT
error, Kafka Connector will attempt to reopen channels with the same closed client, leading to repeated failures.Customers are currently required to manually restart their KC after changing deployment: https://docs.snowflake.com/en/user-guide/snowpipe-streaming/snowpipe-streaming-classic-kafka#failover-limitations
Solution
Implemented automatic client recreation when a
CLOSED_CLIENT
error is detected. Streaming Ingest SDK will separately be updated to close the client when it detects a change to the primary deployment.Changes
SSv1
DirectTopicPartitionChannel
streamingIngestClient
field non-final to allow updatesinsertRowFallbackSupplier()
to callStreamingClientProvider.recreateClient()
when client is closedSSv2
SnowpipeStreamingV2PartitionChannel
CLIENT_CLOSED_ERROR_CODE
constant with TODO (SSv2 SDK does not yet return structured error codes)insertRowFallbackSupplier()
to callStreamingIngestClientV2Provider.recreateClient()
Refactor
SnowflakeSinkServiceV2.streamingIngestClient
private final SnowflakeStreamingIngestClient streamingIngestClient
fieldStreamingClientProvider.getStreamingClientProviderInstance().getClient()
Testing
testClientRecreationOn_ClosedClientError()
that validates:Urgency
This review is high priority. Customer requesting KC streaming ingest support for Client Redirect.
Risks
Client recreate is an expensive operation. However:
Backward/forward compatible
[x] This change does not introduce any breaking API or data format changes.
Pre-review checklist
snowflake.ingestion.method
.Yes
- Added end to end and Unit Tests.No
- Suggest why it is not param protected