sv2000 commented on a change in pull request #2959: [GOBBLIN-1119] Enable 
close-on-flush for quality-checker's err-file
URL: https://github.com/apache/incubator-gobblin/pull/2959#discussion_r409739806
 
 

 ##########
 File path: 
gobblin-core/src/main/java/org/apache/gobblin/qualitychecker/row/RowLevelPolicyChecker.java
 ##########
 @@ -197,7 +198,23 @@ public State getFinalState() {
    * @return a {@link ControlMessageHandler}.
    */
   protected ControlMessageHandler getMessageHandler() {
-    return ControlMessageHandler.NOOP;
+    /**
+     * When seeing {@link FlushControlMessage and using ERR_FILE as the 
quality-checker handling,
+     * close the open error file and create new one.
+     */
+    return new ControlMessageHandler() {
+      @Override
+      public void handleMessage(ControlMessage message) {
+        if (message instanceof FlushControlMessage ) {
+          try {
+            RowLevelPolicyChecker.this.close();
+            RowLevelPolicyChecker.this.writer = new 
RowLevelErrFileWriter(RowLevelPolicyChecker.this.fs);
 
 Review comment:
   Can the creation be moved inside checkResult() where we check if the file is 
open or not?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to