You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/05/27 03:22:00 UTC

[GitHub] [flink] rkhachatryan opened a new pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

rkhachatryan opened a new pull request #12332:
URL: https://github.com/apache/flink/pull/12332


   ## What is the purpose of the change
   
   See FLINK-17820 for full problem description. In short, Flink ignores `state.backend.fs.memory-threshold` and always creates a file per subtask per checkpoint.
   
   This PR makes `FsCheckpointStateOutputStream.flush()` to take `fileStateThreshold` into account.
   
   ## Verifying this change
   
   This change added tests:
    - `FsCheckpointStreamFactoryTest.testFlushUnderThreshold`
    - `FsCheckpointStreamFactoryTest.testFlushAboveThreshold`
    - `ChannelStateCheckpointWriterTest.testSmallFilesNotWritten`
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] zhijiangW commented on a change in pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
zhijiangW commented on a change in pull request #12332:
URL: https://github.com/apache/flink/pull/12332#discussion_r430517711



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java
##########
@@ -266,6 +264,16 @@ public void flush() throws IOException {
 			}
 		}
 
+		/**
+		 * Flush buffers to file if their size is above {@link #localStateThreshold}.
+		 */
+		@Override
+		public void flush() throws IOException {
+			if (pos > localStateThreshold) {

Review comment:
       I guess the added condition of `stream != null` is not addressed yet?

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/channel/ChannelStateCheckpointWriterTest.java
##########
@@ -95,12 +118,12 @@ public void flush() throws IOException {
 
 		FlushRecorder dataStream = new FlushRecorder();
 		final ChannelStateCheckpointWriter writer = new ChannelStateCheckpointWriter(
-			1L,
-			new ChannelStateWriteResult(),
-			new ChannelStateSerializerImpl(),
-			NO_OP_RUNNABLE,
-			new MemoryCheckpointOutputStream(42),
-			dataStream
+				1L,

Review comment:
       nit: unnecessary formatting changes, I guess it was done automatically by IDE.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] zhijiangW merged pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
zhijiangW merged pull request #12332:
URL: https://github.com/apache/flink/pull/12332


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12332:
URL: https://github.com/apache/flink/pull/12332#issuecomment-633845319


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit f08cd17559f206395e11f2a2e7f3dae093941f1d (Fri Oct 16 10:56:30 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #12332:
URL: https://github.com/apache/flink/pull/12332#issuecomment-633855581






----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] StephanEwen commented on a change in pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
StephanEwen commented on a change in pull request #12332:
URL: https://github.com/apache/flink/pull/12332#discussion_r430231771



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java
##########
@@ -247,15 +247,13 @@ public long getPos() throws IOException {
 			return pos + (outStream == null ? 0 : outStream.getPos());
 		}
 
-		@Override
-		public void flush() throws IOException {
+		private void flushToFile() throws IOException {

Review comment:
       We can make this public, let the tests call it directly.

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java
##########
@@ -266,6 +264,16 @@ public void flush() throws IOException {
 			}
 		}
 
+		/**
+		 * Flush buffers to file if their size is above {@link #localStateThreshold}.
+		 */
+		@Override
+		public void flush() throws IOException {
+			if (pos > localStateThreshold) {

Review comment:
       Maybe extend this to `if (stream != null || pos > localStateThreshold)`?

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStorageTest.java
##########
@@ -165,8 +165,7 @@ public void testDirectoriesForExclusiveAndSharedState() throws Exception {
 		CheckpointStateOutputStream exclusiveStream =
 				storageLocation.createCheckpointStateOutputStream(CheckpointedStateScope.EXCLUSIVE);
 
-		exclusiveStream.write(42);
-		exclusiveStream.flush();

Review comment:
       If we type the `exclusiveStream` to `FsCheckpointStateOutputStream`, we could call `flushToFile()` directly.
   Then we don't implicitly rely on the threshold logic here as well.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #12332:
URL: https://github.com/apache/flink/pull/12332#issuecomment-633845319






----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] rkhachatryan commented on pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on pull request #12332:
URL: https://github.com/apache/flink/pull/12332#issuecomment-633903499


   Thanks for the review @StephanEwen,
   I've addressed the issues you raised.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] StephanEwen commented on pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
StephanEwen commented on pull request #12332:
URL: https://github.com/apache/flink/pull/12332#issuecomment-633929709


   Thanks for the quick turnaround.
   
   +1 to merge this from my side


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] rkhachatryan commented on a change in pull request #12332: [FLINK-17820][task][checkpointing] Respect fileSizeThreshold in FsCheckpointStateOutputStream.flush()

Posted by GitBox <gi...@apache.org>.
rkhachatryan commented on a change in pull request #12332:
URL: https://github.com/apache/flink/pull/12332#discussion_r430263134



##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java
##########
@@ -266,6 +264,16 @@ public void flush() throws IOException {
 			}
 		}
 
+		/**
+		 * Flush buffers to file if their size is above {@link #localStateThreshold}.
+		 */
+		@Override
+		public void flush() throws IOException {
+			if (pos > localStateThreshold) {

Review comment:
       Makes sense, expanded the condition.

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java
##########
@@ -247,15 +247,13 @@ public long getPos() throws IOException {
 			return pos + (outStream == null ? 0 : outStream.getPos());
 		}
 
-		@Override
-		public void flush() throws IOException {
+		private void flushToFile() throws IOException {

Review comment:
       Done.

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStorageTest.java
##########
@@ -165,8 +165,7 @@ public void testDirectoriesForExclusiveAndSharedState() throws Exception {
 		CheckpointStateOutputStream exclusiveStream =
 				storageLocation.createCheckpointStateOutputStream(CheckpointedStateScope.EXCLUSIVE);
 
-		exclusiveStream.write(42);
-		exclusiveStream.flush();

Review comment:
       Good point!

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactory.java
##########
@@ -266,6 +264,16 @@ public void flush() throws IOException {
 			}
 		}
 
+		/**
+		 * Flush buffers to file if their size is above {@link #localStateThreshold}.
+		 */
+		@Override
+		public void flush() throws IOException {
+			if (pos > localStateThreshold) {

Review comment:
       I must have reverted it while updating the tests. Fixed.

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/channel/ChannelStateCheckpointWriterTest.java
##########
@@ -95,12 +118,12 @@ public void flush() throws IOException {
 
 		FlushRecorder dataStream = new FlushRecorder();
 		final ChannelStateCheckpointWriter writer = new ChannelStateCheckpointWriter(
-			1L,
-			new ChannelStateWriteResult(),
-			new ChannelStateSerializerImpl(),
-			NO_OP_RUNNABLE,
-			new MemoryCheckpointOutputStream(42),
-			dataStream
+				1L,

Review comment:
       Yes, accidental change, reverted it.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org