Skip to content

Commit

Permalink
add lock for ModificationFile.remove
Browse files Browse the repository at this point in the history
  • Loading branch information
shuwenwei committed Jan 23, 2025
1 parent c05079b commit 74974dd
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,13 +336,18 @@ public boolean exists() {
}

public void remove() throws IOException {
close();
FileUtils.deleteFileOrDirectory(file);
if (fileExists) {
updateModFileMetric(-1, -getFileLength());
lock.writeLock().lock();
try {
close();
FileUtils.deleteFileOrDirectory(file);
if (fileExists) {
updateModFileMetric(-1, -getFileLength());
}
fileExists = false;
removed = true;
} finally {
lock.writeLock().unlock();
}
fileExists = false;
removed = true;
}

public static ModificationFile getExclusiveMods(TsFileResource tsFileResource) {
Expand Down

0 comments on commit 74974dd

Please sign in to comment.