-
Notifications
You must be signed in to change notification settings - Fork 621
HDDS-12991 recreate pipelines after enabling ratis write streaming #10842
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,13 +182,9 @@ public static PipelineManagerImpl newPipelineManager( | |
| .setServiceName("BackgroundPipelineScrubber") | ||
| .setIntervalInMillis(scrubberIntervalInMillis) | ||
| .setWaitTimeInMillis(safeModeWaitMs) | ||
| .setPeriodicalTask(() -> { | ||
| try { | ||
| pipelineManager.scrubPipelines(); | ||
| } catch (IOException e) { | ||
| LOG.error("Unexpected error during pipeline scrubbing", e); | ||
| } | ||
| }).build(); | ||
| .setPeriodicalTask( | ||
| pipelineManager::scrubAndCloseNonStreamablePipelines) | ||
| .build(); | ||
|
|
||
| pipelineManager.setBackgroundPipelineScrubber(backgroundPipelineScrubber); | ||
| serviceManager.register(backgroundPipelineScrubber); | ||
|
|
@@ -562,6 +558,68 @@ static boolean sameIdDifferentHostOrAddress(DatanodeDetails left, DatanodeDetail | |
| || !left.getHostName().equals(right.getHostName())); | ||
| } | ||
|
|
||
| /** | ||
| * Close (and delete) OPEN pipelines that predate a datanode capability the | ||
| * registered node now advertises but the pipeline's stored node snapshot | ||
| * lacks — in practice the RATIS_DATASTREAM port after Ratis DataStream was | ||
| * enabled. Such pipelines cannot serve streaming even after the datanodes | ||
| * restart, because the Raft group's persisted configuration still carries the | ||
| * stale datastream address; only a freshly created pipeline is | ||
| * streaming-capable. BackgroundPipelineCreator recreates replacements from | ||
| * the now-capable nodes (HDDS-12991). | ||
| */ | ||
|
Comment on lines
+561
to
+570
Contributor
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. This kind of long javadoc repeated multiple times talking about the same thing through out this PR. It will be very maintain it for the future changes. Please review and revise the AI generated javadocs/comments before submitting a PR. |
||
| void scrubAndCloseNonStreamablePipelines() { | ||
| try { | ||
| scrubPipelines(); | ||
| } catch (IOException e) { | ||
| LOG.error("Unexpected error during pipeline scrubbing", e); | ||
| } | ||
| closeNonStreamablePipelines(); | ||
| } | ||
|
|
||
| @Override | ||
| public void closeNonStreamablePipelines() { | ||
|
Contributor
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. The implementation is closing all the pipelines with new port but specific to Streaming. Please change the name to reflect it. |
||
| for (Pipeline pipeline : getPipelines()) { | ||
| if (!pipeline.isOpen() || !nodesExposeNewPorts(pipeline)) { | ||
| continue; | ||
| } | ||
| try { | ||
| final PipelineID id = pipeline.getId(); | ||
| LOG.info("Closing non-streamable pipeline {} so a streaming-capable " | ||
| + "pipeline can replace it", id); | ||
|
Comment on lines
+588
to
+589
Contributor
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. Again, the implementation is closing all the pipelines with new port. The log message is very misleading. |
||
| closePipeline(id); | ||
| deletePipeline(id); | ||
| } catch (IOException e) { | ||
| LOG.error("Failed to close non-streamable pipeline {}", | ||
| pipeline.getId(), e); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Whether any registered node of the pipeline exposes a port name that the | ||
| * pipeline's stored copy of that node lacks (e.g. RATIS_DATASTREAM added | ||
| * after the pipeline was created). | ||
| */ | ||
| private boolean nodesExposeNewPorts(Pipeline pipeline) { | ||
| for (DatanodeDetails stored : pipeline.getNodes()) { | ||
| final DatanodeDetails current = nodeManager.getNode(stored.getID()); | ||
| if (current != null && exposesNewPorts(stored, current)) { | ||
|
Contributor
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. One concern during a rolling restart: this may close the pipeline as soon as the first member advertises the new port. A replacement could still include datanodes that have not restarted yet, leading to another close-and-recreate cycle later. Would it make sense if we defer retirement until SCM can ensure the replacement uses only DataStream-capable nodes? |
||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| private static boolean exposesNewPorts(DatanodeDetails stored, | ||
|
Contributor
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 wonder if we could narrow this check to RATIS pipelines and the |
||
| DatanodeDetails current) { | ||
| final Set<DatanodeDetails.Port.Name> storedNames = stored.getPorts().stream() | ||
| .map(DatanodeDetails.Port::getName).collect(Collectors.toSet()); | ||
| return current.getPorts().stream() | ||
| .map(DatanodeDetails.Port::getName) | ||
| .anyMatch(name -> !storedNames.contains(name)); | ||
|
Contributor
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.
Comment on lines
+614
to
+620
Contributor
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. Move it to DatanodeDetails and make it non-static. |
||
| } | ||
|
|
||
| /** | ||
| * Scrub pipelines. | ||
| */ | ||
|
|
||
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 implementation is closing all the pipelines with new port but specific to Streaming. Please update the name and javadoc.