You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/04/29 23:45:14 UTC

[GitHub] [pulsar] dlg99 opened a new pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the ConnectorContext

dlg99 opened a new pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446


   <!--
   ### Contribution Checklist
     
     - Name the pull request in the form "[Issue XYZ][component] Title of the pull request", where *XYZ* should be replaced by the actual issue number.
       Skip *Issue XYZ* if there is no associated github issue for this pull request.
       Skip *component* if you are unsure about which is the best component. E.g. `[docs] Fix typo in produce method`.
   
     - 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.
     
     - 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
   
     - 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)**
   -->
   
   *(If this PR fixes a github issue, please add `Fixes #<xyz>`.)*
   
   Fixes #10445
   
   ### Motivation
   
   SinkContext should expose Subscription type to the Sink
   More context: https://github.com/apache/pulsar/pull/9927#discussion_r621441678
   
   Needed for https://github.com/apache/pulsar/pull/9927
   
   ### Modifications
   
   Added `getSubscriptionType()` to the `ConnectorContext` interface and `ContextImpl`
   
   ### Verifying this change
   
   - [ ] Make sure that the change passes the CI checks.
   
   This change is already covered by existing unit tests
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If `yes` was chosen, please highlight the changes*
   
     - The public API: yes
    
   New method added to the interface that is a public API. Default method implementation is provided.
   
   ### Documentation
   
     - Does this pull request introduce a new feature? yes
     - If yes, how is the feature documented? JavaDocs
   


-- 
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] [pulsar] jerrypeng commented on pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
jerrypeng commented on pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#issuecomment-834062620


   @dlg99 based the comments
   
   https://github.com/apache/pulsar/pull/9927#discussion_r621441678
   
   It seem like the subscription type should be checked at submission time and be rejected if a wrong subscription type is used.  
   
   If we are checking the subscription type during the sink open, what are we going to do if the subscription type is wrong?  Just go into a crash loop?


-- 
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] [pulsar] eolivelli commented on pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#issuecomment-834385698


   Thank you @jerrypeng 
   
   @sijie you left "request changes" status.
   Do you agree to merge this patch ?


-- 
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] [pulsar] eolivelli commented on pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
eolivelli commented on pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#issuecomment-833264644


   @jerrypeng @srkukarni  ping.
   this patch is blocking another bigger work.
   can you please take a quick look ?


-- 
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] [pulsar] jerrypeng edited a comment on pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
jerrypeng edited a comment on pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#issuecomment-834062620


   I don't see any red flags in this PR but I also don't understand adding this functionality will be useful.
   
   @dlg99 based the comments
   
   https://github.com/apache/pulsar/pull/9927#discussion_r621441678
   
   It seem like the subscription type should be checked at submission time and be rejected if a wrong subscription type is used.  
   
   If we are checking the subscription type during the sink open, what are we going to do if the subscription type is wrong?  Just go into a crash loop?


-- 
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] [pulsar] dlg99 commented on pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the ConnectorContext

Posted by GitBox <gi...@apache.org>.
dlg99 commented on pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#issuecomment-831346921


   rebased on current master


-- 
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] [pulsar] dlg99 commented on pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
dlg99 commented on pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#issuecomment-834070801


   > If we are checking the subscription type during the sink open, what are we going to do if the subscription type is wrong? Just go into a crash loop?
   
   @jerrypeng This is not different from what's happening in other connectors now. I agree we can consider adding something to handle it better, but this is out of the scope of this PR.
   
   https://github.com/apache/pulsar/blob/5a1264dfc2ccf5a22c76e0385b219b2104c8e9ba/pulsar-io/kafka/src/main/java/org/apache/pulsar/io/kafka/KafkaAbstractSink.java#L84-L91
   
   https://github.com/apache/pulsar/blob/5a1264dfc2ccf5a22c76e0385b219b2104c8e9ba/pulsar-io/kinesis/src/main/java/org/apache/pulsar/io/kinesis/KinesisSink.java#L159-L163
   
   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.

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



[GitHub] [pulsar] sijie commented on a change in pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
sijie commented on a change in pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#discussion_r625474514



##########
File path: pulsar-io/core/src/main/java/org/apache/pulsar/io/core/SinkContext.java
##########
@@ -42,4 +44,11 @@
      */
     String getSinkName();
 
+    /**
+     * Get subscription type

Review comment:
       We need to provide more information about what does subscription type means in `SinkContext`.




-- 
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] [pulsar] sijie merged pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
sijie merged pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446


   


-- 
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] [pulsar] dlg99 commented on pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
dlg99 commented on pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#issuecomment-832263996


   @jerrypeng @srkukarni Do you have any feedback on this? (I cannot add you to reviewers, no permissions)


-- 
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] [pulsar] eolivelli commented on a change in pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the ConnectorContext

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#discussion_r623683947



##########
File path: pulsar-io/core/src/main/java/org/apache/pulsar/io/core/ConnectorContext.java
##########
@@ -68,7 +69,15 @@
      * @return the namespace this source belongs to
      */
     String getNamespace();
-    
+
+    /**
+     * Get subscription type
+     * @return subscription type
+     */
+    default SubscriptionType getSubscriptionType() {

Review comment:
       isn't it better to add this method in SinkContext instead of ConnectorContext ?
   
   it does not make sense to have this for "Sources" for instance

##########
File path: pulsar-io/core/src/main/java/org/apache/pulsar/io/core/ConnectorContext.java
##########
@@ -68,7 +69,15 @@
      * @return the namespace this source belongs to
      */
     String getNamespace();
-    
+
+    /**
+     * Get subscription type
+     * @return subscription type
+     */
+    default SubscriptionType getSubscriptionType() {
+        return null;

Review comment:
       Can we throw "UnsupportedOperationException" ?




-- 
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] [pulsar] jerrypeng commented on pull request #10446: [Issue 10445][pulsar-io] Exposed SubscriptionType in the SinkContext

Posted by GitBox <gi...@apache.org>.
jerrypeng commented on pull request #10446:
URL: https://github.com/apache/pulsar/pull/10446#issuecomment-834105185


   I am not a fan of adding new interfaces to support a not well thought out behavior that might be changed in the future but I don't see a major problem with this as well.


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