Skip to content

Commit 2dd7942

Browse files
fix bug in code causing test failure.
1 parent a42d2e4 commit 2dd7942

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

hadoop-hdds/common/src/main/java/org/apache/hadoop/utils/db/TypedTable.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,16 @@ public TypedTable(
100100
//fill cache
101101
try(TableIterator<KEY, ? extends KeyValue<KEY, VALUE>> tableIterator =
102102
iterator()) {
103-
KeyValue<KEY, VALUE> kv = tableIterator.next();
104103

105-
// We should build cache after OM restart when clean up policy is NEVER.
106-
// Setting epoch value -1, so that when it is marked for delete, this
107-
// will be considered for cleanup.
108-
cache.put(new CacheKey<>(kv.getKey()),
109-
new CacheValue<>(Optional.of(kv.getValue()), EPOCH_DEFAULT));
104+
while (tableIterator.hasNext()) {
105+
KeyValue< KEY, VALUE > kv = tableIterator.next();
106+
107+
// We should build cache after OM restart when clean up policy is NEVER.
108+
// Setting epoch value -1, so that when it is marked for delete, this
109+
// will be considered for cleanup.
110+
cache.put(new CacheKey<>(kv.getKey()),
111+
new CacheValue<>(Optional.of(kv.getValue()), EPOCH_DEFAULT));
112+
}
110113
}
111114
}
112115
}

0 commit comments

Comments
 (0)