You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by "altman08 (via GitHub)" <gi...@apache.org> on 2026/01/16 07:28:18 UTC

[PR] support change ownship for SelectiveChannel (brpc)

altman08 opened a new pull request, #3198:
URL: https://github.com/apache/brpc/pull/3198

   ### What problem does this PR solve?
   
   Issue Number: resolve 
   
   Problem Summary:
   
   ### What is changed and the side effects?
   
   Changed:
   
   Side effects:
   - Performance effects:
   
   - Breaking backward compatibility: 
   
   ---
   ### Check List:
   - Please make sure your changes are compilable.
   - When providing us with a new feature, it is best to add related tests.
   - Please follow [Contributor Covenant Code of Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
   


-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm commented on PR #3198:
URL: https://github.com/apache/brpc/pull/3198#issuecomment-3770801531

   LGTM


-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "altman08 (via GitHub)" <gi...@apache.org>.
altman08 commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2706732157


##########
src/brpc/selective_channel.h:
##########
@@ -56,6 +56,11 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
         std::string tag;
     };
 
+    struct SubChannelOptions {

Review Comment:
   ChannelHandle is not suitable to be placed inside the option because it is returned to the user.



##########
src/brpc/selective_channel.h:
##########
@@ -69,8 +74,11 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
     // On success, handle is set with the key for removal.
     // NOTE: Different from pchan, schan can add channels at any time.
     // Returns 0 on success, -1 otherwise.
-    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle);
-    int AddChannel(ChannelBase* sub_channel, const std::string& tag, ChannelHandle* handle);

Review Comment:
   This function was merged a few days ago but hasn't been released yet. I think it's ok to remove it.
   



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2706665872


##########
src/brpc/selective_channel.h:
##########
@@ -69,8 +74,11 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
     // On success, handle is set with the key for removal.
     // NOTE: Different from pchan, schan can add channels at any time.
     // Returns 0 on success, -1 otherwise.
-    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle);
-    int AddChannel(ChannelBase* sub_channel, const std::string& tag, ChannelHandle* handle);

Review Comment:
   For compatibility reasons, this function should be retained.
   
   ```c++
   int AddChannel(ChannelBase* sub_channel, const std::string& tag, ChannelHandle* handle);
   ```



##########
src/brpc/selective_channel.h:
##########
@@ -56,6 +56,11 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
         std::string tag;
     };
 
+    struct SubChannelOptions {

Review Comment:
   Is it acceptable to make ChannelHandle a member variable of SubChannelOptions?



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on PR #3198:
URL: https://github.com/apache/brpc/pull/3198#issuecomment-3758771899

   LGTM


-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on PR #3198:
URL: https://github.com/apache/brpc/pull/3198#issuecomment-3770798167

   LGTM


-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "altman08 (via GitHub)" <gi...@apache.org>.
altman08 commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2706541323


##########
src/brpc/selective_channel.h:
##########
@@ -69,8 +69,19 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
     // On success, handle is set with the key for removal.
     // NOTE: Different from pchan, schan can add channels at any time.
     // Returns 0 on success, -1 otherwise.
-    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle);
-    int AddChannel(ChannelBase* sub_channel, const std::string& tag, ChannelHandle* handle);
+    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle) {
+        return AddChannel(sub_channel, "", OWNS_CHANNEL, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, const std::string& tag,
+                   ChannelHandle* handle) {
+      return AddChannel(sub_channel, tag, OWNS_CHANNEL, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, ChannelOwnership ownership,
+                   ChannelHandle* handle) {
+      return AddChannel(sub_channel, "", ownership, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, const std::string& tag,
+                   ChannelOwnership ownership, ChannelHandle* handle);

Review Comment:
   fixed



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "altman08 (via GitHub)" <gi...@apache.org>.
altman08 commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2706994292


##########
src/brpc/selective_channel.h:
##########
@@ -69,8 +74,11 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
     // On success, handle is set with the key for removal.
     // NOTE: Different from pchan, schan can add channels at any time.
     // Returns 0 on success, -1 otherwise.
-    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle);
-    int AddChannel(ChannelBase* sub_channel, const std::string& tag, ChannelHandle* handle);

Review Comment:
   ok, i add it back



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn merged PR #3198:
URL: https://github.com/apache/brpc/pull/3198


-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "wwbmmm (via GitHub)" <gi...@apache.org>.
wwbmmm commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2706400973


##########
src/brpc/selective_channel.h:
##########
@@ -69,8 +69,19 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
     // On success, handle is set with the key for removal.
     // NOTE: Different from pchan, schan can add channels at any time.
     // Returns 0 on success, -1 otherwise.
-    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle);
-    int AddChannel(ChannelBase* sub_channel, const std::string& tag, ChannelHandle* handle);
+    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle) {
+        return AddChannel(sub_channel, "", OWNS_CHANNEL, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, const std::string& tag,
+                   ChannelHandle* handle) {
+      return AddChannel(sub_channel, tag, OWNS_CHANNEL, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, ChannelOwnership ownership,
+                   ChannelHandle* handle) {
+      return AddChannel(sub_channel, "", ownership, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, const std::string& tag,
+                   ChannelOwnership ownership, ChannelHandle* handle);

Review Comment:
   agree



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2701003148


##########
src/brpc/selective_channel.h:
##########
@@ -69,8 +69,19 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
     // On success, handle is set with the key for removal.
     // NOTE: Different from pchan, schan can add channels at any time.
     // Returns 0 on success, -1 otherwise.
-    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle);
-    int AddChannel(ChannelBase* sub_channel, const std::string& tag, ChannelHandle* handle);
+    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle) {
+        return AddChannel(sub_channel, "", OWNS_CHANNEL, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, const std::string& tag,
+                   ChannelHandle* handle) {
+      return AddChannel(sub_channel, tag, OWNS_CHANNEL, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, ChannelOwnership ownership,
+                   ChannelHandle* handle) {
+      return AddChannel(sub_channel, "", ownership, handle);
+    }
+    int AddChannel(ChannelBase* sub_channel, const std::string& tag,
+                   ChannelOwnership ownership, ChannelHandle* handle);

Review Comment:
   I think AddChannel has a combinatorial explosion problem.
   
   ```c++
   int AddChannel(SelectiveChannel::SubChannelOptions);
   ```
   
   Using the SubChannelOptions overloaded AddChannel function would be more suitable, as it offers better extensibility.
   
   In the meantime, please update the comments for the AddChannel function.



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "yanglimingcn (via GitHub)" <gi...@apache.org>.
yanglimingcn commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2706574979


##########
src/brpc/selective_channel.h:
##########
@@ -56,6 +56,11 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
         std::string tag;
     };
 
+    struct SubChannelOptions {

Review Comment:
   Do we need a default value?



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "altman08 (via GitHub)" <gi...@apache.org>.
altman08 commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2706580151


##########
src/brpc/selective_channel.h:
##########
@@ -56,6 +56,11 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
         std::string tag;
     };
 
+    struct SubChannelOptions {

Review Comment:
   > Do we need a default value?
   
   fixed



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


Re: [PR] support change ownship for SelectiveChannel (brpc)

Posted by "chenBright (via GitHub)" <gi...@apache.org>.
chenBright commented on code in PR #3198:
URL: https://github.com/apache/brpc/pull/3198#discussion_r2706888671


##########
src/brpc/selective_channel.h:
##########
@@ -69,8 +74,11 @@ class SelectiveChannel : public ChannelBase/*non-copyable*/ {
     // On success, handle is set with the key for removal.
     // NOTE: Different from pchan, schan can add channels at any time.
     // Returns 0 on success, -1 otherwise.
-    int AddChannel(ChannelBase* sub_channel, ChannelHandle* handle);
-    int AddChannel(ChannelBase* sub_channel, const std::string& tag, ChannelHandle* handle);

Review Comment:
   This commit is already included in the currently released version [1.16](https://github.com/apache/brpc/tree/release-1.16).
   



-- 
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: dev-unsubscribe@brpc.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org