Skip to content

Commit 9092ccc

Browse files
gc: Add GCStateManager which is planned to be the replacement of SafePointManager (#9169)
ref #8978 Add `GCStateManager` which is planned to be the replacement of `SafePointManager`. This is part of the refactor task #8978 . The new module is not yet used until the next PR updates the gRPC service interfaces. Signed-off-by: MyonKeminta <[email protected]> Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
1 parent 9d6bbb8 commit 9092ccc

File tree

8 files changed

+1444
-34
lines changed

8 files changed

+1444
-34
lines changed

errors.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ error = '''
166166
incorrect system time
167167
'''
168168

169+
["PD:common:ErrInvalidArgument"]
170+
error = '''
171+
invalid argument for %s: %v
172+
'''
173+
169174
["PD:core:ErrNoStoreForRegionLeader"]
170175
error = '''
171176
can not remove store %d since there are no extra up store to store the leader
@@ -451,6 +456,36 @@ error = '''
451456
failed to convert a path to absolute path
452457
'''
453458

459+
["PD:gc:ErrDecreasingGCSafePoint"]
460+
error = '''
461+
trying to update GC safe point to a smaller value, current value: %v, given: %v
462+
'''
463+
464+
["PD:gc:ErrDecreasingTxnSafePoint"]
465+
error = '''
466+
trying to update txn safe point to a smaller value, current value: %v, given: %v
467+
'''
468+
469+
["PD:gc:ErrGCBarrierTSBehindTxnSafePoint"]
470+
error = '''
471+
trying to set a GC barrier on ts %d which is already behind the txn safe point %d
472+
'''
473+
474+
["PD:gc:ErrGCOnInvalidKeyspace"]
475+
error = '''
476+
trying to manage GC in keyspace %v where keyspace level GC is not enabled
477+
'''
478+
479+
["PD:gc:ErrGCSafePointExceedsTxnSafePoint"]
480+
error = '''
481+
trying to update GC safe point to a too large value that exceeds the txn safe point, current value: %v, given: %v, current txn safe point: %v
482+
'''
483+
484+
["PD:gc:ErrReservedGCBarrierID"]
485+
error = '''
486+
trying to set a GC barrier with a barrier ID that is reserved: %v
487+
'''
488+
454489
["PD:gin:ErrBindJSON"]
455490
error = '''
456491
bind JSON error

pkg/errs/errno.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ var (
9797
ErrGetSourceStore = errors.Normalize("failed to get the source store", errors.RFCCodeText("PD:common:ErrGetSourceStore"))
9898
ErrGetTargetStore = errors.Normalize("failed to get the target store", errors.RFCCodeText("PD:common:ErrGetTargetStore"))
9999
ErrIncorrectSystemTime = errors.Normalize("incorrect system time", errors.RFCCodeText("PD:common:ErrIncorrectSystemTime"))
100+
ErrInvalidArgument = errors.Normalize("invalid argument for %s: %v", errors.RFCCodeText("PD:common:ErrInvalidArgument"))
100101
)
101102

102103
// tso errors
@@ -548,3 +549,13 @@ var (
548549
ErrNotFoundSchedulingPrimary = errors.Normalize("cannot find scheduling primary", errors.RFCCodeText("PD:mcs:ErrNotFoundSchedulingPrimary"))
549550
ErrSchedulingServer = errors.Normalize("scheduling server meets %v", errors.RFCCodeText("PD:mcs:ErrSchedulingServer"))
550551
)
552+
553+
// GC errors
554+
var (
555+
ErrGCOnInvalidKeyspace = errors.Normalize("trying to manage GC in keyspace %v where keyspace level GC is not enabled", errors.RFCCodeText("PD:gc:ErrGCOnInvalidKeyspace"))
556+
ErrDecreasingGCSafePoint = errors.Normalize("trying to update GC safe point to a smaller value, current value: %v, given: %v", errors.RFCCodeText("PD:gc:ErrDecreasingGCSafePoint"))
557+
ErrGCSafePointExceedsTxnSafePoint = errors.Normalize("trying to update GC safe point to a too large value that exceeds the txn safe point, current value: %v, given: %v, current txn safe point: %v", errors.RFCCodeText("PD:gc:ErrGCSafePointExceedsTxnSafePoint"))
558+
ErrDecreasingTxnSafePoint = errors.Normalize("trying to update txn safe point to a smaller value, current value: %v, given: %v", errors.RFCCodeText("PD:gc:ErrDecreasingTxnSafePoint"))
559+
ErrGCBarrierTSBehindTxnSafePoint = errors.Normalize("trying to set a GC barrier on ts %d which is already behind the txn safe point %d", errors.RFCCodeText("PD:gc:ErrGCBarrierTSBehindTxnSafePoint"))
560+
ErrReservedGCBarrierID = errors.Normalize("trying to set a GC barrier with a barrier ID that is reserved: %v", errors.RFCCodeText("PD:gc:ErrReservedGCBarrierID"))
561+
)

pkg/gc/gc_state_manager.go

Lines changed: 563 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)