kl0u commented on a change in pull request #7639: [FLINK-9920] Only check part 
files in BucketingSinkFaultToleranceITCase
URL: https://github.com/apache/flink/pull/7639#discussion_r253410173
 
 

 ##########
 File path: 
flink-connectors/flink-connector-filesystem/src/main/java/org/apache/flink/streaming/connectors/fs/RollingSink.java
 ##########
 @@ -533,26 +533,34 @@ private Method reflectTruncate(FileSystem fs) {
                        }
 
                        // verify that truncate actually works
-                       Path testPath = new Path(UUID.randomUUID().toString());
-                       try (FSDataOutputStream outputStream = 
fs.create(testPath)) {
-                               outputStream.writeUTF("hello");
-                       } catch (IOException e) {
-                               LOG.error("Could not create file for checking 
if truncate works.", e);
-                               throw new RuntimeException("Could not create 
file for checking if truncate works.", e);
-                       }
-
+                       Path testPath = new Path(basePath, 
UUID.randomUUID().toString());
                        try {
-                               m.invoke(fs, testPath, 2);
-                       } catch (IllegalAccessException | 
InvocationTargetException e) {
-                               LOG.debug("Truncate is not supported.", e);
-                               m = null;
-                       }
+                               try (FSDataOutputStream outputStream = 
fs.create(testPath)) {
+                                       outputStream.writeUTF("hello");
+                               } catch (IOException e) {
+                                       LOG.error("Could not create file for 
checking if truncate works.", e);
+                                       throw new RuntimeException(
+                                                       "Could not create file 
for checking if truncate works. " +
+                                                                       "You 
can disable support for truncate() completely via " +
+                                                                       
"BucketingSink.setUseTruncate(false).",
+                                                       e);
 
 Review comment:
   Nit: Move the `e` back to the previous line for uniformity. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to