From 8b4ff953f78b4e9b797c9443feec5fa6e290da8d Mon Sep 17 00:00:00 2001 From: Pan Liu Date: Sat, 20 Dec 2025 11:47:45 +0800 Subject: [PATCH] *: fix some typo and mistake comments Signed-off-by: Pan Liu --- pkg/mcs/scheduling/server/server.go | 2 +- pkg/tso/tso.go | 9 +++------ tests/scheduling_cluster.go | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkg/mcs/scheduling/server/server.go b/pkg/mcs/scheduling/server/server.go index 279d8b2c0d7..62a2623f0be 100644 --- a/pkg/mcs/scheduling/server/server.go +++ b/pkg/mcs/scheduling/server/server.go @@ -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...) } diff --git a/pkg/tso/tso.go b/pkg/tso/tso.go index aecf50300ec..bd242a6b84d 100644 --- a/pkg/tso/tso.go +++ b/pkg/tso/tso.go @@ -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 ) @@ -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 @@ -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", @@ -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: diff --git a/tests/scheduling_cluster.go b/tests/scheduling_cluster.go index d9e794adb9b..d13f5c9fd90 100644 --- a/tests/scheduling_cluster.go +++ b/tests/scheduling_cluster.go @@ -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 {