Skip to content

Commit 70eb936

Browse files
committed
HBASE-30355 addendum: clean up MiniKdc dir on genuine (non-bind) setup failure too
Move the deleteDirectory(dir) call ahead of the isBindException check in setupMiniKdc's catch block so the partially-initialized kdc dir is cleaned up before rethrowing a non-bind failure, not just on a retried bind conflict. Per review comment from virajjasani on PR #8604.
1 parent 9928929 commit 70eb936

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

hbase-http/src/test/java/org/apache/hadoop/hbase/http/log/TestLogLevel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ static private MiniKdc setupMiniKdc() throws Exception {
159159
// KrbException whose shape varies by version (see isBindException), so we recognise the
160160
// port conflict via that predicate rather than a type. We also avoid importing kerby types
161161
// here (see HBASE-29117).
162+
FileUtils.deleteDirectory(dir); // clean directory regardless of failure type
162163
if (!isBindException(e)) {
163164
throw e; // not a port conflict, do not mask the real failure behind a retry
164165
}
165-
FileUtils.deleteDirectory(dir); // clean directory
166166
numTries++;
167167
if (numTries == 3) {
168168
log.error("Failed setting up MiniKDC. Tried " + numTries + " times.");

hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3737,10 +3737,10 @@ public MiniKdc setupMiniKdc(File keytabFile) throws Exception {
37373737
// KrbException whose shape varies by version (see isBindException), so we recognise the
37383738
// port conflict via that predicate rather than a type. We also avoid importing kerby types
37393739
// here (see HBASE-29117).
3740+
FileUtils.deleteDirectory(dir); // clean directory regardless of failure type
37403741
if (!isBindException(e)) {
37413742
throw e; // not a port conflict, do not mask the real failure behind a retry
37423743
}
3743-
FileUtils.deleteDirectory(dir); // clean directory
37443744
numTries++;
37453745
if (numTries == 3) {
37463746
LOG.error("Failed setting up MiniKDC. Tried " + numTries + " times.");

0 commit comments

Comments
 (0)