diff --git a/server/tso/tso.go b/server/tso/tso.go index f598f6ac0955..31eb0308eee8 100644 --- a/server/tso/tso.go +++ b/server/tso/tso.go @@ -41,6 +41,9 @@ const ( // TimestampOracle is used to maintain the logic of tso. type TimestampOracle struct { + // leadership is used to check the current PD server's leadership + // to determine whether a tso request could be processed and + // it's stored as *election.Leadership leadership atomic.Value // For tso, set after pd becomes leader. ts unsafe.Pointer diff --git a/tests/cluster.go b/tests/cluster.go index 3f7290be4719..bab88b0a370a 100644 --- a/tests/cluster.go +++ b/tests/cluster.go @@ -329,7 +329,8 @@ func (s *TestServer) BootstrapCluster() error { return nil } -// WaitLeadership is used to get leader lease. +// WaitLeadership is used to get instant leadership in order to +// make a test know the PD leader has been elected as soon as possible. // If it exceeds the maximum number of loops, it will return nil. func (s *TestServer) WaitLeadership() bool { for i := 0; i < 100; i++ {