adoroszlai commented on code in PR #5051:
URL: https://github.com/apache/ozone/pull/5051#discussion_r1261107848
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1045,6 +1014,17 @@ private <T> boolean isKeyPresentInTable(String keyPrefix,
// Case 1: We found an entry, but no cache entry.
if (cacheValue == null) {
// we found at least one key with this prefix.
+ // There is chance cache value flushed when
+ // we iterate through the table.
+ // Check in table whether it is deleted or still present.
+ if (table.getIfExist(kv.getKey()) == null) {
+ if (!keyIter.hasNext()) {
+ break;
+ }
+ kv = keyIter.next();
+ continue;
+ }
Review Comment:
Nit: we could avoid duplicating steps for `keyIter` by converting to
`if-else`. Something like this:
```java
// Case 1: We found an entry, but no cache entry.
if (cacheValue == null) {
// we found at least one key with this prefix.
// There is chance cache value flushed when
// we iterate through the table.
// Check in table whether it is deleted or still present.
if (table.getIfExist(kv.getKey()) != null) {
// Still in table and no entry in cache
return true;
}
} else if (cacheValue.getCacheValue() != null) {
// Case 2a:
// We found a cache entry and cache value is not null.
return true;
}
```
--
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]