New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-32087][checkpoint] Introduce space amplification statistics of file merging #24762
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pr, i left some comments
long physicalFileSize, | ||
long logicalFileCount, | ||
long logicalFileSize) { | ||
this.physicalFileCount = new AtomicLong(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it this.physicalFileCount = new AtomicLong(physicalFileCount);
?
@@ -607,6 +619,7 @@ public void restoreStateHandles( | |||
fileHandle.getScope())) | |||
? physicalFileDeleter | |||
: null; | |||
spaceStat.onPhysicalFileCreate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this is not true. If the isManagedByFileMergingManager
returns false, there will be no file deleter, so no spaceStat
will be updated after file deletion. I'd suggest skip spaceStat
if isManagedByFileMergingManager
returns false. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree👍, only update spaceStat
when isManagedByFileMergingManager
return true.
...ain/java/org/apache/flink/runtime/checkpoint/filemerging/FileMergingSnapshotManagerBase.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! Some further comments left.
...ain/java/org/apache/flink/runtime/checkpoint/filemerging/FileMergingSnapshotManagerBase.java
Outdated
Show resolved
Hide resolved
path, | ||
subtaskKey, | ||
fileHandle.getScope())) | ||
managedByFileMergingManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that there is owned
attribute within the PhysicalFile
, how about remove this diversion and wrap everything within the PhysicalFile
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the setting of FileDeleter
into PhysicalFile
, and left SpaceStat.update()
in FileMergingSnapshotManager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update! Overall LGTM. And will this SpaceStat
report to metrics?
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/filemerging/PhysicalFile.java
Outdated
Show resolved
Hide resolved
Currently no, will report to metric in FLINK-32091. |
What is the purpose of the change
This PR introduces space amplification statistics of file merging.
Brief change log
SpaceStat
class inFileMergingSnapshotManager
.SpaceStat
on physical/logical files's creation/deletionVerifying this change
Please make sure both new and modified tests in this PR follow the conventions for tests defined in our code quality guide.
This change added tests and can be verified as follows:
FileMergingSnapshotManagerTestBase#testSpaceStat
FileMergingSnapshotManagerTestBase#testRestore
testCreateAndReuseFiles/testCheckpointNotification
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (no)Documentation