Skip to content
Open
Show file tree
Hide file tree
Changes from all 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: 1 addition & 1 deletion pkg/mcs/scheduling/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (s *Server) AddServiceReadyCallback(callbacks ...func(context.Context) erro
s.primaryCallbacks = append(s.primaryCallbacks, callbacks...)
}

// AddServiceExitCallback adds callbacks when the server becomes the primary.
// AddServiceExitCallback adds callbacks when the server resigns the primary.
func (s *Server) AddServiceExitCallback(callbacks ...func()) {
s.primaryExitCallbacks = append(s.primaryExitCallbacks, callbacks...)
}
Expand Down
9 changes: 3 additions & 6 deletions pkg/tso/tso.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ const (
// When a TSO's logical time reaches this limit,
// the physical time will be forced to increase.
maxLogical = int64(1 << 18)
// jetLagWarningThreshold is the warning threshold of jetLag in `timestampOracle.UpdateTimestamp`.
// In case of small `updatePhysicalInterval`, the `3 * updatePhysicalInterval` would also is small,
// and trigger unnecessary warnings about clock offset.
// jetLagWarningThreshold is the warning threshold of jetLag in `timestampOracle.updateTimestamp`.
// It's an empirical value.
jetLagWarningThreshold = 150 * time.Millisecond
)
Expand All @@ -62,7 +60,6 @@ type timestampOracle struct {
keyspaceGroupID uint32
member member.Election
storage endpoint.TSOStorage
// TODO: remove saveInterval
saveInterval time.Duration
updatePhysicalInterval time.Duration
maxResetTSGap func() time.Duration
Expand Down Expand Up @@ -162,7 +159,7 @@ func (t *timestampOracle) syncTimestamp() error {
failpoint.Inject("systemTimeSlow", func() {
next = next.Add(-time.Hour)
})
// If the current system time minus the saved etcd timestamp is less than `UpdateTimestampGuard`,
// If the current system time minus the saved etcd timestamp is less than `updateTimestampGuard`,
// the timestamp allocation will start from the saved etcd timestamp temporarily.
if typeutil.SubRealTimeByWallClock(next, last) < updateTimestampGuard {
log.Warn("system time may be incorrect",
Expand Down Expand Up @@ -266,7 +263,7 @@ func (t *timestampOracle) resetUserTimestamp(tso uint64, ignoreSmaller, skipUppe
// This function will do two things:
// 1. When the logical time is going to be used up, increase the current physical time.
// 2. When the time window is not big enough, which means the saved etcd time minus the next physical time
// will be less than or equal to `UpdateTimestampGuard`, then the time window needs to be updated and
// will be less than or equal to `updateTimestampGuard`, then the time window needs to be updated and
// we also need to save the next physical time plus `TSOSaveInterval` into etcd.
//
// Here is some constraints that this function must satisfy:
Expand Down
2 changes: 1 addition & 1 deletion tests/scheduling_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (tc *TestSchedulingCluster) GetPrimaryServer() *scheduling.Server {
return nil
}

// WaitForPrimaryServing waits for one of servers being elected to be the primary/leader of the given keyspace.
// WaitForPrimaryServing waits for one of servers being elected to be the primary.
func (tc *TestSchedulingCluster) WaitForPrimaryServing(re *require.Assertions) *scheduling.Server {
var primary *scheduling.Server
testutil.Eventually(re, func() bool {
Expand Down
Loading