Skip to content

Commit

Permalink
*: decouple operator handler and server (tikv#7089)
Browse files Browse the repository at this point in the history
ref tikv#5839

Signed-off-by: lhy1024 <[email protected]>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and rleungx committed Dec 1, 2023
1 parent c6fbf60 commit 131be48
Show file tree
Hide file tree
Showing 11 changed files with 600 additions and 532 deletions.
30 changes: 30 additions & 0 deletions errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,36 @@ error = '''
TCP socks error
'''

["PD:operator:ErrAddOperator"]
error = '''
failed to add operator, maybe already have one
'''

["PD:operator:ErrOperatorNotFound"]
error = '''
operator not found
'''

["PD:operator:ErrPluginNotFound"]
error = '''
plugin is not found: %s
'''

["PD:operator:ErrRegionAbnormalPeer"]
error = '''
region %v has abnormal peer
'''

["PD:operator:ErrRegionNotAdjacent"]
error = '''
two regions are not adjacent
'''

["PD:operator:ErrRegionNotFound"]
error = '''
region %v not found
'''

["PD:os:ErrOSOpen"]
error = '''
open error
Expand Down
24 changes: 24 additions & 0 deletions pkg/errs/errno.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,30 @@ var (
ErrClientGetMinTSO = errors.Normalize("get min TSO failed, %v", errors.RFCCodeText("PD:client:ErrClientGetMinTSO"))
)

// operator errors
var (
// ErrOperatorNotFound is error info for operator not found.
ErrOperatorNotFound = errors.Normalize("operator not found", errors.RFCCodeText("PD:operator:ErrOperatorNotFound"))
// ErrAddOperator is error info for already have an operator when adding operator.
ErrAddOperator = errors.Normalize("failed to add operator, maybe already have one", errors.RFCCodeText("PD:operator:ErrAddOperator"))
)

// region errors
var (
// ErrRegionNotAdjacent is error info for region not adjacent.
ErrRegionNotAdjacent = errors.Normalize("two regions are not adjacent", errors.RFCCodeText("PD:operator:ErrRegionNotAdjacent"))
// ErrRegionNotFound is error info for region not found.
ErrRegionNotFound = errors.Normalize("region %v not found", errors.RFCCodeText("PD:operator:ErrRegionNotFound"))
// ErrRegionAbnormalPeer is error info for region has abnormal peer.
ErrRegionAbnormalPeer = errors.Normalize("region %v has abnormal peer", errors.RFCCodeText("PD:operator:ErrRegionAbnormalPeer"))
)

// plugin errors
var (
// ErrPluginNotFound is error info for plugin not found.
ErrPluginNotFound = errors.Normalize("plugin is not found: %s", errors.RFCCodeText("PD:operator:ErrPluginNotFound"))
)

// schedule errors
var (
ErrUnexpectedOperatorStatus = errors.Normalize("operator with unexpected status", errors.RFCCodeText("PD:schedule:ErrUnexpectedOperatorStatus"))
Expand Down
Loading

0 comments on commit 131be48

Please sign in to comment.