Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
make CI happy
Browse files Browse the repository at this point in the history
  • Loading branch information
chunshao90 committed Dec 18, 2023
1 parent 7b42ecb commit b390d9c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
2 changes: 1 addition & 1 deletion server/coordinator/eventdispatch/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package eventdispatch

import (
"context"
"github.com/CeresDB/ceresdbproto/golang/pkg/metaeventpb"

"github.com/CeresDB/ceresdbproto/golang/pkg/metaeventpb"
"github.com/CeresDB/ceresmeta/server/cluster/metadata"
)

Expand Down
2 changes: 1 addition & 1 deletion server/coordinator/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package coordinator

import (
"context"
"github.com/CeresDB/ceresmeta/server/coordinator/procedure/operation/transfertable"

"github.com/CeresDB/ceresdbproto/golang/pkg/metaservicepb"
"github.com/CeresDB/ceresmeta/server/cluster/metadata"
Expand All @@ -30,6 +29,7 @@ import (
"github.com/CeresDB/ceresmeta/server/coordinator/procedure/ddl/droptable"
"github.com/CeresDB/ceresmeta/server/coordinator/procedure/operation/split"
"github.com/CeresDB/ceresmeta/server/coordinator/procedure/operation/transferleader"
"github.com/CeresDB/ceresmeta/server/coordinator/procedure/operation/transfertable"

Check failure on line 32 in server/coordinator/factory.go

View workflow job for this annotation

GitHub Actions / style-check

could not import github.com/CeresDB/ceresmeta/server/coordinator/procedure/operation/transfertable (-: # github.com/CeresDB/ceresmeta/server/coordinator/procedure/operation/transfertable
"github.com/CeresDB/ceresmeta/server/id"
"github.com/CeresDB/ceresmeta/server/storage"
"github.com/pkg/errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright 2022 The CeresDB Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package transfertable

import (
Expand Down Expand Up @@ -48,8 +64,8 @@ type Procedure struct {

tableInfo metadata.TableInfo
hasSrcShardNode bool
srcShardNodeWithVersion metadata.ShardNodeWithVersion
relatedVersionInfo procedure.RelatedVersionInfo
srcShardNodeWithVersion *metadata.ShardNodeWithVersion
relatedVersionInfo *procedure.RelatedVersionInfo

// Protect the state.
// FIXME: the procedure should be executed sequentially, so any need to use a lock to protect it?
Expand Down Expand Up @@ -90,10 +106,10 @@ func NewProcedure(params ProcedureParams) (procedure.Procedure, error) {

shardWithVersion := map[storage.ShardID]uint64{}
hasSrcShardNode := false
srcShardNodeWithVersion := metadata.ShardNodeWithVersion{}
var srcShardNodeWithVersion *metadata.ShardNodeWithVersion
if len(entry.NodeShards) != 0 {
hasSrcShardNode = true
srcShardNodeWithVersion = entry.NodeShards[0]
srcShardNodeWithVersion = &entry.NodeShards[0]
shardWithVersion[srcShardNodeWithVersion.ShardID()] = srcShardNodeWithVersion.ShardInfo.Version
}

Expand All @@ -102,7 +118,7 @@ func NewProcedure(params ProcedureParams) (procedure.Procedure, error) {
return nil, metadata.ErrTransferTable.WithCausef("table not found")
}

relatedVersionInfo := procedure.RelatedVersionInfo{
relatedVersionInfo := &procedure.RelatedVersionInfo{
ClusterID: clusterMetadata.GetClusterID(),
ShardWithVersion: shardWithVersion,
ClusterVersion: clusterMetadata.GetClusterViewVersion(),
Expand Down Expand Up @@ -200,7 +216,7 @@ func (p *Procedure) Start(ctx context.Context) error {
}

func (p *Procedure) RelatedVersionInfo() procedure.RelatedVersionInfo {
return p.relatedVersionInfo
return *p.relatedVersionInfo
}

func (p *Procedure) persist(_ctx context.Context) error {
Expand Down
8 changes: 4 additions & 4 deletions server/coordinator/procedure/test/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ func (m MockDispatch) DropTableOnShard(_ context.Context, _ string, _ eventdispa
return 0, nil
}

func (m MockDispatch) OpenTableOnShard(_ context.Context, _ string, _ eventdispatch.OpenTableOnShardRequest) error {
return nil
func (m MockDispatch) OpenTableOnShard(_ context.Context, _ string, _ eventdispatch.OpenTableOnShardRequest) (eventdispatch.OpenTableOnShardResponse, error) {
return eventdispatch.OpenTableOnShardResponse{Version: 0}, nil
}

func (m MockDispatch) CloseTableOnShard(_ context.Context, _ string, _ eventdispatch.CloseTableOnShardRequest) error {
return nil
func (m MockDispatch) CloseTableOnShard(_ context.Context, _ string, _ eventdispatch.CloseTableOnShardRequest) (eventdispatch.CloseTableOnShardResponse, error) {
return eventdispatch.CloseTableOnShardResponse{Version: 0}, nil
}

type MockStorage struct{}
Expand Down
2 changes: 1 addition & 1 deletion server/service/http/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (a *API) transferTable(req *http.Request) apiFuncResult {
}

select {
case _ = <-resultCh:
case <-resultCh:
log.Info("transfer leader succeed", zap.String("request", fmt.Sprintf("%+v", transferTableRequest)), zap.Int64("costTime", time.Since(start).Milliseconds()))
return okResult(statusSuccess)
case err = <-errorCh:
Expand Down

0 comments on commit b390d9c

Please sign in to comment.