diff --git a/pkg/core/constant/kind.go b/pkg/core/constant/kind.go index 178cbf766e4..39c256c4f5d 100644 --- a/pkg/core/constant/kind.go +++ b/pkg/core/constant/kind.go @@ -165,3 +165,14 @@ const ( // Out indicates that the direction is out. Out ) + +func (d Direction) String() string { + switch d { + case In: + return "in" + case Out: + return "out" + default: + return "unknown" + } +} diff --git a/pkg/core/store.go b/pkg/core/store.go index b8881d9b162..2cd924ad339 100644 --- a/pkg/core/store.go +++ b/pkg/core/store.go @@ -805,8 +805,8 @@ func (s *StoresInfo) PauseLeaderTransfer(storeID uint64, direction constant.Dire return nil } -// ResumeLeaderTransferIn cleans a store's pause state. The store can be selected -// as target of TransferLeader again. +// ResumeLeaderTransfer cleans a store's pause state. The store can be selected +// as source or target of TransferLeader again. func (s *StoresInfo) ResumeLeaderTransfer(storeID uint64, direction constant.Direction) { s.Lock() defer s.Unlock() diff --git a/pkg/core/store_option.go b/pkg/core/store_option.go index 542d3ec84a0..3d05a0fb6e1 100644 --- a/pkg/core/store_option.go +++ b/pkg/core/store_option.go @@ -123,20 +123,6 @@ func ResumeLeaderTransfer(d constant.Direction) StoreCreateOption { } } -// PauseLeaderTransferOut prevents the store from been selected as source store of TransferLeader. -func PauseLeaderTransferOut() StoreCreateOption { - return func(store *StoreInfo) { - store.pauseLeaderTransferOut = true - } -} - -// ResumeLeaderTransferOut cleans a store's pause state. The store can be selected as source of TransferLeader again. -func ResumeLeaderTransferOut() StoreCreateOption { - return func(store *StoreInfo) { - store.pauseLeaderTransferOut = false - } -} - // SlowStoreEvicted marks a store as a slow store and prevents transferring // leader to the store func SlowStoreEvicted() StoreCreateOption { diff --git a/pkg/schedule/schedulers/utils.go b/pkg/schedule/schedulers/utils.go index 63ed39025ab..9c1c7fe3854 100644 --- a/pkg/schedule/schedulers/utils.go +++ b/pkg/schedule/schedulers/utils.go @@ -404,7 +404,7 @@ func pauseAndResumeLeaderTransfer[T any](cluster *core.BasicCluster, direction c continue } if err := cluster.PauseLeaderTransfer(id, direction); err != nil { - log.Error("pause leader transfer in failed", zap.Uint64("store-id", id), errs.ZapError(err)) + log.Error("pause leader transfer failed", zap.Uint64("store-id", id), zap.String("direction", direction.String()), errs.ZapError(err)) } } }