Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support IPV6 and Unix domain socket #1560

Merged
merged 7 commits into from
Mar 28, 2022
Merged

Support IPV6 and Unix domain socket #1560

merged 7 commits into from
Mar 28, 2022

Conversation

wwbmmm
Copy link
Contributor

@wwbmmm wwbmmm commented Sep 15, 2021

Solve #381, #879, #1403, #1462, #1552, #1561
Partially solve: #207

这里补充说明一下EndPoint扩展支持IPV6和UDS的思路:

整体上是遵循了@jamesge#207 中提到的思路,即EndPoint保持ABI兼容,不修改EndPoint的size,引入标志位(在port字段),然后ip字段是一个指向ExtendedEndPoint结构的ResourceId (使用butil::ResourcePool)。这样的好处就是对于现存的IPV4业务,是完全ABI兼容。

在ExtendedEndPoint结构中,引入了引用计数,这样拷贝EndPoint时会增加引用,释放EndPoint时会减少引用。

str2endpoint/endpoint2str都支持了IPV6和UDS。但是str2ip无法支持,因为ip_t结构没法在保持ABI兼容的情况下再扩展了。

tcp_connect/tcp_listen等方法也对扩展类型的EndPoint进行了支持,从而最小化对上层的改动。

另外由于EndPoint结构很多时候被直接当作值来使用(比如基于EndPoint的值进行排序、作为map/hash map的key等),为了兼容这些用法 ,我们需要保证同一个IPV4/IPV6/UDS的值,生成的EndPoint的值相同,因此做一个全局的去重,即值相同的EndPoint都指向同一个ExtendedEndPoint结构。这样对于内存也有一些节省(由于前面用了32位的ip字段来存储ResourceId,最多只能同时保存2^32个不同的EndPoint)。

@fly3366
Copy link

fly3366 commented Oct 24, 2021

lgtm

@knightast
Copy link

这个ipv6的pr为啥一直没合

@linsibolinhong
Copy link

大佬,快合了他吧,急用

@wwbmmm wwbmmm merged commit 75f5d3d into apache:master Mar 28, 2022
wwbmmm added a commit to wwbmmm/incubator-brpc that referenced this pull request Mar 28, 2022
wwbmmm added a commit that referenced this pull request Mar 28, 2022
@wwbmmm wwbmmm deleted the endpoint branch March 28, 2022 06:13
guodongxiaren added a commit to guodongxiaren/incubator-brpc that referenced this pull request Jun 19, 2022
* rm ParseHostname and restore http_message.cpp

* reduce ParseUrl() for Init()

* update en/http_client.mp

* Update circuit_breaker.md

* Update overview.md

* community: update lorin's oncall report from 08/23/2021

* redesign InitSingle

* update docs

* Update oncall.md

Add caojin's  weekly oncall report

* add cases.md

* add ut

add ut

* Update oncall.md

add  link to helei's oncall report

* Add use case of Baidu

* Improve client doc

* Improve client en doc

* Improve error_code doc

* Improve error_code en doc

* Improve server doc

* Improve server en doc

* Improve cpu_profiler doc

* Improve status doc

* Improve status en doc

* Improve bthread_id doc

* EndPoint support ipv4 and unix domain socket

* Add EndPoint test for ipv4 and unix domain socket

* Support ipv6 and unix domain socket for brpc

* Support ipv6 and uds for example echo_c++

* Add doc for IPV6 and Unix domain socket

* Add test for consistent_hashing LB with IPV6 and UDS

* Update cases.md

* Create cases.md

* Fix noflush compile fail with glog

* Fix typo

* Update sampler.cpp

fix typo

* community: update oncall.md

* Fix LA selection runs too long

* wr/wrr policy degradation

* only support http not http2

* doc(circuit_breaker): add ema wiki link

* Update cases.md

* Update cases.md

* update oncall report

* community: add release doc

* Update release_cn.md

* release 1.0.0

* Update http2_rpc_protocol.cpp

grpc add H2 SETTINGS extension,remove this WARNING log。

* Update http2_rpc_protocol.cpp

* Add flag `pb_single_repeated_to_array'

Add an option to allow serialize/deserialize to/from a json array.

* Fix a test case on json to pb

* Add test case for `pb_single_repeated_to_array'

* Fix a typo of compress type

* Update client doc about channel destruction

* Fix typo

* fix小typo

found when following the instruction

* update gnp edit command options

* when http header parse error, send 400 response

* Exclude mesalink/openssl/ssl.h when find openssl

Resolve apache#1622

* change varable name

* fix status

* add release check related content

* Update releasecheck.md

* update docs

* Update images in docs to remove hostname and ip

* Add brpc logo

Supply a vector graphic logo of brpc(svg)

* Update gifs in docs to remove hostname and ip

* Update rpc_press doc to remove specific hostname

* Replace baidu internal wiki address

* minor, fix typo in Stream::OnReceived

* Update load_balancer.cpp

* added brpc in iqiyi

* added case in iqiyi

* minor, fix typo in execution_queue.md

* Update cpu profiler doc

* fix: rpc_view defer_close_second flag typo

* update oncall report

* doc: add use case

* docs(circuit_breaker): fix word error

* Add rpc_replay BUILD file

* Improvement: brpc support higher version of protobuf

* fix(input_messenger) client side retry policy

client retry parse message when baidu_std fall to streaming_rpc

* Update oncall.md

* Create newcommitter.md

* add http_host gflag for rpc_replay

* update doc for rpc_replay

* Support parse proto-text format http request body

* make msg more clear

* Update oncall.md

* change fatal to error

* add unittest for proto-text content-type

* add protobuf_text content-type ut

* docs: fix typo

* Fix work_stealing_queue_unittest for ARM.

* Fix LatencyRecorder qps not accurate

* Fix unstable RecorderTest case

* Fix unstable UT link error

* Fix unstable UT link error

* Add `;` for consistency to origin code.

* Typo Fix: Change Resourse to resource

* fix(input_messenger) update preferred index

fix comments

* Update flat_map_unittest.cpp insert test case

* [Compile] avoid compile error after gcc11 with --std=c++20

* flat_map: fix code annotation

* Update newcommitter.md

* Update Thrift download url to avoid pr build failed

thrift download url  `https://downloads.apache.org/thrift/0.11.0/thrift-0.11.0.tar.gz` has moved to `https://archive.apache.org/dist/thrift/0.11.0/thrift-0.11.0.tar.gz`

* ByteSize() is deprecated, use ByteSizeLong() instead

* Fix compiler fail after merge apache#1560 and apache#1460

* Fix merge conflicts

* Adjust parameter name to be more obvious

* Add docs for option `pb_single_repeated_to_array'

* Release 1.1.0

* Update newcommitter.md

* Update newcommitter.md

* Update year in NOTICE

* Add list-sigs in release step

* add macro

* use method instead of macro

* change to camel case

* Add vote results to incubator vote mail template

* doc: Update incubator vote mail template

* Update oncall.md

* doc: update download link in release doc

* [UPDATE] fix c struct compile error

solve this error. make it the same as bthread.h

* doc: Update announce step in release doc

* Oncall report from Apr 10th to Apr 16th

* add redis request empty notice

* add redis request empty notice

* add redis request empty notice

* Add redis auth doc

* Add oncall report Apr.17th - Apr.24th 2022

* client.md 文档优化

https:// 后面补一个空格,防止后面的中文被Github网页识别成链接的一部分

* fix auto https check

* Update oncall.md

* ``

* client.md 文档优化 (apache#1755)

* client.md 文档优化

https:// 后面补一个空格,防止后面的中文被Github网页识别成链接的一部分

* ``

* Update oncall.md

* comment fix

* Update client.md (apache#1767)

* json2pb::JsonToProtoMessage() supports parsing multiple jsons

* butex_wake* support nosignal flag, use bthread_flush signal batch (apache#1751)

* Fix compile error due to std limits header absent (apache#1764)

fix compile error like `incubator-brpc/src/brpc/redis_command.cpp:411:29: error: ‘numeric_limits’ is not a member of ‘std’`

* Fix _dl_sym undefined reference

* Fix a deadlock happened in ClearAbandonedStreamsImpl path(issues/1778) (apache#1781)

* Update newcommitter.md

* Update newcommitter.md

* Update newcommitter.md

* Update newcommitter.md

* Update newcommitter.md

* Support apple silicon

* Elaborate how-to-build steps for MacOS

* BugFix: Send WindowUpdate when ClearAbandonedStreams is called (apache#1786)

* add try catch for thrift

* update catch exception

* update exception

* update exception

* update exception

* Update oncall.md

* Fix discovery naming service core (apache#1802)

* Update weighted_randomized_load_balancer.cpp

* Update weighted_round_robin_load_balancer.cpp

Co-authored-by: LorinLee <lorinlee1996@gmail.com>
Co-authored-by: serverglen <serverglen@gmail.com>
Co-authored-by: Tanzhongyi(Jerry Tan) <13718272827@163.com>
Co-authored-by: Jiashun Zhu <zhujiashun2010@gmail.com>
Co-authored-by: tanzhongyi003 <jerrytan@apache.org>
Co-authored-by: jamesge <jge666@gmail.com>
Co-authored-by: wangweibing <wangweibing@baidu.com>
Co-authored-by: YIXIAO SHI <aieruishi@gmail.com>
Co-authored-by: jiangtao <hohojiang@126.com>
Co-authored-by: yangshuaijie <yangshuaijie@baidu.com>
Co-authored-by: huxiguo <uestc.hugo@gmail.com>
Co-authored-by: jiaozilang <qql7041@gmail.com>
Co-authored-by: caidj <31362185+cdjingit@users.noreply.github.com>
Co-authored-by: cdjingit <642580887@qq.com>
Co-authored-by: 李磊 <lilei.rd@bytedance.com>
Co-authored-by: Jairo <947600215@qq.com>
Co-authored-by: Zhangyi Chen <frozen.zju@gmail.com>
Co-authored-by: wxf <xiaofeng.wang@bqvision.com>
Co-authored-by: Zhengguo Yang <yangzhgg@gmail.com>
Co-authored-by: egolearner <45122959+egolearner@users.noreply.github.com>
Co-authored-by: therealnick233 <nickpanmail@gmail.com>
Co-authored-by: 焦龙 <jiaolong02@meituan.com>
Co-authored-by: zhouwk <zhouwk@zenme.com>
Co-authored-by: wwbmmm <wwbmmm@163.com>
Co-authored-by: Clement Ma <mahongweichina@gmail.com>
Co-authored-by: Jiatao Tao <245915794@qq.com>
Co-authored-by: ehds <ehds@qq.com>
Co-authored-by: caidaojin <caidaojin@qiyi.com>
Co-authored-by: dl239 <dl239@126.com>
Co-authored-by: taoxu <taoxu@bilibili.com>
Co-authored-by: Shuai Zhang <zhangshuai.ustc@gmail.com>
Co-authored-by: HongboLiu <lhbf@qq.com>
Co-authored-by: Tudou <gao568321994@outlook.com>
Co-authored-by: TousakaRin <lhestz@163.com>
Co-authored-by: Yangshen⚡Deng <yangshen.d@bupt.edu.cn>
Co-authored-by: mwish <anmmscs_maple@qq.com>
Co-authored-by: Xiaofeng Wang <wasphin@gmail.com>
Co-authored-by: Franklin Shan <37760924+wolfdan666@users.noreply.github.com>
Co-authored-by: lzfhust <lzfhust@126.com>
Co-authored-by: devin.zhang <devin.zhang@shopee.com>
Co-authored-by: lei.li <lei.li@clickzetta.com>
Co-authored-by: 372046933 <372046933@users.noreply.github.com>
Co-authored-by: Yang,Liming <liming.yang@139.com>
Co-authored-by: GOGOYAO <shunyuyao@126.com>
Co-authored-by: helei.sig11 <helei.sig11@bytedance.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants