You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/09/07 11:37:23 UTC

[GitHub] [ozone] bshashikant commented on a change in pull request #2611: HDDS-5710. initialize sequenceIdToLastIdMap when SequenceIdGenerator#StateManager reinitializes

bshashikant commented on a change in pull request #2611:
URL: https://github.com/apache/ozone/pull/2611#discussion_r703431861



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SequenceIdGenerator.java
##########
@@ -253,9 +254,28 @@ public Long getLastId(String sequenceIdName) {
     }
 
     @Override
-    public void reinitialize(Table<String, Long> seqIdTable) {
+    public void reinitialize(Table<String, Long> seqIdTable)
+        throws IOException {
       this.sequenceIdTable = seqIdTable;
       this.sequenceIdToLastIdMap.clear();
+      initialize();
+    }
+
+    private void initialize() throws IOException {
+      TableIterator<String,
+          ? extends Table.KeyValue<String, Long>>
+          iterator = sequenceIdTable.iterator();
+
+      while (iterator.hasNext()) {
+        Table.KeyValue<String, Long> kv = iterator.next();
+        final String sequenceIdName = kv.getKey();
+        final Long lastId = kv.getValue();
+        org.apache.ratis.util.Preconditions.assertNotNull(sequenceIdName,

Review comment:
       Can u fix the import and use just Preconditions check?




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org