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 2022/03/02 03:28:37 UTC

[GitHub] [flink] pltbkd opened a new pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

pltbkd opened a new pull request #18955:
URL: https://github.com/apache/flink/pull/18955


   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   CompactorOperatorStateHandler can not work with unaligned checkpoint currently. We should fix this or add a warning in the document. This PR is trying to fix this issue.
   
   
   ## Brief change log
   
     - Refactor CompactorOperatorStateHandler to support unaligned checkpoint, i.e., to make it able to accept more than or less than 1 summary and the committable belonging to it during a checkpoint.
     - This PR is based on FLINK-26403, so is containing the changes of this [PR](https://github.com/apache/flink/pull/18938). They are not included in the scope of this PR.
   
   ## Verifying this change
   
   This change added tests.
   
   ## 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, 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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589",
       "triggerID" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596",
       "triggerID" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "650e6950396955818a8cbac9c97b2f124a269586",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "650e6950396955818a8cbac9c97b2f124a269586",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 17927dc443ad1920cb4cfdc515416bcc32de87a9 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596) 
   * 650e6950396955818a8cbac9c97b2f124a269586 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589",
       "triggerID" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596",
       "triggerID" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8eb23d59267a9fd4fe6c481591be3f8795fe564e Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589) 
   * 17927dc443ad1920cb4cfdc515416bcc32de87a9 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3399dc27d3ecf631828c90da6c99ecdbf4b5978c Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 19fcc0e5728e9dd843c77f3f81c83e79d32cc84d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] gaoyunhaii commented on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   Thanks @pltbkd for the updates! I do not have other comments except for the above one


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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589",
       "triggerID" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596",
       "triggerID" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 17927dc443ad1920cb4cfdc515416bcc32de87a9 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589",
       "triggerID" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 19fcc0e5728e9dd843c77f3f81c83e79d32cc84d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518) 
   * 8eb23d59267a9fd4fe6c481591be3f8795fe564e Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589) 
   * 17927dc443ad1920cb4cfdc515416bcc32de87a9 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8c060065739158bb3df12e466e6d27754a67ea99 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] pltbkd commented on a change in pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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



##########
File path: flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactorOperatorStateHandler.java
##########
@@ -141,26 +135,68 @@ public void processElement(
             throws Exception {
         Either<CommittableMessage<FileSinkCommittable>, CompactorRequest> record =
                 element.getValue();
-        if (stateDrained) {
+        if (passingThroughAll) {

Review comment:
       I prefer not to make it a state enumeration since it's not so complex in my opinion. I suppose that a reorg of the code should be enough.




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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] gaoyunhaii commented on a change in pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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



##########
File path: flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactorOperatorStateHandler.java
##########
@@ -64,28 +69,15 @@
 
     private final FileCompactor fileCompactor;

Review comment:
       This class variable is not needed. 

##########
File path: flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactorOperatorStateHandler.java
##########
@@ -222,102 +264,64 @@ public void close() throws Exception {
         }
     }
 
-    private void submit(CompactorRequest request) {
-        CompletableFuture<Iterable<FileSinkCommittable>> resultFuture = new CompletableFuture<>();
-        compactService.submit(request, resultFuture);
-        compactingRequests.add(new Tuple2<>(request, resultFuture));
-    }
+    @Override
+    public void snapshotState(StateSnapshotContext context) throws Exception {
+        super.snapshotState(context);
+        if (compactingRequests.isEmpty()) {
+            return;
+        }
 
-    private void drain() throws ExecutionException, InterruptedException {
-        checkState(holdingSummary != null);
-        checkState(
-                holdingSummary.getNumberOfPendingCommittables()
-                                == holdingSummary.getNumberOfCommittables()
-                        && holdingSummary.getNumberOfCommittables()
-                                == holdingMessages.size() + compactingMessages.size());
-
-        Long checkpointId =
-                holdingSummary.getCheckpointId().isPresent()
-                        ? holdingSummary.getCheckpointId().getAsLong()
-                        : null;
-        int subtaskId = holdingSummary.getSubtaskId();
-
-        if (!compactingRequests.isEmpty()) {
-            CompletableFuture.allOf(
-                            compactingRequests.stream()
-                                    .map(r -> r.f1)
-                                    .toArray(CompletableFuture[]::new))
-                    .join();
-
-            for (Tuple2<CompactorRequest, CompletableFuture<Iterable<FileSinkCommittable>>>
-                    compacting : compactingRequests) {
-                CompletableFuture<Iterable<FileSinkCommittable>> future = compacting.f1;
-                checkState(future.isDone());
-                // Exception is thrown if it's completed exceptionally
-                for (FileSinkCommittable c : future.get()) {
-                    holdingMessages.add(new CommittableWithLineage<>(c, checkpointId, subtaskId));
+        // Results of some requests are not drained by a summary. They should be reserved in the
+        // state and wait for the next summary.
+
+        List<CompactorRequest> remainingRequests = new ArrayList<>();
+        for (Tuple2<CompactorRequest, CompletableFuture<Iterable<FileSinkCommittable>>> t :
+                compactingRequests) {
+            if (t.f1.isDone()) {
+                // We can add the results as a pass-through request if the compaction is done
+                Iterable<FileSinkCommittable> result = t.f1.get();
+                if (result.iterator().hasNext()) {
+                    String bucketId = result.iterator().next().getBucketId();
+                    CompactorRequest passThroughRequest = new CompactorRequest(bucketId);
+                    result.forEach(passThroughRequest::addToPassthrough);
+                    remainingRequests.add(passThroughRequest);
                 }
+            } else {
+                // Or we add the original request in the state
+                remainingRequests.add(t.f0);
             }
         }
+        Map<Long, List<CompactorRequest>> requestsMap = new HashMap<>();
+        requestsMap.put(-1L, remainingRequests);
+        remainingRequestsState.update(Collections.singletonList(requestsMap));
+    }
 
-        // Appending the compacted committable to the holding summary
-        CommittableSummary<FileSinkCommittable> summary =
-                new CommittableSummary<>(
-                        holdingSummary.getSubtaskId(),
-                        holdingSummary.getNumberOfSubtasks(),
-                        holdingSummary.getCheckpointId().isPresent()
-                                ? holdingSummary.getCheckpointId().getAsLong()
-                                : null,
-                        holdingMessages.size(),
-                        holdingMessages.size(),
-                        holdingSummary.getNumberOfFailedCommittables());
-        output.collect(new StreamRecord<>(summary));
-        for (CommittableMessage<FileSinkCommittable> committable : holdingMessages) {
-            output.collect(new StreamRecord<>(committable));
-        }
-
-        // Remaining requests should be all done and their results are all emitted.
-        // From now on the operator is stateless.
-        remainingRequestsState.clear();
-
-        compactingRequests.clear();
-        compactingMessages.clear();
-        holdingSummary = null;
-        holdingMessages = null;
-
-        if (writerStateDrained) {
-            // We can pass through everything if the writer state is also drained.
-            stateDrained = true;
-            compactService.close();
-            compactService = null;
-        }
+    private CompletableFuture<Iterable<FileSinkCommittable>> submit(CompactorRequest request) {
+        CompletableFuture<Iterable<FileSinkCommittable>> resultFuture = new CompletableFuture<>();
+        compactService.submit(request, resultFuture);
+        return resultFuture;
     }
 
     @Override
     public void initializeState(StateInitializationContext context) throws Exception {

Review comment:
       Perhaps we could move the `initializeState` to be before the `open` function so that the functions follows the order of execution. 

##########
File path: flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactorOperatorStateHandler.java
##########
@@ -141,26 +135,68 @@ public void processElement(
             throws Exception {
         Either<CommittableMessage<FileSinkCommittable>, CompactorRequest> record =
                 element.getValue();
-        if (stateDrained) {
+        if (passingThroughAll) {

Review comment:
       The implementation of this method looks a bit complex to me. From my view it would be better if we could keep a style of state machine: 
   
   ```
     Either<CommittableMessage<FileSinkCommittable>, CompactorRequest> record =
             element.getValue();
     if (passingThroughAll) {
         // all input should be committable messages to pass through
         output.collect(new StreamRecord<>(record.left()));
         return;
     } else if (passingThrough) {
         // 1. if it is a committable, emit it directly
         // 2. else if it is summary
         //  2.a if compacting result is empty
         //  2.b if not
     } else {
         // 1. if it is compacting request, submit it
         // 2. else if it is summary
         //  2.a if compacting result is empty
         //  2.b if not
         // 3. else if it is a committable
         //  3.a if it is not normal, deal with it
         //  3.b if it is normal, passing through = true
     }
   ```
   
   We may change the `passingThrough` and `passingThroughAll` back to a state enumeration. 
   
   Besides, we could extract the sub-process to handle the `CommittableSummary` and `normal / hiddle` Committables to private functions to further reduce the complexity of this method.




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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589",
       "triggerID" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596",
       "triggerID" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "650e6950396955818a8cbac9c97b2f124a269586",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32614",
       "triggerID" : "650e6950396955818a8cbac9c97b2f124a269586",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 650e6950396955818a8cbac9c97b2f124a269586 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32614) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589",
       "triggerID" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 19fcc0e5728e9dd843c77f3f81c83e79d32cc84d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518) 
   * 8eb23d59267a9fd4fe6c481591be3f8795fe564e Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3399dc27d3ecf631828c90da6c99ecdbf4b5978c Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409) 
   * 19fcc0e5728e9dd843c77f3f81c83e79d32cc84d Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot commented on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8c060065739158bb3df12e466e6d27754a67ea99 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8c060065739158bb3df12e466e6d27754a67ea99 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403) 
   * 3399dc27d3ecf631828c90da6c99ecdbf4b5978c UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32589",
       "triggerID" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "triggerType" : "PUSH"
     }, {
       "hash" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596",
       "triggerID" : "17927dc443ad1920cb4cfdc515416bcc32de87a9",
       "triggerType" : "PUSH"
     }, {
       "hash" : "650e6950396955818a8cbac9c97b2f124a269586",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32614",
       "triggerID" : "650e6950396955818a8cbac9c97b2f124a269586",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 17927dc443ad1920cb4cfdc515416bcc32de87a9 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32596) 
   * 650e6950396955818a8cbac9c97b2f124a269586 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32614) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] gaoyunhaii closed pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

Posted by GitBox <gi...@apache.org>.
gaoyunhaii closed pull request #18955:
URL: https://github.com/apache/flink/pull/18955


   


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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] gaoyunhaii commented on a change in pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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



##########
File path: flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/sink/compactor/operator/CompactorOperatorStateHandler.java
##########
@@ -222,102 +278,61 @@ public void close() throws Exception {
         }
     }
 
-    private void submit(CompactorRequest request) {
-        CompletableFuture<Iterable<FileSinkCommittable>> resultFuture = new CompletableFuture<>();
-        compactService.submit(request, resultFuture);
-        compactingRequests.add(new Tuple2<>(request, resultFuture));
-    }
+    @Override
+    public void snapshotState(StateSnapshotContext context) throws Exception {
+        super.snapshotState(context);
+        if (compactingRequests.isEmpty()) {
+            return;
+        }
 
-    private void drain() throws ExecutionException, InterruptedException {
-        checkState(holdingSummary != null);
-        checkState(
-                holdingSummary.getNumberOfPendingCommittables()
-                                == holdingSummary.getNumberOfCommittables()
-                        && holdingSummary.getNumberOfCommittables()
-                                == holdingMessages.size() + compactingMessages.size());
-
-        Long checkpointId =
-                holdingSummary.getCheckpointId().isPresent()
-                        ? holdingSummary.getCheckpointId().getAsLong()
-                        : null;
-        int subtaskId = holdingSummary.getSubtaskId();
-
-        if (!compactingRequests.isEmpty()) {
-            CompletableFuture.allOf(
-                            compactingRequests.stream()
-                                    .map(r -> r.f1)
-                                    .toArray(CompletableFuture[]::new))
-                    .join();
-
-            for (Tuple2<CompactorRequest, CompletableFuture<Iterable<FileSinkCommittable>>>
-                    compacting : compactingRequests) {
-                CompletableFuture<Iterable<FileSinkCommittable>> future = compacting.f1;
-                checkState(future.isDone());
-                // Exception is thrown if it's completed exceptionally
-                for (FileSinkCommittable c : future.get()) {
-                    holdingMessages.add(new CommittableWithLineage<>(c, checkpointId, subtaskId));
+        // Results of some requests are not drained by a summary. They should be reserved in the
+        // state and wait for the next summary.
+
+        List<CompactorRequest> remainingRequests = new ArrayList<>();
+        for (Tuple2<CompactorRequest, CompletableFuture<Iterable<FileSinkCommittable>>> t :
+                compactingRequests) {
+            if (t.f1.isDone()) {
+                // We can add the results as a pass-through request if the compaction is done
+                Iterable<FileSinkCommittable> result = t.f1.get();
+                if (result.iterator().hasNext()) {
+                    String bucketId = result.iterator().next().getBucketId();
+                    CompactorRequest passThroughRequest = new CompactorRequest(bucketId);
+                    result.forEach(passThroughRequest::addToPassthrough);
+                    remainingRequests.add(passThroughRequest);
                 }
+            } else {
+                // Or we add the original request in the state
+                remainingRequests.add(t.f0);
             }
         }
-
-        // Appending the compacted committable to the holding summary
-        CommittableSummary<FileSinkCommittable> summary =
-                new CommittableSummary<>(
-                        holdingSummary.getSubtaskId(),
-                        holdingSummary.getNumberOfSubtasks(),
-                        holdingSummary.getCheckpointId().isPresent()
-                                ? holdingSummary.getCheckpointId().getAsLong()
-                                : null,
-                        holdingMessages.size(),
-                        holdingMessages.size(),
-                        holdingSummary.getNumberOfFailedCommittables());
-        output.collect(new StreamRecord<>(summary));
-        for (CommittableMessage<FileSinkCommittable> committable : holdingMessages) {
-            output.collect(new StreamRecord<>(committable));
-        }
-
-        // Remaining requests should be all done and their results are all emitted.
-        // From now on the operator is stateless.
-        remainingRequestsState.clear();
-
-        compactingRequests.clear();
-        compactingMessages.clear();
-        holdingSummary = null;
-        holdingMessages = null;
-
-        if (writerStateDrained) {
-            // We can pass through everything if the writer state is also drained.
-            stateDrained = true;
-            compactService.close();
-            compactService = null;
-        }
+        Map<Long, List<CompactorRequest>> requestsMap = new HashMap<>();
+        requestsMap.put(-1L, remainingRequests);
+        remainingRequestsState.update(Collections.singletonList(requestsMap));
     }
 
-    @Override
-    public void initializeState(StateInitializationContext context) throws Exception {
-        super.initializeState(context);
-
-        remainingRequestsState =
-                new SimpleVersionedListState<>(
-                        context.getOperatorStateStore()
-                                .getListState(REMAINING_REQUESTS_RAW_STATES_DESC),
-                        new RemainingRequestsSerializer(
-                                new CompactorRequestSerializer(committableSerializer)));
-
-        stateRemaining = remainingRequestsState.get();
+    private Long getCheckpointId(CommittableMessage<FileSinkCommittable> message) {
+        return message.getCheckpointId().isPresent() ? message.getCheckpointId().getAsLong() : null;
+    }
 
-        // stateDrained can not be determined here, since even if the stateRemaining is empty,
-        // there may still be some requests from the coordinator and a in-progress file in the file
-        // writer
+    private CompletableFuture<Iterable<FileSinkCommittable>> submit(CompactorRequest request) {
+        CompletableFuture<Iterable<FileSinkCommittable>> resultFuture = new CompletableFuture<>();
+        compactService.submit(request, resultFuture);
+        return resultFuture;
     }
 
     @VisibleForTesting
-    public boolean isWriterStateDrained() {
-        return writerStateDrained;
+    public boolean isPassingThroughCommittable() {
+        return state == State.PASSING_THROUGH_COMMITTABLE;
     }
 
     @VisibleForTesting
-    public boolean isStateDrained() {
-        return stateDrained;
+    public boolean isPassingThroughAll() {
+        return state == State.PASSING_THROUGH_ALL;
+    }
+
+    private enum State {

Review comment:
       Perhaps add some comments for the whole class to describe the state transition?




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

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3399dc27d3ecf631828c90da6c99ecdbf4b5978c Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409) 
   * 19fcc0e5728e9dd843c77f3f81c83e79d32cc84d UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     }, {
       "hash" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518",
       "triggerID" : "19fcc0e5728e9dd843c77f3f81c83e79d32cc84d",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8eb23d59267a9fd4fe6c481591be3f8795fe564e",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 19fcc0e5728e9dd843c77f3f81c83e79d32cc84d Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32518) 
   * 8eb23d59267a9fd4fe6c481591be3f8795fe564e UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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



[GitHub] [flink] flinkbot edited a comment on pull request #18955: [FLINK-26440] CompactorOperatorStateHandler can not work with unaligned checkpoint.

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403",
       "triggerID" : "8c060065739158bb3df12e466e6d27754a67ea99",
       "triggerType" : "PUSH"
     }, {
       "hash" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409",
       "triggerID" : "3399dc27d3ecf631828c90da6c99ecdbf4b5978c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8c060065739158bb3df12e466e6d27754a67ea99 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32403) 
   * 3399dc27d3ecf631828c90da6c99ecdbf4b5978c Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=32409) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </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.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

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