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 2021/10/28 09:28:25 UTC

[GitHub] [flink] wangqinghuan opened a new pull request #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

wangqinghuan opened a new pull request #17588:
URL: https://github.com/apache/flink/pull/17588


   Currently, initial offset is OffsetResetStrategy.NONE, which cause NoOffsetForPartitionException. Fix initial offset to OffsetResetStrategy.LATEST.


-- 
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] ruanhang1993 commented on a change in pull request #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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



##########
File path: flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/initializer/OffsetsInitializer.java
##########
@@ -105,7 +105,7 @@
      * @return an offset initializer which initialize the offsets to the committed offsets.
      */
     static OffsetsInitializer committedOffsets() {
-        return committedOffsets(OffsetResetStrategy.NONE);
+        return committedOffsets(OffsetResetStrategy.LATEST);

Review comment:
       I have raised an issue and fix it, and I think it could fix this issue.




-- 
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] ruanhang1993 commented on a change in pull request #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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



##########
File path: flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/initializer/OffsetsInitializer.java
##########
@@ -105,7 +105,7 @@
      * @return an offset initializer which initialize the offsets to the committed offsets.
      */
     static OffsetsInitializer committedOffsets() {
-        return committedOffsets(OffsetResetStrategy.NONE);
+        return committedOffsets(OffsetResetStrategy.LATEST);

Review comment:
       In my option, maybe we could support both EARLIEST and LATEST setting, which can be set by 'auto.offset.reset'. If 'auto.offset.reset' is not set, the default value is 'NONE'  in order to be consistent with the previous behavior.




-- 
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 #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "594c63466faf9273ea9095a90871a5a8b6c10166",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=25567",
       "triggerID" : "594c63466faf9273ea9095a90871a5a8b6c10166",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 594c63466faf9273ea9095a90871a5a8b6c10166 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=25567) 
   
   <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] ruanhang1993 commented on a change in pull request #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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



##########
File path: flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/initializer/OffsetsInitializer.java
##########
@@ -105,7 +105,7 @@
      * @return an offset initializer which initialize the offsets to the committed offsets.
      */
     static OffsetsInitializer committedOffsets() {
-        return committedOffsets(OffsetResetStrategy.NONE);
+        return committedOffsets(OffsetResetStrategy.LATEST);

Review comment:
       I search the logic in release-1.13.0. And I find some information.
   Because Flink 1.13 SQL does not use the new Source API in FLIP-27, the behavior to start from group offsets in flink 1.13 is defined in method `setStartFromGroupOffsets ` under the class `FlinkKafkaConsumerBase`. And its description of the method is as follows.
   ```java
   /**
        * Specifies the consumer to start reading from any committed group offsets found in Zookeeper /
        * Kafka brokers. The "group.id" property must be set in the configuration properties. If no
        * offset can be found for a partition, the behaviour in "auto.offset.reset" set in the
        * configuration properties will be used for the partition.
        *
        * <p>This method does not affect where partitions are read from when the consumer is restored
        * from a checkpoint or savepoint. When the consumer is restored from a checkpoint or savepoint,
        * only the offsets in the restored state will be used.
        *
        * @return The consumer object, to allow function chaining.
        */
       public FlinkKafkaConsumerBase<T> setStartFromGroupOffsets() {
           this.startupMode = StartupMode.GROUP_OFFSETS;
           this.startupOffsetsTimestamp = null;
           this.specificStartupOffsets = null;
           return this;
       }
   ```
   It seems like we could use the "auto.offset.reset" to change the auto offset reset setting in 1.13.0.
   In flink 1.13, if we do not set it, it will use the default value in Kafka, which is "latest".
   
   I think it is better to support all the setting options. And the default value in new Source API to start from group offsets is 'NONE', I think there is no reason to change it to 'LATEST'.




-- 
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 #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "594c63466faf9273ea9095a90871a5a8b6c10166",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=25567",
       "triggerID" : "594c63466faf9273ea9095a90871a5a8b6c10166",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 594c63466faf9273ea9095a90871a5a8b6c10166 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=25567) 
   
   <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 #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "594c63466faf9273ea9095a90871a5a8b6c10166",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "594c63466faf9273ea9095a90871a5a8b6c10166",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 594c63466faf9273ea9095a90871a5a8b6c10166 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 commented on pull request #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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


   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 594c63466faf9273ea9095a90871a5a8b6c10166 (Thu Oct 28 09:31:55 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-24681).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <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.

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

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



[GitHub] [flink] wangqinghuan commented on a change in pull request #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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



##########
File path: flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/initializer/OffsetsInitializer.java
##########
@@ -105,7 +105,7 @@
      * @return an offset initializer which initialize the offsets to the committed offsets.
      */
     static OffsetsInitializer committedOffsets() {
-        return committedOffsets(OffsetResetStrategy.NONE);
+        return committedOffsets(OffsetResetStrategy.LATEST);

Review comment:
       In Flink-1.13-SQL, default behavior is LATEST even not set 'auto.offset.reset'.




-- 
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] ruanhang1993 commented on a change in pull request #17588: [FLINK-24681] set initial offset to OffsetResetStrategy.LATEST

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



##########
File path: flink-connectors/flink-connector-kafka/src/main/java/org/apache/flink/connector/kafka/source/enumerator/initializer/OffsetsInitializer.java
##########
@@ -105,7 +105,7 @@
      * @return an offset initializer which initialize the offsets to the committed offsets.
      */
     static OffsetsInitializer committedOffsets() {
-        return committedOffsets(OffsetResetStrategy.NONE);
+        return committedOffsets(OffsetResetStrategy.LATEST);

Review comment:
       I search the logic in release-1.13.0. And I find some information.
   Because Flink 1.13 SQL does not use the new Source API in FLIP-27, the behavior to start from group offsets in flink 1.13 is defined in method `setStartFromGroupOffsets ` under the class `FlinkKafkaConsumerBase`. And its description of the method is as follows.
   ```java
   /**
        * Specifies the consumer to start reading from any committed group offsets found in Zookeeper /
        * Kafka brokers. The "group.id" property must be set in the configuration properties. If no
        * offset can be found for a partition, the behaviour in "auto.offset.reset" set in the
        * configuration properties will be used for the partition.
        *
        * <p>This method does not affect where partitions are read from when the consumer is restored
        * from a checkpoint or savepoint. When the consumer is restored from a checkpoint or savepoint,
        * only the offsets in the restored state will be used.
        *
        * @return The consumer object, to allow function chaining.
        */
       public FlinkKafkaConsumerBase<T> setStartFromGroupOffsets() {
           this.startupMode = StartupMode.GROUP_OFFSETS;
           this.startupOffsetsTimestamp = null;
           this.specificStartupOffsets = null;
           return this;
       }
   ```
   It seems like we could use the "auto.offset.reset" to change the auto offset rest setting in 1.13.0.
   In flink 1.13, if we do not set it, it will use the default value in Kafka, which is "latest".
   
   I think it is better to support all the setting options. And the default value in new Source API to start from group offsets is 'NONE', I think there is no reason to change it to 'LATEST'.




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