Skip to content

Commit

Permalink
Prevent asyncUpdateFileAccessTime to bring down applications
Browse files Browse the repository at this point in the history
Cherry-pick of existing commit.
orig-pr: #10687
orig-commit: 244ef3f
orig-commit-author: Bin Fan <fanbin103@gmail.com>

pr-link: #10765
change-id: cid-7cc493f019741f6e35584100ba3b5e0fd0a027c4
  • Loading branch information
alluxio-bot committed Jan 17, 2020
1 parent 46dffb2 commit 5ece322
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -111,18 +112,22 @@ public List<URIStatus> listStatus(AlluxioURI path, ListStatusPOptions options)
*/
@VisibleForTesting
public void asyncUpdateFileAccessTime(AlluxioURI path) {
mAccessTimeUpdater.submit(() -> {
try {
AlluxioConfiguration conf = mFsContext.getPathConf(path);
GetStatusPOptions getStatusOptions = FileSystemOptions.getStatusDefaults(conf).toBuilder()
.setAccessMode(Bits.READ)
.setUpdateTimestamps(true)
.build();
super.getStatus(path, getStatusOptions);
} catch (IOException | AlluxioException e) {
LOG.error("Failed to update access time for file " + path, e);
}
});
try {
mAccessTimeUpdater.submit(() -> {
try {
AlluxioConfiguration conf = mFsContext.getPathConf(path);
GetStatusPOptions getStatusOptions = FileSystemOptions.getStatusDefaults(conf).toBuilder()
.setAccessMode(Bits.READ)
.setUpdateTimestamps(true)
.build();
super.getStatus(path, getStatusOptions);
} catch (IOException | AlluxioException e) {
LOG.error("Failed to update access time for " + path, e);
}
});
} catch (RejectedExecutionException e) {
LOG.warn("Failed to submit a task to update access time for {}: {}", path, e.toString());
}
}

@Override
Expand Down

0 comments on commit 5ece322

Please sign in to comment.