szetszwo commented on code in PR #8203: URL: https://github.com/apache/ozone/pull/8203#discussion_r2021285189
########## hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStoreAbstractIterator.java: ########## @@ -94,16 +98,25 @@ private void setCurrentEntry() { @Override public final boolean hasNext() { - return rocksDBIterator.get().isValid() && - (prefix == null || startsWithPrefix(key())); + try { + if (!seekDoneAtleastOnce) { + throw new NoSuchElementException("Cannot check iterator hasNext before seeking either to start of iter or " + + "seeking to a specific key"); + } + return currentEntry != null && + (prefix == null || startsWithPrefix(currentEntry.getKey())); + } catch (IOException e) { + throw new UncheckedIOException(e); + } Review Comment: We should not introduce new exceptions. Why the exceptions were not needed previously? -- 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-unsubscr...@ozone.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org For additional commands, e-mail: issues-h...@ozone.apache.org