Skip to content

Commit a4899e3

Browse files
xuzifu666K0K0V0K
authored andcommitted
HADOOP-19073 WASB: Fix connection leak in FolderRenamePending (apache#6534)
Contributed by xuyu
1 parent ad11bf2 commit a4899e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/NativeAzureFileSystem.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,12 @@ public FolderRenamePending(Path redoFile, NativeAzureFileSystem fs)
160160

161161
// open redo file
162162
Path f = redoFile;
163-
FSDataInputStream input = fs.open(f);
164-
byte[] bytes = new byte[MAX_RENAME_PENDING_FILE_SIZE];
165-
int l = input.read(bytes);
163+
int l;
164+
byte[] bytes;
165+
try (FSDataInputStream input = fs.open(f)) {
166+
bytes = new byte[MAX_RENAME_PENDING_FILE_SIZE];
167+
l = input.read(bytes);
168+
}
166169
if (l <= 0) {
167170
// Jira HADOOP-12678 -Handle empty rename pending metadata file during
168171
// atomic rename in redo path. If during renamepending file is created

0 commit comments

Comments
 (0)