swamirishi commented on code in PR #5223:
URL: https://github.com/apache/ozone/pull/5223#discussion_r1305280955
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SnapshotChainManager.java:
##########
@@ -234,7 +234,10 @@ private void loadFromSnapshotInfoTable(OMMetadataManager
metadataManager) {
// snapshot chains - both global and local path
try (TableIterator<String, ? extends Table.KeyValue<String, SnapshotInfo>>
keyIter = metadataManager.getSnapshotInfoTable().iterator()) {
- Map<Long, SnapshotInfo> snaps = new TreeMap<>();
+ Map<UUID, SnapshotInfo> snaps = new HashMap<>();
+ // Forward Linked list for snapshot chain.
+ Map<UUID, UUID> snapshotChain = new HashMap<>();
Review Comment:
java.util.LinkedList search is bad. Since linkBefore function is package
private. Only way to add is to use indexes which is bad. We will end up doing a
complete iteration in the existing linked list to search for the node O(n^2).
This solution when amortized O(n) as hashMap lookup is only O(1).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]