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

Feat/upgrade getty #1345

Merged
merged 5 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion config/testdata/consumer_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ protocol_conf:
keep_alive_period: "120s"
tcp_r_buf_size: 262144
tcp_w_buf_size: 65536
pkg_wq_size: 512
tcp_read_timeout: "1s"
tcp_write_timeout: "5s"
wait_timeout: "1s"
Expand Down
1 change: 0 additions & 1 deletion config/testdata/consumer_config_with_configcenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ protocol_conf:
keep_alive_period: "120s"
tcp_r_buf_size: 262144
tcp_w_buf_size: 65536
pkg_wq_size: 512
tcp_read_timeout: "1s"
tcp_write_timeout: "5s"
wait_timeout: "1s"
Expand Down
1 change: 0 additions & 1 deletion config/testdata/consumer_config_withoutProtocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ protocol_conf:
keep_alive_period: "120s"
tcp_r_buf_size: 262144
tcp_w_buf_size: 65536
pkg_wq_size: 512
tcp_read_timeout: "1s"
tcp_write_timeout: "5s"
wait_timeout: "1s"
Expand Down
1 change: 0 additions & 1 deletion config/testdata/provider_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ protocol_conf:
keep_alive_period: "120s"
tcp_r_buf_size: 262144
tcp_w_buf_size: 65536
pkg_wq_size: 512
tcp_read_timeout: "1s"
tcp_write_timeout: "5s"
wait_timeout: "1s"
Expand Down
1 change: 0 additions & 1 deletion config/testdata/provider_config_withoutProtocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ protocol_conf:
keep_alive_period: "120s"
tcp_r_buf_size: 262144
tcp_w_buf_size: 65536
pkg_wq_size: 512
tcp_read_timeout: "1s"
tcp_write_timeout: "5s"
wait_timeout: "1s"
Expand Down
1 change: 0 additions & 1 deletion config_center/apollo/impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ var mockConfigRes = `{
"application.environment": "dev",
"services.UserProvider.protocol": "dubbo",
"application.organization": "ikurento.com",
"protocol_conf.dubbo.getty_session_param.pkg_wq_size": "512",
"services.UserProvider.methods[0].loadbalance": "random"
},
"releaseKey": "20191104105242-0f13805d89f834a4"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/Workiva/go-datastructures v1.0.52
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5
github.com/alibaba/sentinel-golang v1.0.2
github.com/apache/dubbo-getty v1.4.3
github.com/apache/dubbo-getty v1.4.5
github.com/apache/dubbo-go-hessian2 v1.9.2
github.com/creasty/defaults v1.5.1
github.com/dubbogo/go-zookeeper v1.0.3
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDH
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apache/dubbo-getty v1.4.3 h1:PCKpryDasKOxwT5MBC6MIMO+0NLOaHF6Xco9YXQw7HI=
github.com/apache/dubbo-getty v1.4.3/go.mod h1:ansXgKxxyhCOiQL29nO5ce1MDcEKmCyZuNR9oMs3hek=
github.com/apache/dubbo-getty v1.4.4 h1:pthYQaCXyjHJ6/SjVwKkX5NhdAqSpUrRL1Z9GowrLdE=
github.com/apache/dubbo-getty v1.4.4/go.mod h1:mcDyiu7M/TVrYDyL8TxDemQkOdvEqqHSQ4jOuYejY1w=
github.com/apache/dubbo-getty v1.4.5 h1:MptKbjC0n2Mo/8eFPwirSInH2BfdNG4IZch43PdNvIM=
github.com/apache/dubbo-getty v1.4.5/go.mod h1:mcDyiu7M/TVrYDyL8TxDemQkOdvEqqHSQ4jOuYejY1w=
Mulavar marked this conversation as resolved.
Show resolved Hide resolved
github.com/apache/dubbo-go-hessian2 v1.9.1/go.mod h1:xQUjE7F8PX49nm80kChFvepA/AvqAZ0oh/UaB6+6pBE=
github.com/apache/dubbo-go-hessian2 v1.9.2 h1:XuI8KvENSfKiAhiCBS4RNihmQDoPNmGWKT3gTui0p9A=
github.com/apache/dubbo-go-hessian2 v1.9.2/go.mod h1:xQUjE7F8PX49nm80kChFvepA/AvqAZ0oh/UaB6+6pBE=
Expand Down Expand Up @@ -149,6 +153,7 @@ github.com/dubbogo/go-zookeeper v1.0.3 h1:UkuY+rBsxdT7Bs63QAzp9z7XqQ53W1j8E5rwl8
github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
github.com/dubbogo/gost v1.10.1/go.mod h1:+mQGS51XQEUWZP2JeGZTxJwipjRKtJO7Tr+FOg+72rI=
github.com/dubbogo/gost v1.11.12/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
github.com/dubbogo/gost v1.11.14 h1:9lfcdILOmqTOVAW1fPHa5uf1NrD6jlIOBe4vf8576yQ=
github.com/dubbogo/gost v1.11.14/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
github.com/dubbogo/jsonparser v1.0.1/go.mod h1:tYAtpctvSP/tWw4MeelsowSPgXQRVHHWbqL6ynps8jU=
Expand Down Expand Up @@ -467,6 +472,7 @@ github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lN
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
Expand Down
1 change: 0 additions & 1 deletion metadata/service/exporter/configurable/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestConfigurableExporter(t *testing.T) {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "1s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand Down
2 changes: 0 additions & 2 deletions protocol/dubbo/dubbo_invoker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ func InitTest(t *testing.T) (protocol.Protocol, *common.URL) {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "4s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand All @@ -130,7 +129,6 @@ func InitTest(t *testing.T) (protocol.Protocol, *common.URL) {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "1s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand Down
2 changes: 0 additions & 2 deletions protocol/dubbo/dubbo_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func initDubboInvokerTest() {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "1s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand All @@ -71,7 +70,6 @@ func initDubboInvokerTest() {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "4s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand Down
4 changes: 2 additions & 2 deletions registry/etcdv3/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
package etcdv3

import (
gxtime "github.com/dubbogo/gost/time"
"os"
"testing"
"time"
)

import (
getty "github.com/apache/dubbo-getty"
"github.com/stretchr/testify/suite"
"go.etcd.io/etcd/server/v3/embed"
)
Expand Down Expand Up @@ -57,7 +57,7 @@ func (suite *RegistryTestSuite) SetupSuite() {
select {
case <-e.Server.ReadyNotify():
t.Log("Server is ready!")
case <-getty.GetTimeWheel().After(60 * time.Second):
case <-gxtime.After(60 * time.Second):
e.Server.Stop() // trigger a shutdown
t.Logf("Server took too long to start!")
}
Expand Down
4 changes: 2 additions & 2 deletions registry/kubernetes/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
)

import (
getty "github.com/apache/dubbo-getty"
gxtime "github.com/dubbogo/gost/time"
perrors "github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
)
Expand Down Expand Up @@ -210,7 +210,7 @@ LOOP:
// try to connect to kubernetes,
failTimes = 0
for {
after := getty.GetTimeWheel().After(timeSecondDuration(failTimes * ConnDelay))
after := gxtime.After(timeSecondDuration(failTimes * ConnDelay))
select {
case <-r.Done():
logger.Warnf("(KubernetesProviderRegistry)reconnectKubernetes Registry goroutine exit now...")
Expand Down
3 changes: 0 additions & 3 deletions remoting/getty/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ type (
keepAlivePeriod time.Duration
TcpRBufSize int `default:"262144" yaml:"tcp_r_buf_size" json:"tcp_r_buf_size,omitempty"`
TcpWBufSize int `default:"65536" yaml:"tcp_w_buf_size" json:"tcp_w_buf_size,omitempty"`
PkgWQSize int `default:"1024" yaml:"pkg_wq_size" json:"pkg_wq_size,omitempty"`
TcpReadTimeout string `default:"1s" yaml:"tcp_read_timeout" json:"tcp_read_timeout,omitempty"`
tcpReadTimeout time.Duration
TcpWriteTimeout string `default:"5s" yaml:"tcp_write_timeout" json:"tcp_write_timeout,omitempty"`
Expand Down Expand Up @@ -122,7 +121,6 @@ func GetDefaultClientConfig() ClientConfig {
KeepAlivePeriod: "180s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "1s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand All @@ -147,7 +145,6 @@ func GetDefaultServerConfig() ServerConfig {
KeepAlivePeriod: "180s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "1s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand Down
3 changes: 2 additions & 1 deletion remoting/getty/getty_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package getty

import (
gxtime "github.com/dubbogo/gost/time"
Mulavar marked this conversation as resolved.
Show resolved Hide resolved
"math/rand"
"sync"
"time"
Expand Down Expand Up @@ -201,7 +202,7 @@ func (c *Client) Request(request *remoting.Request, timeout time.Duration, respo
}

select {
case <-getty.GetTimeWheel().After(timeout):
case <-gxtime.After(timeout):
return perrors.WithStack(errClientReadTimeout)
case <-response.Done:
err = response.Err
Expand Down
4 changes: 1 addition & 3 deletions remoting/getty/getty_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ func InitTest(t *testing.T) (*Server, *common.URL) {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "4s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand All @@ -362,7 +361,6 @@ func InitTest(t *testing.T) (*Server, *common.URL) {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "1s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand Down Expand Up @@ -437,7 +435,7 @@ func (u *UserProvider) GetUser(ctx context.Context, req []interface{}, rsp *User

func (u *UserProvider) GetUser0(id string, k *User, name string) (User, error) {
// fix testClient_AsyncCall assertion bug(#1233)
time.Sleep(1 * time.Second)
//time.Sleep(1 * time.Second)
return User{ID: id, Name: name}, nil
}

Expand Down
3 changes: 2 additions & 1 deletion remoting/getty/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package getty

import (
"fmt"
gxtime "github.com/dubbogo/gost/time"
Mulavar marked this conversation as resolved.
Show resolved Hide resolved
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -378,7 +379,7 @@ func heartbeat(session getty.Session, timeout time.Duration, callBack func(err e
go func() {
var err1 error
select {
case <-getty.GetTimeWheel().After(timeout):
case <-gxtime.After(timeout):
err1 = errHeartbeatReadTimeout
case <-resp.Done:
err1 = resp.Err
Expand Down
8 changes: 0 additions & 8 deletions remoting/getty/readwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ func (p *RpcClientPackageHandler) Write(ss getty.Session, pkg interface{}) ([]by
return nil, perrors.New("invalid rpc request")
}

////////////////////////////////////////////
// RpcServerPackageHandler
////////////////////////////////////////////

//var (
// rpcServerPkgHandler = &RpcServerPackageHandler{}
//)

// RpcServerPackageHandler Read data from client and Write data to client
type RpcServerPackageHandler struct {
server *Server
Expand Down
2 changes: 0 additions & 2 deletions remoting/getty/readwriter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func getServer(t *testing.T) (*Server, *common.URL) {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "4s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand All @@ -117,7 +116,6 @@ func getServer(t *testing.T) (*Server, *common.URL) {
KeepAlivePeriod: "120s",
TcpRBufSize: 262144,
TcpWBufSize: 65536,
PkgWQSize: 512,
TcpReadTimeout: "1s",
TcpWriteTimeout: "5s",
WaitTimeout: "1s",
Expand Down
2 changes: 0 additions & 2 deletions test/integrate/dubbo/go-client/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ protocol_conf:
keep_alive_period: "120s"
tcp_r_buf_size: 262144
tcp_w_buf_size: 65536
pkg_rq_size: 1024
pkg_wq_size: 512
tcp_read_timeout: "1s"
tcp_write_timeout: "5s"
wait_timeout: "1s"
Expand Down
2 changes: 0 additions & 2 deletions test/integrate/dubbo/go-server/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ protocol_conf:
keep_alive_period: "120s"
tcp_r_buf_size: 262144
tcp_w_buf_size: 65536
pkg_rq_size: 1024
pkg_wq_size: 512
tcp_read_timeout: "1s"
tcp_write_timeout: "5s"
wait_timeout: "1s"
Expand Down