[ 
https://issues.apache.org/jira/browse/HDDS-17689?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18154408#comment-18154408
 ] 

Tsz-wo Sze commented on HDDS-17689:
-----------------------------------

We will add a new ClosePipelineInfo.Reason proto enum DATANODE_RESTARTED.  The 
SCM can tell why a CHAINED pipeline is closed.  For compatibility, it has not 
problem:
# Before upgrade finalized, CHAINED pipelines should not be used (i.e. 
DATANODE_RESTARTED won't be sent).
# SCM is supposed to be upgraded first: New SCM can serve an old datanodes 
sending DATANODE_RESTARTED.
# Even a new datanode sends DATANODE_RESTARTED to an old SCM has no harm since 
the Reason proto is option and SCM current does not use it.

> Close CHAINED pipeline after datadnode restart
> ----------------------------------------------
>
>                 Key: HDDS-17689
>                 URL: https://issues.apache.org/jira/browse/HDDS-17689
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: Ozone Datanode
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>
> (First part was moved to HDDS-17845.  See the first comment for the original 
> description.)
> ----
> For "still has it after a restart", we can close all the CHAINED pipelines if 
> a datanode restart.
> ----
> Claude:
> Yes, that works. Closing every CHAINED pipeline on a restarted datanode means 
> the type only has to live in memory, so nothing new goes on disk. Two pieces 
> are missing, though.
> 1. Today nothing triggers the close.
> - When a datanode restarts it registers again. For a node SCM already knows, 
> SCMNodeManager#register (the else branch, around lineĀ 470) only updates the 
> address, version or ports. It fires no event and doesn't touch pipelines.
> - StaleNodeHandler closes a node's pipelines only after the stale interval 
> (ozone.scm.stale.node.interval), so a fast restart never reaches it.
> - So the RFC needs one SCM change: when a known datanode re-registers, close 
> the CHAINED pipelines that contain it. RATIS pipelines are left alone. 
> Closing goes through the normal path: the containers get force=true closes 
> and the datanodes get ClosePipelineCommand.
> 2. There is a short window right after restart.
> - VersionEndpointTask:90 calls ozoneContainer.start(clusterId), which starts 
> the Ratis and DataStream servers. That happens before registration, and 
> ClosePipelineCommand only arrives later in a heartbeat response.
> - In between, the datanode has reloaded the Raft group, doesn't know it's 
> CHAINED, and can still accept streams. That can come from a client that got a 
> block on this pipeline before SCM closed it.
> - If the datanode treats such a stream as RATIS, it adds a newly created 
> container to container2BCSIDMap. When the group is removed, notifyGroupRemove 
> then quasi-closes that replica, which breaks the "never QUASI_CLOSED" rule.
> Ways to close the window:
> - (a) Reject unknown-type groups. For any group reloaded at startup whose 
> type was never recorded, the datanode rejects StreamInitWithPutBlock with a 
> retriable error. The client excludes the pipeline and gets a new block. The 
> cost is that RATIS pipelines using 
> ozone.client.datastream.putblock.without.raft.enabled are also refused after 
> a restart, until those pipelines are replaced. Plain V2 StreamInit is not 
> affected.
> - (b) Never use the map for this request type. StreamInitWithPutBlock never 
> adds to container2BCSIDMap when the group's type is unknown, which makes the 
> window harmless for CHAINED. The cost is that RATIS containers written that 
> way after a restart are left out of the bcsId restart check. That check means 
> little for them anyway, because they also have no Raft write entries.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to