LuciferYang commented on code in PR #36200:
URL: https://github.com/apache/spark/pull/36200#discussion_r938436383
##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java:
##########
@@ -457,18 +457,19 @@ static ConcurrentMap<AppExecId, ExecutorShuffleInfo>
reloadRegisteredExecutors(D
throws IOException {
ConcurrentMap<AppExecId, ExecutorShuffleInfo> registeredExecutors =
Maps.newConcurrentMap();
if (db != null) {
- DBIterator itr = db.iterator();
- itr.seek(APP_KEY_PREFIX.getBytes(StandardCharsets.UTF_8));
- while (itr.hasNext()) {
- Map.Entry<byte[], byte[]> e = itr.next();
- String key = new String(e.getKey(), StandardCharsets.UTF_8);
- if (!key.startsWith(APP_KEY_PREFIX)) {
- break;
+ try (DBIterator itr = db.iterator()) {
Review Comment:
Use `try -with-resources` to ensure that the DBIterator is closed after
used, this change is more like a bug fix. I want to give a PR to fix it first,
then the code diff here will be reduced in this pr
--
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]