From 1138aa48e45d8eb7b9e96b26058a884b7dd01073 Mon Sep 17 00:00:00 2001 From: goodliu Date: Mon, 23 Oct 2023 17:27:16 +0800 Subject: [PATCH 01/16] readme: update description of trpc-go to keep it concise and clear. and keep it consistent with PR: https://github.com/avelino/awesome-go/pull/5075 --- README.md | 2 +- README.zh_CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0d6a52b..0e671ef 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ English | [中文](README.zh_CN.md) [![Coverage](https://codecov.io/gh/trpc-group/trpc-go/branch/main/graph/badge.svg)](https://app.codecov.io/gh/trpc-group/trpc-go/tree/main) -tRPC-Go, as the [Go][] language implementation of [tRPC][], is a battle-tested microservices framework that has been extensively validated in production environments. It not only delivers high performance but also offers ease of use and testability. +tRPC-Go, is the [Go][] language implementation of [tRPC][], which is a pluggable, high-performance RPC framework. For more information, please refer to the [quick start guide][quick start] and [detailed documentation][docs]. diff --git a/README.zh_CN.md b/README.zh_CN.md index 2df6b4a..c6bbb84 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -11,7 +11,7 @@ [![Coverage](https://codecov.io/gh/trpc-group/trpc-go/branch/main/graph/badge.svg)](https://app.codecov.io/gh/trpc-group/trpc-go/tree/main) -tRPC-Go,作为 [tRPC][] 的 [Go][] 语言版本,是经过大规模线上业务使用验证过的微服务框架,它不仅性能高,而且易于使用和测试。 +tRPC-Go,是 [tRPC][] 的 [Go][] 语言实现,它是一个可插拔的高性能 RPC 框架。 更多信息见:[快速上手][quick start] 以及 [详细文档][docs] From ad4851b3b351b340f07491c2f3b8e2d52fc00c38 Mon Sep 17 00:00:00 2001 From: goodliu Date: Tue, 24 Oct 2023 17:54:37 +0800 Subject: [PATCH 02/16] workflow: add proposal process link for proposal issue template --- .github/ISSUE_TEMPLATE/03-proposal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/03-proposal.md b/.github/ISSUE_TEMPLATE/03-proposal.md index 23e5cc1..8602906 100644 --- a/.github/ISSUE_TEMPLATE/03-proposal.md +++ b/.github/ISSUE_TEMPLATE/03-proposal.md @@ -7,5 +7,5 @@ labels: Proposal From bb1f48afa7c918e7b19eacb877e2cfd01006673d Mon Sep 17 00:00:00 2001 From: Longyue Li Date: Fri, 27 Oct 2023 15:38:22 +0800 Subject: [PATCH 03/16] docs: fix label name in 03-proposal.md and add question issue template (#125) update issue template Signed-off-by: longyue0521 --- .github/ISSUE_TEMPLATE/02-question.md | 27 +++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/03-proposal.md | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .github/ISSUE_TEMPLATE/02-question.md diff --git a/.github/ISSUE_TEMPLATE/02-question.md b/.github/ISSUE_TEMPLATE/02-question.md new file mode 100644 index 0000000..2ca4c2a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/02-question.md @@ -0,0 +1,27 @@ +--- +name: Questions +about: questions or inquiries about the project +title: "question: affected/package: " +labels: question +--- + +### Preliminary Research + + + +- [ ] I have read the project's documentation. +- [ ] I have searched [existing issues](https://github.com/trpc-group/trpc-go/issues) for similar questions to see if my question has already been addressed. + +### Question + + + +### Additional Information + + diff --git a/.github/ISSUE_TEMPLATE/03-proposal.md b/.github/ISSUE_TEMPLATE/03-proposal.md index 8602906..453d3f8 100644 --- a/.github/ISSUE_TEMPLATE/03-proposal.md +++ b/.github/ISSUE_TEMPLATE/03-proposal.md @@ -2,7 +2,7 @@ name: Proposals about: New external API or other notable changes title: "proposal: affected/package: " -labels: Proposal +labels: proposal --- + + +Fixes # + + +RELEASE NOTES: NONE \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1c45e00..3cf68ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -75,7 +75,8 @@ Here is an example of a good one: > The algorithm is described at https://wikipedia.org/wiki/McGillicutty_Algorithm > > Fixes #159 - +> +> RELEASE NOTES: Improved precision of Sin, Cos, and Tan for very large arguments (>1e10) #### First line @@ -102,6 +103,34 @@ When this change is eventually applied, the issue tracker will automatically mar - If there is a corresponding issue, add either `Fixes #12345` or `Updates #12345` (the latter if this is not a complete fix) to this comment - If referring to a repo other than `trpc-go` you can use the `owner/repo#issue_number` syntax: `Fixes trpc-group/tnet#12345` +#### PR type label + +The PR type label is used to help identify the types of changes going into the release over time. This may allow the Release Team to develop a better understanding of what sorts of issues we would miss with a faster release cadence. + +For all pull requests, one of the following PR type labels must be set: + +- type/bug: Fixes a newly discovered bug. +- type/enhancement: Adding tests, refactoring. +- type/feature: New functionality. +- type/documentation: Adds documentation. +- type/api-change: Adds, removes, or changes an API. +- type/failing-test: CI test case is showing intermittent failures. +- type/performance: Changes that improves performance. +- type/ci: Changes the CI configuration files and scripts. + +#### Release notes + +Release notes are required for any pull request with user-visible changes, this could mean: + +- User facing, critical bug-fixes +- Notable feature additions +- Deprecations or removals +- API changes +- Documents additions + +If the current PR doesn't have user-visible changes, such as internal code refactoring or adding test cases, the release notes should be filled with 'NONE' and the changes in this PR will not be recorded in the next version's CHANGELOG. If the current PR has user-visible changes, the release notes should be filled out according to the actual situation, avoiding technical details and describing the impact of the current changes from a user's perspective as much as possible. + +Release notes are one of the most important reference points for users about to import or upgrade to a particular release of tRPC-Go. ## Miscellaneous topics diff --git a/CONTRIBUTING.zh_CN.md b/CONTRIBUTING.zh_CN.md index 5e658fd..96bc5d4 100644 --- a/CONTRIBUTING.zh_CN.md +++ b/CONTRIBUTING.zh_CN.md @@ -69,6 +69,8 @@ tRPC-Go 中的提交消息遵循一套特定的约定,我们将在本节中讨 > The algorithm is described at https://wikipedia.org/wiki/McGillicutty_Algorithm > > Fixes #159 +> +> RELEASE NOTES: Improved precision of Sin, Cos, and Tan for very large arguments (>1e10) #### 第一行 @@ -94,6 +96,35 @@ tRPC-Go 中的提交消息遵循一套特定的约定,我们将在本节中讨 - 如果有相关 issue,请在此评论中添加 `Fixes #12345` 或` Updates #12345`(如果这不是完整的修复) - 如果涉及到的仓库不是 `trpc-go`,则可以使用 `owner/repo#issue_number` 语法:`Fixes trpc-group/tnet#12345` +#### PR 类型标签 + +PR 类型标签用于标识当前 PR 变更所属的类型,为后续发布版本提供参考。这有助于发布团队在更快的发布周期里,准确识别当前周期内所有类型的问题。 + +对于所有 PR,必须设置以下之一的 PR 类型标签: + +- type/bug: 修复新发现的 bug。 +- type/enhancement: 添加测试,重构内部代码。 +- type/feature: 新功能。 +- type/documentation: 添加文档。 +- type/api-change: 添加、删除或更改 API。 +- type/failing-test: CI 测试用例偶发失败。 +- type/performance: 改进性能的变更。 +- type/ci: 更改 CI 配置文件和脚本。 + +#### 发布说明 + +对于任何造成用户可见更改的 PR,都需要提供发布说明。这可能包括: + +- 用户可见的关键 bug 修复 +- 显著的功能增加 +- 功能弃用或移除 +- API 更改 +- 文档添加 + +如果当前 PR 没有用户可见的变更,例如代码内部重构,添加测试用例等情况,发布说明内容填为 'NONE',这个 PR 的变更就不会记录在下个版本的 CHANGELOG 中;如果当前 PR 有用户可见的变更,发布说明内容需要按照实际情况填写,尽量不要涉及技术细节,在用户视角描述当前变更会造成的影响。 + +发布说明是用户即将使用或升级到 tRPC-Go 特定版本时的最重要参考点之一。 + ## 其他主题 ### 版权声明 From c2bdf24372438c858265bd0d0fa8147236edaf15 Mon Sep 17 00:00:00 2001 From: goodliu Date: Mon, 13 Nov 2023 11:54:53 +0800 Subject: [PATCH 14/16] client: remove the write operation on *registry.Node in LoadNodeConfig to avoid data race during selecting Node (#138) cherry-pick from internal code within the company --- client/client.go | 2 +- client/client_test.go | 2 +- client/options.go | 2 -- client/stream.go | 11 ++++++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/client/client.go b/client/client.go index 2fe9fdf..8860c91 100644 --- a/client/client.go +++ b/client/client.go @@ -393,7 +393,7 @@ func selectorFilter(ctx context.Context, req interface{}, rsp interface{}, next if err != nil { return OptionsFromContext(ctx).fixTimeout(err) } - ensureMsgRemoteAddr(msg, node.Network, node.Address) + ensureMsgRemoteAddr(msg, findFirstNonEmpty(node.Network, opts.Network), node.Address) // Start to process the next filter and report. begin := time.Now() diff --git a/client/client_test.go b/client/client_test.go index c5d3273..3734816 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -182,7 +182,7 @@ func TestClientFail(t *testing.T) { client.WithSelectorNode(node), client.WithProtocol("fake"))) require.Equal(t, node.Address, "127.0.0.1:8080") require.Equal(t, node.ServiceName, "127.0.0.1:8080") - require.Equal(t, node.Network, "tcp") + require.Empty(t, node.Network) // test encode failure reqBody = &codec.Body{Data: []byte("failbody")} diff --git a/client/options.go b/client/options.go index 6ad13b1..3e665c3 100644 --- a/client/options.go +++ b/client/options.go @@ -695,8 +695,6 @@ func (opts *Options) LoadNodeConfig(node *registry.Node) { if node.Network != "" { opts.Network = node.Network opts.CallOptions = append(opts.CallOptions, transport.WithDialNetwork(node.Network)) - } else { - node.Network = opts.Network } if node.Protocol != "" { WithProtocol(node.Protocol)(opts) diff --git a/client/stream.go b/client/stream.go index d613fc0..a40ac8e 100644 --- a/client/stream.go +++ b/client/stream.go @@ -154,7 +154,7 @@ func (s *stream) Init(ctx context.Context, opt ...Option) (*Options, error) { report.SelectNodeFail.Incr() return nil, err } - ensureMsgRemoteAddr(msg, node.Network, node.Address) + ensureMsgRemoteAddr(msg, findFirstNonEmpty(node.Network, opts.Network), node.Address) const invalidCost = -1 opts.Node.set(node, node.Address, invalidCost) if opts.Codec == nil { @@ -166,6 +166,15 @@ func (s *stream) Init(ctx context.Context, opt ...Option) (*Options, error) { return s.opts, nil } +func findFirstNonEmpty(ss ...string) string { + for _, s := range ss { + if s != "" { + return s + } + } + return "" +} + // Invoke implements Stream. func (s *stream) Invoke(ctx context.Context) error { return s.opts.StreamTransport.Init(ctx, s.opts.CallOptions...) From 3fde950858bed56a9afc6db021230cf99fd22ae9 Mon Sep 17 00:00:00 2001 From: Bo Yan Date: Mon, 13 Nov 2023 16:14:03 +0800 Subject: [PATCH 15/16] server: explain more aboud MaxRoutines option (#137) --- config.go | 4 +++- server/options.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index bfa2441..6ea24e6 100644 --- a/config.go +++ b/config.go @@ -530,7 +530,9 @@ type ServiceConfig struct { TLSCert string `yaml:"tls_cert"` // Server TLS certificate. CACert string `yaml:"ca_cert"` // CA certificate to validate client certificate. ServerAsync *bool `yaml:"server_async,omitempty"` // Whether to enable server asynchronous mode. - // Maximum number of goroutines for server asynchronous mode. + // MaxRoutines is the maximum number of goroutines for server asynchronous mode. + // Requests exceeding MaxRoutines will be queued. Prolonged overages may lead to OOM! + // MaxRoutines is not the solution to alleviate server overloading. MaxRoutines int `yaml:"max_routines"` Writev *bool `yaml:"writev,omitempty"` // Whether to enable writev. Transport string `yaml:"transport"` // Transport type. diff --git a/server/options.go b/server/options.go index 55d9907..177a05d 100644 --- a/server/options.go +++ b/server/options.go @@ -215,6 +215,8 @@ func WithWritev(writev bool) Option { // MaxRoutines should be set to twice as expected number of routines (can be calculated by expected QPS), // and larger than MAXPROCS. // If MaxRoutines is not set or set to 0, it will be set to (1<<31 - 1). +// Requests exceeding MaxRoutines will be queued. Prolonged overages may lead to OOM! +// MaxRoutines is not the solution to alleviate server overloading. func WithMaxRoutines(routines int) Option { return func(o *Options) { o.ServeOptions = append(o.ServeOptions, transport.WithMaxRoutines(routines)) From edc110563e1620608cd349a4a9f3caab656c2475 Mon Sep 17 00:00:00 2001 From: wineandchord Date: Thu, 30 Nov 2023 22:11:05 +0800 Subject: [PATCH 16/16] http: invite back default http server transport (#140) Add default http server transport --- http/transport.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/http/transport.go b/http/transport.go index b3d9331..980c35a 100644 --- a/http/transport.go +++ b/http/transport.go @@ -49,6 +49,8 @@ import ( func init() { st := NewServerTransport(func() *stdhttp.Server { return &stdhttp.Server{} }) + DefaultServerTransport = st + DefaultHTTP2ServerTransport = st // Server transport (protocol file service). transport.RegisterServerTransport("http", st) transport.RegisterServerTransport("http2", st) @@ -60,6 +62,12 @@ func init() { transport.RegisterClientTransport("http2", DefaultHTTP2ClientTransport) } +// DefaultServerTransport is the default server http transport. +var DefaultServerTransport transport.ServerTransport + +// DefaultHTTP2ServerTransport is the default server http2 transport. +var DefaultHTTP2ServerTransport transport.ServerTransport + // ServerTransport is the http transport layer. type ServerTransport struct { newServer func() *stdhttp.Server