Skip to content
Merged
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: 2 additions & 0 deletions pkg/cache/ttl.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"time"

"github.com/pingcap/log"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/pkg/syncutil"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -142,6 +143,7 @@ func (c *ttlCache) Clear() {
}

func (c *ttlCache) doGC() {
defer logutil.LogPanic()
ticker := time.NewTicker(c.gcInterval)
defer ticker.Stop()

Expand Down
2 changes: 2 additions & 0 deletions pkg/systimemon/systimemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ import (

"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/logutil"
"go.uber.org/zap"
)

// StartMonitor calls systimeErrHandler if system time jump backward.
func StartMonitor(ctx context.Context, now func() time.Time, systimeErrHandler func()) {
defer logutil.LogPanic()
log.Info("start system time monitor")
tick := time.NewTicker(100 * time.Millisecond)
defer tick.Stop()
Expand Down
3 changes: 3 additions & 0 deletions server/election/lease.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/pkg/typeutil"
"go.etcd.io/etcd/clientv3"
"go.uber.org/zap"
Expand Down Expand Up @@ -129,6 +130,7 @@ func (l *lease) keepAliveWorker(ctx context.Context, interval time.Duration) <-c
ch := make(chan time.Time)

go func() {
defer logutil.LogPanic()
ticker := time.NewTicker(interval)
defer ticker.Stop()

Expand All @@ -137,6 +139,7 @@ func (l *lease) keepAliveWorker(ctx context.Context, interval time.Duration) <-c

for {
go func() {
defer logutil.LogPanic()
start := time.Now()
ctx1, cancel := context.WithTimeout(ctx, l.leaseTimeout)
defer cancel()
Expand Down
2 changes: 2 additions & 0 deletions server/region_syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/grpcutil"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/server/core"
"github.com/tikv/pd/server/storage"
"go.uber.org/zap"
Expand Down Expand Up @@ -117,6 +118,7 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
ctx := s.mu.clientCtx

go func() {
defer logutil.LogPanic()
defer s.wg.Done()
// used to load region from kv storage to cache storage.
bc := s.server.GetBasicCluster()
Expand Down
4 changes: 4 additions & 0 deletions server/tso/allocator_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/etcdutil"
"github.com/tikv/pd/pkg/grpcutil"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/pkg/slice"
"github.com/tikv/pd/pkg/syncutil"
"github.com/tikv/pd/server/config"
Expand Down Expand Up @@ -361,6 +362,7 @@ func (am *AllocatorManager) getLocalTSOAllocatorPath() string {

// similar logic with leaderLoop in server/server.go
func (am *AllocatorManager) allocatorLeaderLoop(ctx context.Context, allocator *LocalTSOAllocator) {
defer logutil.LogPanic()
defer log.Info("server is closed, return local tso allocator leader loop",
zap.String("dc-location", allocator.GetDCLocation()),
zap.String("local-tso-allocator-name", am.member.Member().Name))
Expand Down Expand Up @@ -612,6 +614,7 @@ func (am *AllocatorManager) allocatorUpdater() {

// updateAllocator is used to update the allocator in the group.
func (am *AllocatorManager) updateAllocator(ag *allocatorGroup) {
defer logutil.LogPanic()
defer am.wg.Done()
select {
case <-ag.ctx.Done():
Expand Down Expand Up @@ -662,6 +665,7 @@ func (am *AllocatorManager) allocatorPatroller(serverCtx context.Context) {
// ClusterDCLocationChecker collects all dc-locations of a cluster, computes some related info
// and stores them into the DCLocationInfo, then finally writes them into am.mu.clusterDCLocations.
func (am *AllocatorManager) ClusterDCLocationChecker() {
defer logutil.LogPanic()
// Wait for the PD leader to be elected out.
if am.member.GetLeader() == nil {
return
Expand Down
2 changes: 2 additions & 0 deletions server/tso/global_allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/pingcap/kvproto/pkg/pdpb"
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/errs"
"github.com/tikv/pd/pkg/logutil"
"github.com/tikv/pd/pkg/slice"
"github.com/tikv/pd/pkg/tsoutil"
"github.com/tikv/pd/pkg/typeutil"
Expand Down Expand Up @@ -338,6 +339,7 @@ func (gta *GlobalTSOAllocator) SyncMaxTS(
// Send SyncMaxTSRequest to all allocator leaders concurrently.
wg.Add(1)
go func(ctx context.Context, conn *grpc.ClientConn, respCh chan<- *syncResp) {
defer logutil.LogPanic()
defer wg.Done()
syncMaxTSResp := &syncResp{}
syncCtx, cancel := context.WithTimeout(ctx, rpcTimeout)
Expand Down