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/01/23 10:30:27 UTC

[GitHub] [flink] nirtsruya opened a new pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

nirtsruya opened a new pull request #18449:
URL: https://github.com/apache/flink/pull/18449


   Add FatalExceptionHandler to allow the users of the sink to configure fatal exception handling.
   
   <!--
   *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
   
   This pull request allows users of a sink based on the AsyncSinkBase to provide an implementation of an exception handler FatalExceptionHandler to define a custom fatal exception handling.
   
   ## Brief change log
   
    - Created a new PublicEvolving interface FatalExceptionHandler
    - The AsyncSinkBase constructor now allows to pass an instance of a FatalExceptionHandler
    - The AsyncSinkWriter constructor now allows to pass an instance of a FatalExceptionHandler
    - The AsyncSinkBase builder supports passing an instance of FatalExceptionHandler
    - The fatalExceptionCons in AsyncSinkWriter is now a BiConsumer accepting the failed batch of requests as well as the exception.
   
   
   ## Verifying this change
   
   Please make sure both new and modified tests in this PR follows the conventions defined in our code quality guide: https://flink.apache.org/contributing/code-style-and-quality-common.html#testing
   
   *(Please pick either of the following options)*
   
   This change added tests and can be verified as follows:
    - Added unit test
   
   ## 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)`: (yes)
     - 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] CrynetLogistics commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       Hi @nirtsruya thanks for your contribution.
   
   I see the following options:
   
   1. Keeping a mapping between `InputT` and `RequestEntryT` in the `SinkWriter` and only exposing the `InputT`.
   Advantages:
   - Only exposes the `InputT` to the user (would not break encapsulation, underlying sink implementation free to change)
   Disadvantages:
   - Sink would require ~2x the memory to store the corresponding `InputT`s
   - Would complicate `SinkWriter` implementation
   
   2. Return a `toString`-style printout of the failed `RequestEntryT`s - since most people really only want to append a representative list of failed entries in an appropriate format to their message log, we can provide a `shortFailedList` with a few elements (or under 200 chars) and a `fullFailedList`. The sink implementer would be in the best position to determine what is a 'representative list of failed entries in an appropriate format' for their particular set of `RequestEntryT`s.
   Advantages:
   - Would not expose `RequestEntryT` to the user (would not break encapsulation, underlying sink implementation free to change)
   Disadvantages:
   - User not free to use the `RequestEntryT`s in whatever way they like - sort/concat/parse&determine error/etc.




-- 
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 #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951",
       "triggerID" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6cb754d7f53dd95f508ebcf60b3e7d65503e2996 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951) 
   
   <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] CrynetLogistics commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       Hi @nirtsruya thanks for your contribution.
   
   I see the following options:
   
   1. Keeping a mapping between `InputT` and `RequestEntryT` in the `SinkWriter` and only exposing the `InputT`.
   Advantages:
    - Only exposes the `InputT` to the user (would not break encapsulation, underlying sink implementation free to change)
   
   Disadvantages:
    - Sink would require ~2x the memory to store the corresponding `InputT`s
    - Would complicate `SinkWriter` implementation
   
   2. Return a `toString`-style printout of the failed `RequestEntryT`s - since most people really only want to append a representative list of failed entries in an appropriate format to their message log, we can provide a `shortFailedList` with a few elements (or under 200 chars) and a `fullFailedList`. The sink implementer would be in the best position to determine what is a 'representative list of failed entries in an appropriate format' for their particular set of `RequestEntryT`s.
   i.e.
   ```
   public interface FatalExceptionHandler<RequestEntryT> extends Serializable {
       void handle(String shortFailedList, String fullFailedList, Exception fatalException) throws Exception;
   ...
   ```
   Advantages:
    - Would not expose `RequestEntryT` to the user (would not break encapsulation, underlying sink implementation free to change)
   
   Disadvantages:
    - User not free to use the `RequestEntryT`s in whatever way they like - sort/concat/parse&determine error/etc.




-- 
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] CrynetLogistics commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       Hi @nirtsruya thanks for your contribution.
   
   I see the following options:
   
   1. Keeping a mapping between `InputT` and `RequestEntryT` in the `SinkWriter` and only exposing the `InputT`.
   Advantages:
   - Only exposes the `InputT` to the user (would not break encapsulation, underlying sink implementation free to change)
   Disadvantages:
   - Sink would require ~2x the memory to store the corresponding `InputT`s
   - Would complicate `SinkWriter` implementation
   
   2. Return a `toString`-style printout of the failed `RequestEntryT`s - since most people really only want to append a representative list of failed entries in an appropriate format to their message log, we can provide a `shortFailedList` with a few elements (or under 200 chars) and a `fullFailedList`. The sink implementer would be in the best position to determine what is a 'representative list of failed entries in an appropriate format' for their particular set of `RequestEntryT`s.
   i.e.
   ```
   public interface FatalExceptionHandler<RequestEntryT> extends Serializable {
       void handle(String shortFailedList, String fullFailedList, Exception fatalException) throws Exception;
   ...
   ```
   Advantages:
   - Would not expose `RequestEntryT` to the user (would not break encapsulation, underlying sink implementation free to change)
   Disadvantages:
   - User not free to use the `RequestEntryT`s in whatever way they like - sort/concat/parse&determine error/etc.




-- 
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 #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951",
       "triggerID" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6cb754d7f53dd95f508ebcf60b3e7d65503e2996 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951) 
   
   <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 #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6cb754d7f53dd95f508ebcf60b3e7d65503e2996 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 #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951",
       "triggerID" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f3d122f5795e5592d9978430d4cc5a44899d560c",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=30009",
       "triggerID" : "f3d122f5795e5592d9978430d4cc5a44899d560c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6cb754d7f53dd95f508ebcf60b3e7d65503e2996 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951) 
   * f3d122f5795e5592d9978430d4cc5a44899d560c Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=30009) 
   
   <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] nirtsruya commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/writer/FatalExceptionHandler.java
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.base.sink.writer;
+
+import org.apache.flink.annotation.PublicEvolving;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * This interface specifies how the sink should handle an exception raised by {@code
+ * AsyncSinkWriter} that should not be retried. The mapping is provided by the end-user of a sink,
+ * not the sink creator.
+ *
+ * @param <RequestEntryT> Corresponds to the type parameter of the same name in {@code *
+ *     AsyncSinkWriter}
+ */
+@PublicEvolving
+public interface FatalExceptionHandler<RequestEntryT> extends Serializable {
+    void handle(List<RequestEntryT> failedRequestEntries, Exception fatalException)
+            throws Exception;

Review comment:
       Hey @dannycranmer thanks for the comment.
   The idea was to let the user add some custom code in case of sink failure, like publishing the failed records to a DLQ maybe. I understand that there might be some performance constraints there - but in that case it is user's implementation.
   
   Returning the classification makes sense - are we planning this mechanism will replace the current implementation and calling getFatalExceptionCons()? And instead the framework will push the requestEntries to the correct consumer?




-- 
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] dannycranmer commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       It would be a bigger change, but maybe instead of passing the `RequestEntryT` we could pass the raw objects. Since `RequestEntryT` is destination specific it might not be ideal for forwarding on, and we do not want to require the exception handler to deserialise. Would appreciate input from @CrynetLogistics here . 




-- 
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] nirtsruya commented on pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   Thank you guys for the comments. It seems it requires a bit more thinking and planning, and I think given timelines and that I want to focus in the dynamodb pull request, this can be postponed. closing for now


-- 
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] CrynetLogistics commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       Hi @nirtsruya thanks for your contribution.
   
   I see the following options:
   
   1. Keeping a mapping between `InputT` and `RequestEntryT` in the `SinkWriter` and only exposing the `InputT`.
   Advantages:
    - Only exposes the `InputT` to the user (would not break encapsulation, underlying sink implementation free to change)
   Disadvantages:
    - Sink would require ~2x the memory to store the corresponding `InputT`s
    - Would complicate `SinkWriter` implementation
   
   2. Return a `toString`-style printout of the failed `RequestEntryT`s - since most people really only want to append a representative list of failed entries in an appropriate format to their message log, we can provide a `shortFailedList` with a few elements (or under 200 chars) and a `fullFailedList`. The sink implementer would be in the best position to determine what is a 'representative list of failed entries in an appropriate format' for their particular set of `RequestEntryT`s.
   i.e.
   ```
   public interface FatalExceptionHandler<RequestEntryT> extends Serializable {
       void handle(String shortFailedList, String fullFailedList, Exception fatalException) throws Exception;
   ...
   ```
   Advantages:
    - Would not expose `RequestEntryT` to the user (would not break encapsulation, underlying sink implementation free to change)
   Disadvantages:
    - User not free to use the `RequestEntryT`s in whatever way they like - sort/concat/parse&determine error/etc.




-- 
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] nirtsruya closed pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   


-- 
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] nirtsruya commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       Thanks, as I commented below, if we think the requestEntries should not be passed to the handler (as we don't believe letting the user access to the failed request entries - in order to log, publish to DLQ etc makes sense) , then I agree, no need to pass these




-- 
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 #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951",
       "triggerID" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f3d122f5795e5592d9978430d4cc5a44899d560c",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=30009",
       "triggerID" : "f3d122f5795e5592d9978430d4cc5a44899d560c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * f3d122f5795e5592d9978430d4cc5a44899d560c Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=30009) 
   
   <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 #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951",
       "triggerID" : "6cb754d7f53dd95f508ebcf60b3e7d65503e2996",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f3d122f5795e5592d9978430d4cc5a44899d560c",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "f3d122f5795e5592d9978430d4cc5a44899d560c",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6cb754d7f53dd95f508ebcf60b3e7d65503e2996 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=29951) 
   * f3d122f5795e5592d9978430d4cc5a44899d560c 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 #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   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 6cb754d7f53dd95f508ebcf60b3e7d65503e2996 (Sun Jan 23 10:34:29 UTC 2022)
   
   **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.

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

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



[GitHub] [flink] nirtsruya commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       Thanks, as I commented below, if we think the requestEntries should not be passed to the handler (as we don't believe letting the user access to the failed request entries - in order to log, publish to DLQ etc makes sense) , then I agree, no need to propagate these in that case




-- 
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] dannycranmer commented on pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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


   @nirtsruya Can you please update documentation to add an example?


-- 
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] dannycranmer commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       I have been discussing with @CrynetLogistics about fully encapsulating the `RequestEntryT` to the user code. At the moment it is unnecessarily bubbled up, breaking encapsulation and preventing us to change the backing implementation with breaking user code. This now poses an interesting challenge in terms of implementation with `FatalExceptionHandler`. I would like @CrynetLogistics opinion here on how we can add this without exposing `RequestEntryT`.
   
   

##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/writer/FatalExceptionHandler.java
##########
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.connector.base.sink.writer;
+
+import org.apache.flink.annotation.PublicEvolving;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * This interface specifies how the sink should handle an exception raised by {@code
+ * AsyncSinkWriter} that should not be retried. The mapping is provided by the end-user of a sink,
+ * not the sink creator.
+ *
+ * @param <RequestEntryT> Corresponds to the type parameter of the same name in {@code *
+ *     AsyncSinkWriter}
+ */
+@PublicEvolving
+public interface FatalExceptionHandler<RequestEntryT> extends Serializable {
+    void handle(List<RequestEntryT> failedRequestEntries, Exception fatalException)
+            throws Exception;

Review comment:
       Why does this interface require `List<RequestEntryT>`? As I commented above, this would require user code to understand the underlying implementation. Arguably, so does the exception class. Is it possible to expose a single param here, like so? 
   ```
   void handle(Exception fatalException)
   ``` 
   
   More generally I am wondering if it would be best to not throw here, but return an Exception classification instead? The base could then act appropriately. This would allow us to implement other strategies in the future. For example:
   
   
   ```
   ExceptionClassification handle(Exception exception) {
       if (exception instanceof VeryBadException) { 
           return ExceptionClassification.fatal();
       } else if (exception instanceof NotSoBad) { 
           return ExceptionClassification.retryable(); // retry with retry strategy
       } else if (exception instanceof CommonError) { 
           return ExceptionClassification.transient(); // retry immediately
       }
   }
   ```




-- 
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] CrynetLogistics commented on a change in pull request #18449: [FLINK-25661] [flink-connector-base]- fatal exception handler

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



##########
File path: flink-connectors/flink-connector-base/src/main/java/org/apache/flink/connector/base/sink/AsyncSinkBaseBuilder.java
##########
@@ -37,6 +38,7 @@
         ConcreteBuilderT extends AsyncSinkBaseBuilder<?, ?, ?>> {
 
     private ElementConverter<InputT, RequestEntryT> elementConverter;
+    private FatalExceptionHandler<RequestEntryT> fatalExceptionHandler;

Review comment:
       Hi @nirtsruya thanks for your contribution.
   
   I see the following options:
   
   1. Keeping a mapping between `InputT` and `RequestEntryT` in the `SinkWriter` and only exposing the `InputT`.
   
   Advantages:
    - Only exposes the `InputT` to the user (would not break encapsulation, underlying sink implementation free to change)
   
   Disadvantages:
    - Sink would require ~2x the memory to store the corresponding `InputT`s
    - Would complicate `SinkWriter` implementation
   
   2. Return a `toString`-style printout of the failed `RequestEntryT`s - since most people really only want to append a representative list of failed entries in an appropriate format to their message log, we can provide a `shortFailedList` with a few elements (or under 200 chars) and a `fullFailedList`. The sink implementer would be in the best position to determine what is a 'representative list of failed entries in an appropriate format' for their particular set of `RequestEntryT`s.
   i.e.
   ```
   public interface FatalExceptionHandler<RequestEntryT> extends Serializable {
       void handle(String shortFailedList, String fullFailedList, Exception fatalException) throws Exception;
   ...
   ```
   Advantages:
    - Would not expose `RequestEntryT` to the user (would not break encapsulation, underlying sink implementation free to change)
   
   Disadvantages:
    - User not free to use the `RequestEntryT`s in whatever way they like - sort/concat/parse&determine error/etc.




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