swamirishi commented on code in PR #4584:
URL: https://github.com/apache/ozone/pull/4584#discussion_r1192684061


##########
hadoop-hdds/rocks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedSSTDumpIterator.java:
##########
@@ -180,33 +182,32 @@ public boolean hasNext() {
   public T next() {
     checkSanityOfProcess();
     currentKey = nextKey;
-    nextKey = null;
-    boolean keyFound = false;
-    while (!keyFound) {
-      try {
-        Optional<Integer> keyLength = getNextNumberInStream();
-        if (!keyLength.isPresent()) {
-          return getTransformedValue(currentKey);
-        }
-        String keyStr = readNextNumberOfCharsFromStream(keyLength.get());
-        Matcher matcher = PATTERN_MATCHER.matcher(keyStr);
-        if (keyStr.length() == keyLength.get() && matcher.find()) {
-          Optional<Integer> valueLength = getNextNumberInStream();
-          if (valueLength.isPresent()) {
-            String valueStr = readNextNumberOfCharsFromStream(
-                valueLength.get());
-            if (valueStr.length() == valueLength.get()) {
-              keyFound = true;
-              nextKey = new KeyValue(matcher.group(PATTERN_KEY_GROUP_NUMBER),
-                  matcher.group(PATTERN_SEQ_GROUP_NUMBER),
-                  matcher.group(PATTERN_TYPE_GROUP_NUMBER),
-                  valueStr);
-            }
-          }
-        }
-      } catch (IOException e) {
-        throw new RuntimeIOException(e);
+    nextKey = Optional.empty();
+    try {
+      Optional<byte[]> key = getNextByteArray();
+      if (!key.isPresent()) {
+        return getTransformedValue(currentKey);
       }
+      UnsignedLong sequenceNumber = getNextUnsignedLong()

Review Comment:
   getNextUnsignedLong() will throw an exception if it has number of bytes > 0. 
Here we are throwing an exception if the input stream has reached the end of 
the stream



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

Reply via email to