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/29 08:04:34 UTC

[GitHub] [flink] rkhachatryan opened a new pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


   ## What is the purpose of the change
   
   Migrating `ContinuousFileReaderOperator` to mailbox execution model caused performance regression.
   This PR eliminates it by avoiding going through the mailbox unnecessarily.
   
   Local results before and after optimization (with [benchmark fix](https://github.com/dataArtisans/flink-benchmarks/pull/63) applied):
   ```
   ContinuousFileReaderOperatorBenchmark.readFileSplit  thrpt   30  10444.184 ± 228.434  ops/ms
   ContinuousFileReaderOperatorBenchmark.readFileSplit  thrpt   30  31451.848 ± 849.005  ops/ms
   ```
   Without the fix, results are better because it then does all the job in CLOSING phase in a loop. 
   So it's preferable to merge [benchmark fix](https://github.com/dataArtisans/flink-benchmarks/pull/63) first.
   
   ## Brief change log
   
     - loop in `ContinuousFileReaderOperator` if mailbox executor is idle
     - optimize `MailboxExecutor.isIdle`
   
   ## Verifying this change
   
     - correctness is covered by existing tests such as `ContinuousFileProcessingTest`
     - performance if measured by http://codespeed.dak8s.net:8000/
   
   ## 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): yes
     - 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] flinkbot edited a comment on pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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



[GitHub] [flink] flinkbot edited a comment on pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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



[GitHub] [flink] pnowojski merged pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


   


----------------------------------------------------------------
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] pnowojski commented on a change in pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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



##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
##########
@@ -276,6 +281,7 @@ protected StreamTask(
 		this.actionExecutor = Preconditions.checkNotNull(actionExecutor);
 		this.mailboxProcessor = new MailboxProcessor(this::processInput, mailbox, actionExecutor);
 		this.mailboxProcessor.initMetric(environment.getMetricGroup());
+		this.mainMailboxExecutor = new MailboxExecutorImpl(mailbox, MIN_PRIORITY, actionExecutor);

Review comment:
       I was thinking about doing here:
   ```
   this.mainMailboxExecutor = mailboxProcessor.getMainMailboxExecutor();
   ```
   or
   ```
   this.mainMailboxExecutor = mailboxProcessor.getMinPriorityMailboxExecutor();
   ```
   to maintain the contract, that everything goes via `MailboxProcessor` one way or another.
   
   As it is now, some actions are going via `mailbox` and `actionExecutor` bypassing the processor, which I'm not sure if it's as clean? But I'm not entirely sure.




----------------------------------------------------------------
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 #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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



##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
##########
@@ -276,6 +281,7 @@ protected StreamTask(
 		this.actionExecutor = Preconditions.checkNotNull(actionExecutor);
 		this.mailboxProcessor = new MailboxProcessor(this::processInput, mailbox, actionExecutor);
 		this.mailboxProcessor.initMetric(environment.getMetricGroup());
+		this.mainMailboxExecutor = new MailboxExecutorImpl(mailbox, MIN_PRIORITY, actionExecutor);

Review comment:
       Done.




----------------------------------------------------------------
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 #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


   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 1205b16ae32a45c11759d0f27898363ab988ecfb (Fri May 29 08:06:52 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 #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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



[GitHub] [flink] flinkbot edited a comment on pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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



[GitHub] [flink] flinkbot edited a comment on pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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



[GitHub] [flink] flinkbot edited a comment on pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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



[GitHub] [flink] pnowojski commented on a change in pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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



##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
##########
@@ -276,6 +281,7 @@ protected StreamTask(
 		this.actionExecutor = Preconditions.checkNotNull(actionExecutor);
 		this.mailboxProcessor = new MailboxProcessor(this::processInput, mailbox, actionExecutor);
 		this.mailboxProcessor.initMetric(environment.getMetricGroup());
+		this.mainMailboxExecutor = new MailboxExecutorImpl(mailbox, MIN_PRIORITY, actionExecutor);

Review comment:
       I was thinking about doing here:
   ```
   this.mainMailboxExecutor = mailboxProcessor.getMainMailboxExecutor();
   ```
   or
   ```
   this.mainMailboxExecutor = mailboxProcessor.getMinPriorityMailboxExecutor();
   ```
   to maintain the contract, that everything goes via `MailboxProcessor` one way or another.
   
   As it is now, some actions are going via `mailbox` and `actionExecutor` bypassing the processor, which I'm not sure if it's as clean?




----------------------------------------------------------------
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 #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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



##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/MailboxProcessor.java
##########
@@ -114,6 +114,7 @@ public MailboxProcessor(
 		this.actionExecutor = Preconditions.checkNotNull(actionExecutor);
 		this.mailbox = Preconditions.checkNotNull(mailbox);
 		this.mainMailboxExecutor = Preconditions.checkNotNull(mainMailboxExecutor);
+		((MailboxExecutorImpl) this.mainMailboxExecutor).setMailboxProcessor(this);

Review comment:
       Good idea!
   Removed `MailboxProcessor.mainMailboxExecutor` field.




----------------------------------------------------------------
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] pnowojski commented on a change in pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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



##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/MailboxProcessor.java
##########
@@ -114,6 +114,7 @@ public MailboxProcessor(
 		this.actionExecutor = Preconditions.checkNotNull(actionExecutor);
 		this.mailbox = Preconditions.checkNotNull(mailbox);
 		this.mainMailboxExecutor = Preconditions.checkNotNull(mainMailboxExecutor);
+		((MailboxExecutorImpl) this.mainMailboxExecutor).setMailboxProcessor(this);

Review comment:
       Couple of problems:
   1. it changes an object passed from the outside
   2. requires cast (could be solved by changing the signature of the constructor)
   
   I'm thinking that maybe a better solution is to get rid of the `mainMailboxExecutor` and replace getter `getMainMailboxExecutor` with:
   ```
   	public MailboxExecutor getMainMailboxExecutor() {
   		return new MailboxExecutorImpl(mailbox, MIN_PRIORITY, actionExecutor, this);
   	}
   ```
   plus caching access to `mailboxProcessor.getMainMailboxExecutor()` inside `StreamTask` via creating a field in ` StreamTask`: `private final MailboxExecutor mainMailboxExecutor`?
   
   This would solve the problem of circular dependency and nullable non final field inside `MailboxExecutorImpl`.
   
   WDYT?




----------------------------------------------------------------
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 #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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



[GitHub] [flink] pnowojski commented on a change in pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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



##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/MailboxExecutorImpl.java
##########
@@ -43,10 +43,22 @@
 
 	private final StreamTaskActionExecutor actionExecutor;
 
+	private MailboxProcessor mailboxProcessor;

Review comment:
       `@Nullable` - but check other comments first (for a better solution)

##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/MailboxProcessor.java
##########
@@ -114,6 +114,7 @@ public MailboxProcessor(
 		this.actionExecutor = Preconditions.checkNotNull(actionExecutor);
 		this.mailbox = Preconditions.checkNotNull(mailbox);
 		this.mainMailboxExecutor = Preconditions.checkNotNull(mainMailboxExecutor);
+		((MailboxExecutorImpl) this.mainMailboxExecutor).setMailboxProcessor(this);

Review comment:
       Couple of problems:
   1. it changes an object passed from the outside
   2. requires cast (could be solved by changing the signature of the constructor)
   
   I'm thinking that maybe a better solution is to get rid of the `mainMailboxExecutor` and replace getter `getMainMailboxExecutor` with:
   ```
   	public MailboxExecutor getMainMailboxExecutor() {
   		return new MailboxExecutorImpl(mailbox, MIN_PRIORITY, actionExecutor, this);
   	}
   ```
   +
   cache access to `mailboxProcessor.getMainMailboxExecutor()` inside `StreamTask` by creating a field in ` StreamTask`: `private final MailboxExecutor mainMailboxExecutor`?
   
   This would solve the problem of circular dependency and nullable non final field inside `MailboxExecutorImpl`.
   
   WDYT?

##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/MailboxExecutorImpl.java
##########
@@ -43,10 +43,22 @@
 
 	private final StreamTaskActionExecutor actionExecutor;
 
+	private MailboxProcessor mailboxProcessor;
+
 	public MailboxExecutorImpl(@Nonnull TaskMailbox mailbox, int priority, StreamTaskActionExecutor actionExecutor) {
+		this(mailbox, priority, actionExecutor, null);
+	}
+
+	public MailboxExecutorImpl(@Nonnull TaskMailbox mailbox, int priority, StreamTaskActionExecutor actionExecutor, MailboxProcessor mailboxProcessor) {
 		this.mailbox = mailbox;
 		this.priority = priority;
 		this.actionExecutor = Preconditions.checkNotNull(actionExecutor);
+		this.mailboxProcessor = mailboxProcessor;
+	}
+
+	public boolean isIdle() {
+		return !mailboxProcessor.isMailboxLoopRunning() ||
+			(mailboxProcessor.isDefaultActionUnavailable() && !mailbox.hasMail() && mailbox.getState().isAcceptingMails());

Review comment:
       `mailboxProcessor != null && mailboxProcessor.isDefaultActionUnavailable()`?  - but check other comments first (for a better solution)

##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/ContinuousFileReaderOperator.java
##########
@@ -311,17 +312,19 @@ private void enqueueProcessRecord() {
 	}
 
 	private void processRecord() throws IOException {
-		if (!state.prepareToProcessRecord(this)) {
-			return;
-		}
+		do {
+			if (!state.prepareToProcessRecord(this)) {
+				return;
+			}
 
-		readAndCollectRecord();
+			readAndCollectRecord();
 
-		if (format.reachedEnd()) {
-			onSplitProcessed();
-		} else {
-			enqueueProcessRecord();
-		}
+			if (format.reachedEnd()) {
+				onSplitProcessed();
+				return;
+			}
+		} while (executor.isIdle()); // todo: consider moving this loop into MailboxProcessor (return boolean "re-execute" from enqueued action)

Review comment:
       nit: I would be slightly in favour of adding this method to the `MailboxExecutor` interface, but if you think opposite let it be for now.

##########
File path: flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/MailboxExecutorImpl.java
##########
@@ -50,7 +50,7 @@ public MailboxExecutorImpl(@Nonnull TaskMailbox mailbox, int priority, StreamTas
 	}
 
 	public MailboxExecutorImpl(@Nonnull TaskMailbox mailbox, int priority, StreamTaskActionExecutor actionExecutor, MailboxProcessor mailboxProcessor) {
-		this.mailbox = mailbox;
+		this.mailbox = (TaskMailboxImpl) mailbox;

Review comment:
       revert this change?




----------------------------------------------------------------
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 #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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



[GitHub] [flink] flinkbot edited a comment on pull request #12401: [FLINK-16057] Optimize ContinuousFileReaderOperator

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


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

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