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

Refactor/removing cross cluster feature #6121

Merged
Show file tree
Hide file tree
Changes from 13 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
2 changes: 0 additions & 2 deletions client/admin/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ type Client interface {
RemoveTask(context.Context, *types.RemoveTaskRequest, ...yarpc.CallOption) error
ResendReplicationTasks(context.Context, *types.ResendReplicationTasksRequest, ...yarpc.CallOption) error
ResetQueue(context.Context, *types.ResetQueueRequest, ...yarpc.CallOption) error
GetCrossClusterTasks(context.Context, *types.GetCrossClusterTasksRequest, ...yarpc.CallOption) (*types.GetCrossClusterTasksResponse, error)
RespondCrossClusterTasksCompleted(context.Context, *types.RespondCrossClusterTasksCompletedRequest, ...yarpc.CallOption) (*types.RespondCrossClusterTasksCompletedResponse, error)
GetDynamicConfig(context.Context, *types.GetDynamicConfigRequest, ...yarpc.CallOption) (*types.GetDynamicConfigResponse, error)
UpdateDynamicConfig(context.Context, *types.UpdateDynamicConfigRequest, ...yarpc.CallOption) error
RestoreDynamicConfig(context.Context, *types.RestoreDynamicConfigRequest, ...yarpc.CallOption) error
Expand Down
40 changes: 0 additions & 40 deletions client/admin/interface_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 0 additions & 89 deletions client/history/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,59 +262,6 @@ func TestClient_withResponse(t *testing.T) {
},
want: &types.MergeDLQMessagesResponse{},
},
{
name: "GetCrossClusterTasks",
op: func(c Client) (any, error) {
return c.GetCrossClusterTasks(context.Background(), &types.GetCrossClusterTasksRequest{
ShardIDs: []int32{100, 101, 102},
})
},
mock: func(p *MockPeerResolver, c *MockClient) {
p.EXPECT().FromShardID(100).Return("test-peer-0", nil).Times(1)
p.EXPECT().FromShardID(101).Return("test-peer-1", nil).Times(1)
p.EXPECT().FromShardID(102).Return("test-peer-2", nil).Times(1)
c.EXPECT().GetCrossClusterTasks(gomock.Any(), gomock.Any(), []yarpc.CallOption{yarpc.WithShardKey("test-peer-0")}).
Return(&types.GetCrossClusterTasksResponse{
TasksByShard: map[int32][]*types.CrossClusterTaskRequest{
100: {{}, {}},
},
}, nil).Times(1)
c.EXPECT().GetCrossClusterTasks(gomock.Any(), gomock.Any(), []yarpc.CallOption{yarpc.WithShardKey("test-peer-1")}).
Return(&types.GetCrossClusterTasksResponse{
TasksByShard: map[int32][]*types.CrossClusterTaskRequest{
101: {{}},
},
}, nil).Times(1)
c.EXPECT().GetCrossClusterTasks(gomock.Any(), gomock.Any(), []yarpc.CallOption{yarpc.WithShardKey("test-peer-2")}).
Return(&types.GetCrossClusterTasksResponse{
TasksByShard: map[int32][]*types.CrossClusterTaskRequest{
102: {{}, {}, {}},
},
}, nil).Times(1)
},
want: &types.GetCrossClusterTasksResponse{
TasksByShard: map[int32][]*types.CrossClusterTaskRequest{
100: {{}, {}},
101: {{}},
102: {{}, {}, {}},
},
FailedCauseByShard: map[int32]types.GetTaskFailedCause{},
},
},
{
name: "RespondCrossClusterTasksCompleted",
op: func(c Client) (any, error) {
return c.RespondCrossClusterTasksCompleted(context.Background(), &types.RespondCrossClusterTasksCompletedRequest{
ShardID: 123,
})
},
mock: func(p *MockPeerResolver, c *MockClient) {
p.EXPECT().FromShardID(123).Return("test-peer", nil).Times(1)
c.EXPECT().RespondCrossClusterTasksCompleted(gomock.Any(), gomock.Any(), []yarpc.CallOption{yarpc.WithShardKey("test-peer")}).
Return(&types.RespondCrossClusterTasksCompletedResponse{}, nil).Times(1)
},
want: &types.RespondCrossClusterTasksCompletedResponse{},
},
{
name: "GetFailoverInfo",
op: func(c Client) (any, error) {
Expand Down Expand Up @@ -818,42 +765,6 @@ func TestClient_withResponse(t *testing.T) {
},
wantError: true,
},
{
name: "GetCrossClusterTasks fail open",
op: func(c Client) (any, error) {
return c.GetCrossClusterTasks(context.Background(), &types.GetCrossClusterTasksRequest{
ShardIDs: []int32{100},
})
},
mock: func(p *MockPeerResolver, c *MockClient) {
// Add your mock expectations here
p.EXPECT().FromShardID(100).Return("test-peer", nil).Times(1)
c.EXPECT().GetCrossClusterTasks(gomock.Any(), gomock.Any(), []yarpc.CallOption{yarpc.WithShardKey("test-peer")}).
Return(nil, fmt.Errorf("GetCrossClusterTasks failed")).Times(1)
},
want: &types.GetCrossClusterTasksResponse{
TasksByShard: make(map[int32][]*types.CrossClusterTaskRequest),
FailedCauseByShard: map[int32]types.GetTaskFailedCause{
100: types.GetTaskFailedCauseUncategorized,
},
},
wantError: false,
},
{
name: "RespondCrossClusterTasksCompleted fail",
op: func(c Client) (any, error) {
return c.RespondCrossClusterTasksCompleted(context.Background(), &types.RespondCrossClusterTasksCompletedRequest{
ShardID: 123,
})
},
mock: func(p *MockPeerResolver, c *MockClient) {
// Add your mock expectations here
p.EXPECT().FromShardID(123).Return("test-peer", nil).Times(1)
c.EXPECT().RespondCrossClusterTasksCompleted(gomock.Any(), gomock.Any(), []yarpc.CallOption{yarpc.WithShardKey("test-peer")}).
Return(nil, fmt.Errorf("RespondCrossClusterTasksCompleted failed")).Times(1)
},
wantError: true,
},
{
name: "GetFailoverInfo fail",
op: func(c Client) (any, error) {
Expand Down
40 changes: 0 additions & 40 deletions client/wrappers/errorinjectors/admin_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions client/wrappers/grpc/admin_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 0 additions & 26 deletions client/wrappers/metered/admin_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions client/wrappers/retryable/admin_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions client/wrappers/thrift/admin_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions client/wrappers/timeout/admin_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion common/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ const (
TaskTypeTimer
// TaskTypeReplication is the task type for replication task
TaskTypeReplication
// TaskTypeCrossCluster is the task type for cross cluster task
// Deprecated! TaskTypeCrossCluster is the task type for cross cluster task
// as of June 2024, this feature is no longer supported. Keeping the enum here
// to avoid future reuse of the ID and/or confusion
TaskTypeCrossCluster TaskType = 6
)

Expand Down
Loading
Loading