You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Hemant Kumar (Jira)" <ji...@apache.org> on 2023/05/17 23:47:00 UTC
[jira] [Commented] (HDDS-8059) [Snapshot] Implement SnapshotChainIterator
[ https://issues.apache.org/jira/browse/HDDS-8059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17723752#comment-17723752 ]
Hemant Kumar commented on HDDS-8059:
------------------------------------
It is a great idea if we can simply wrap *LinkedHashMap* to implement iterator since *LinkedHashMap* is used to maintain [snapshotChainGlobal and snapshotChainPath|https://github.com/apache/ozone/blob/master/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SnapshotChainManager.java#L47]. But I doubt it is that simple and *LinkedHashMap* can be reused for the iterator. We have to create a copy/clone of *LinkedHashMap* every time *iterator()* is called as per my understanding of *LinkedHashMap*. And consistency would be another problem if we go with iterator approach.
In my opinion, if we want to simplify it, we should create *SnapshotChain* instead of `SnapshotChainIterator`. *SnapshotChain* could simple wrapped over *LinkedHashMap* and can provide helper function like *contains()*, *hasPreviousSnapshotAttached()*, *hasNextSnapshotAttached* (something along the lines).
Or create custom LinkedHashMap which exposes the iterator we want.
> [Snapshot] Implement SnapshotChainIterator
> ------------------------------------------
>
> Key: HDDS-8059
> URL: https://issues.apache.org/jira/browse/HDDS-8059
> Project: Apache Ozone
> Issue Type: Sub-task
> Reporter: Siyao Meng
> Priority: Major
>
> Context: https://github.com/apache/ozone/pull/4244#discussion_r1112993449
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org