You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "rkhachatryan (via GitHub)" <gi...@apache.org> on 2023/02/09 14:37:03 UTC
[GitHub] [flink] rkhachatryan commented on a diff in pull request #21679: [FLINK-30561][state/changelog] fix changelog local cache file not found
rkhachatryan commented on code in PR #21679:
URL: https://github.com/apache/flink/pull/21679#discussion_r1101557635
##########
flink-dstl/flink-dstl-dfs/src/main/java/org/apache/flink/changelog/fs/ChangelogStreamHandleReaderWithCache.java:
##########
@@ -161,23 +161,28 @@ private FileInputStream openAndSeek(RefCountedFile refCountedFile, long offset)
private DataInputStream wrapStream(Path dfsPath, FileInputStream fin) {
return new DataInputStream(new BufferedInputStream(fin)) {
+ private boolean closed = false;
+
@Override
public void close() throws IOException {
- try {
- super.close();
- } finally {
- cache.computeIfPresent(
- dfsPath,
- (key, value) -> {
- value.release();
- if (value.getReferenceCounter() == NO_USING_REF_COUNT) {
- cacheCleanScheduler.schedule(
- () -> cleanCacheFile(dfsPath),
- cacheIdleMillis,
- TimeUnit.MILLISECONDS);
- }
- return value;
- });
+ if (!closed) {
+ closed = true;
Review Comment:
Yes, you're right, thanks for the correction
(I've also checked whether it can be closed by a non-task thread (e.g. watchdog), but that's not the case).
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org