[
https://issues.apache.org/jira/browse/HDDS-17845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18150181#comment-18150181
]
Rui Wang edited comment on HDDS-17845 at 11/24/26, 8:15 AM:
------------------------------------------------------------
[~szetszwo] thanks for the patch and also compare the two approaches by a table.
IIUC the primary problem we want to solve is to decide the ContainerSM and
pipeline's replication type upon DN restarts.
Before we move forward to review the patch, can we still have some time to
discuss the third approach: persistent the replication type as a part of the
RaftGroup in Ratis?
The idea is when RaftGroup reloads from the storage, it can discover the
information. This will require Ratis change, likely a Map<string, string>
metadata associated with the RaftGroup and ser/deser in disk.
AI summarise the benefits better than me :
{panel:title=Why Ratis design is better}
* One lifecycle. The type would be written when the group is created and
removed with the group's directory. That drops the startup cleanup in
cleanupPipelineCreateInfoTable(), the delete in removeGroup, and both
stale-entry problems from my review.
* No crash window. If Ratis writes the metadata while it formats the group, a
group can never exist on disk without its type. The PR has to use a
write-first, clean-up-later ordering to get close to that.
* Same disk as the group. If the Ratis disk fails, the group and its type are
lost together. A stale table entry, or a group silently reloaded as RATIS,
can't happen.
* CHAINED can be added from a peer. The type travels in the add-group request.
That removes the limitation noted in CreatePipelineCommandHandler ("For
CHAINED, fan-out not working"), which neither the PR nor SCM reply solves.
* The type stays final. It's known before the state machine is built, so
ContainerStateMachine keeps the property the PR author cared about.
* No datanode RocksDB schema change. Nothing needs to be added to the witnessed
DB or kept compatible afterwards.
{panel}
was (Author: amaliujia):
[~szetszwo] thanks for the patch and also compare the two approaches by a table.
IIUC the primary problem we want to solve is to decide the ContainerSM and
pipeline's replication type upon DN restarts.
Before we move forward to review the patch, can we still have some time to
discuss the third approach: persistent the replication type as a part of the
RaftGroup in Ratis?
The idea is when RaftGroup reloads from the storage, it can discover the
information. This will require Ratis change, likely a Map<string, string>
metadata associated with the RaftGroup and ser/deser in disk.
AI summarise the benefits better than me :
{panel:title=Points to get right in the Ratis design}
1. Use opaque bytes, not a typed field. Something like an optional bytes field
in the group-add request, which Ratis stores and returns without interpreting.
Ozone would put its own proto in it. This keeps Ozone's idea of a replication
type out of Ratis and is likely easier to get accepted there.
2. Set it once. Write the metadata only when the group is created and never
change it. An update API would bring back the consistency questions this idea
removes. If a group-add request has different metadata from an existing group
with the same ID, reject it rather than ignoring the new value.
3. Store it in its own file. Write it atomically in the group's current/
directory during format. Don't put it in raft-meta.conf, which Ratis rewrites
on every membership change.
4. Read it before creating the state machine. On restart, Ratis already scans
the storage directories to find groups. It would read the metadata file at that
point and pass the group and metadata to a new factory overload. The current
factory only takes the group ID; keep it for callers that don't need metadata.
5. Check unknown files are ignored. An older Ratis that finds the extra file in
current/ should skip it. I believe Ratis only looks for files named like its
own log segments and metadata, but that needs a test.
6. Groups with no metadata. Treat them as RATIS. That's correct here, because
every group created before this change is RATIS, so no migration is needed.
{panel}
> 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]