HDDS-12991 failback to non-streaming write when pipeline does not have streaming port info #10828
HDDS-12991 failback to non-streaming write when pipeline does not have streaming port info #10828yandrey321 wants to merge 2 commits into
Conversation
…, in case if pipeline does not have streaming port info failback to non-streaming write
Let's just close all the non-stream pipelines and don't fall back. It makes the code really complicated.
This section is supposed to put only one JIRA -- the JIRA corresponding to this PR. |
This solution creates a race condition, it fails the integration test in mini Ozone cluster. Changes in this PR allows graceful fail back to non-stream writes.
Fixed. |
| } | ||
| len -= writtenLength; | ||
| off += writtenLength; | ||
| } catch (StreamNotSupportedException e) { |
There was a problem hiding this comment.
Looks like StreamNotSupportedException would be caught by handleException() instead, it would be caught here after several retry attempts. That would be fine functionally but delays connection in this case.
There was a problem hiding this comment.
good catch! Updated the fix to address the comment.
What is the race condition?
The change in this PR is very complicated. It does not worth to implement fallback for just changing the conf from disable streaming to enable streaming. |
here is the part for re-creating pipelines when streaming is enabled: #10842 without client side fix (changes in the current PR) the part 2 fails with the following error on writing files after enabling the streaming: |
Thanks @yandrey321 for working on this. I believe this fallback is necessary for now. Here is my understanding of the problem: Imagine a scenario where the cluster inevitably contains a mix of DataNodes that support Ratis streaming and those that do not. This ultimately leads to two issues:
My perspective: I view this as a short cup to keep writes functioning properly, while we still need to close and update the pipeline states for those whose DataNode port information is outdated. However, I think we should create a ticket to ensure that either pipeline creation or pipeline selection is aware of the write mode. This way, the client can accurately target pipelines that support Ratis streaming. @yandrey321 , @szetszwo , what are your thoughts on this? |
What changes were proposed in this pull request?
HDDS-12991 Gracefully enable Ratis DataStream on a running cluster with pre-existing pipelines
When Ratis DataStream is turned on for an already-running cluster, datanodes and pipelines created before the feature was enabled do not expose the RATIS_DATASTREAM port. A streaming-enabled client attempting to write to such a pipeline previously failed. This change makes that transition graceful — a streaming client transparently falls back to the non-streaming write path when the target pipeline can't stream:
-BasicOzoneFileSystem / BasicRootedOzoneFileSystem wire the non-streaming path (createFSOutputStream(adapter.createFile(...))) as that fallback.
Co-authored with Cloude Code
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-12991
How was this patch tested?
Unit tests
TestSelectorOutputStream (12 tests) — covers the fallback-on-first-flush path, replay of buffered data, failing-close during fallback, and the no-fallback-configured (propagate) path.
TestSCMNodeManager — testRegisterRefreshesPortsOnPortChange (ports changed → node record updated) and testRegisterKeepsPortsWhenUnchanged (ports unchanged → no update).
Integration test
TestOzoneFileSystemWithStreamingDisabledDatanode — brings up a cluster with RATIS_DATASTREAM disabled on the datanodes but streaming enabled on the client (auto-threshold 1B), then asserts a write falls back to non-streaming and round-trips correctly over both o3fs and ofs.