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

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

 Now, we have 4 approaches: (1) SCM reply, (2) Per-pipeline RocksDB marker, (3) 
Support metadata in RaftGroupProto and (4) Add ReplicationType to the 
id.container file.  Compare (2), (3) and (4).
-----
Claude: I'd go with (4) plus SCM closing CHAINED pipelines when a datanode 
registers again. (4) is the only approach that also answers the container-level 
questions, and those need the type anyway. (2) and (3) only cover the 
empty-pipeline gap, which the SCM close makes harmless.

||                                ||                    (2) RocksDB marker per 
pipeline                     ||             (3) Metadata in RaftGroupProto      
        ||                       (4) Type in the .container file                
        ||
| Stored in                       | PipelineCreateInfoTable in the witnessed 
container DB                   | A file in the Ratis group directory            
          | Each container's .container YAML file                               
           |
| Unit                            | Pipeline                                    
                            | Pipeline (Raft group)                             
       | Container                                                              
        |
| Read before groups reload on restart   | Yes: the DB opens in the 
OzoneContainer constructor      | Yes: initGroupDir reads the file before the 
registry is called | Yes: buildContainerSet() runs before writeChannel.start(); 
the registry looks  up originPipelineId |
| Empty CHAINED pipeline          | Covered                                     
                            | Covered                                           
       | Not covered: it reloads as RATIS until SCM closes it; no data at risk  
        |
| Kept in step with the group     | No: written before group add and deleted 
after group remove; a sweep after start removes orphans    | Yes: written when 
the group is formatted, deleted with  the group directory   | Not tied to the 
group: the type lives and dies with the container              |
| Type known after the pipeline is gone | No    | No            | Yes: 
volume-failure close action, RECOVERING cleanup, resolveDuplicate, quasi-close 
on group remove, missing-container check                           |
| Kept when a container is  replicated or imported        | No | No             
                                          | Yes: the .container file is copied 
with it                                     |
| Downgrade before finalization   | Safe: older RocksDB opens the extra column 
family     | Safe if older Ratis ignores the extra file (not checked) | Safe 
only because the write is gated: an older datanode would fail the .container 
checksum                                                            |
| CHAINED gate                    | Yes, STREAM_PUTBLOCK_WITHOUT_RAFT (done)    
                            | Yes, the same gate                                
       | Yes, the same gate (done in step 1)                                    
        |
| Outside dependency              | None, but a new column family is a RocksDB 
layout change | A new Ratis release (Ozone is on 3.3.1), then an Ozone upgrade  
| None                                                                          
 |
| Assumes                         | Nothing                                     
                            | Nothing                                           
       | One container per CHAINED pipeline (true in V3)                        
        |
| Work left                       | Done on HDDS-17845 
(TestXceiverServerRatisReplicationType, 7 tests)     | Ratis persistence, 
registry change, the division keeps the metadata; Ozone switches to it   | Step 
2 passes CHAINED to container creation; step 3 does the registry lookup   |
| Other users                     | Ozone only                                  
                            | Any Ratis application                             
       | Ozone only                                                             
        |

How to read it
- (4) is needed anyway. Neither (2) nor (3) can tell handleVolumeFailures, 
resolveDuplicate or the RECOVERING cleanup that a container is CHAINED once its 
pipeline is gone.
- The only open question is the empty-pipeline gap. Between a restart and SCM 
closing the pipeline, a CHAINED group with no container runs a RATIS state 
machine. That window holds no data, and stream writes to it are rejected.
- (2) or (3) would close that gap.
  - (2) is the cheaper of the two today, but it adds a column family and a 
cleanup sweep.
  - (3) is cleaner because the metadata lives and dies with the group, but it 
waits on a Ratis release.

So I'd shelve (2) and propose (3) in Ratis as a follow-up if you want the gap 
closed.



> Restore ReplicationType in ContainerStateMachine when a datanode restart
> ------------------------------------------------------------------------
>
>                 Key: HDDS-17845
>                 URL: https://issues.apache.org/jira/browse/HDDS-17845
>             Project: Apache Ozone
>          Issue Type: Sub-task
>          Components: Ozone Datanode
>            Reporter: Tsz-wo Sze
>            Assignee: Tsz-wo Sze
>            Priority: Major
>              Labels: pull-request-available
>
> (Assisted by Claude)
> When a datanode restart, we need some way to tell the ReplicationType of an 
> open container in order to recreate the ContainerStateMachine. Two approaches 
> below are considered, SCM reply vs Per-pipeline RocksDB marker:
> || ||SCM reply||Per-pipeline RocksDB marker||
> |On-disk change|none|new column family in the witnessed DB|
> |Protocol change|PipelineReport field and handling|none|
> |Unknown window after restart|~registration + 1 heartbeat, behaving 
> permissively|none: known before log replay|
> |Source of truth|SCM, so it can't go stale|the datanode, so a crash between 
> steps can leave a stray marker|
> |State machine type|mutable, set once|final, and the subclass split stays 
> possible|
> Although SCM reply does not requires on-disk change, there are may edge cases 
> listed below. Therefore, we will implement Per-pipeline RocksDB marker
>  - SCM doesn't know the pipeline: the existing ClosePipelineCommand path 
> removes the group, so the type never matters.
>  - Datanode was stale or dead: SCM has already closed the pipeline, which is 
> the self-healing path from before.
>  - Old SCM, new datanode: the old SCM ignores the flag, so the type stays 
> unknown and the datanode keeps allowing both kinds. Safe, just without the 
> checks.
>  - New SCM, old datanode: an old datanode never sets the flag, so nothing 
> changes for it.
>  - SCM unreachable or not leader: the type stays unknown until the leader 
> answers.
> Regarding to HDDSVersion, see Note 1 in the first comment.



--
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