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/28 06:08:26 UTC

[GitHub] [flink] pnowojski commented on a change in pull request #12364: [FLINK-17986] Fix check in FsCheckpointStateOutputStream.write

pnowojski commented on a change in pull request #12364:
URL: https://github.com/apache/flink/pull/12364#discussion_r431601126



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/state/filesystem/FsCheckpointStreamFactoryTest.java
##########
@@ -57,6 +57,23 @@ public void createStateDirectories() throws IOException {
 	//  tests
 	// ------------------------------------------------------------------------
 
+	@Test
+	@SuppressWarnings("ConstantConditions")
+	public void testWriteFlushesIfAboveThreshold() throws IOException {
+		int fileSizeThreshold = 100;
+		final FsCheckpointStreamFactory factory = createFactory(FileSystem.getLocalFileSystem(), fileSizeThreshold, fileSizeThreshold);
+		final FsCheckpointStreamFactory.FsCheckpointStateOutputStream stream = factory.createCheckpointStateOutputStream(CheckpointedStateScope.EXCLUSIVE);
+		stream.write(new byte[fileSizeThreshold]);
+		File[] files = new File(exclusiveStateDir.toUri()).listFiles();
+		assertEquals(1, files.length);
+		File file = files[0];
+		assertEquals(fileSizeThreshold, file.length());
+		for (int i = 0; i < fileSizeThreshold; i++) {
+			stream.write(127); // should buffer without flushing
+		}

Review comment:
       add an additional
   ```
   stream.write(new byte[10]);
   ```
   call to also check the other write method for the flushing problem?




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