-
Notifications
You must be signed in to change notification settings - Fork 759
tso, server: add debug logs for TSO sync, closure, and forwarding paths #10439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
33ff440
6c8f5a1
773b66a
3d08abc
83dad0c
9b80d8c
8edf2c7
5a8f94f
c9f8e8a
ec48604
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,6 +125,12 @@ const ( | |
| syncRegionTaskRunner = "sync-region-async" | ||
| ) | ||
|
|
||
| const ( | ||
| tsoDynamicSwitchingStateUnknown int32 = iota | ||
| tsoDynamicSwitchingStateEnabled | ||
| tsoDynamicSwitchingStateDisabled | ||
| ) | ||
|
|
||
| // Server is the interface for cluster. | ||
| type Server interface { | ||
| GetAllocator() id.Allocator | ||
|
|
@@ -166,6 +172,7 @@ type RaftCluster struct { | |
|
|
||
| running bool | ||
| isKeyspaceGroupEnabled bool | ||
| tsoDynamicSwitchingState atomic.Int32 | ||
| meta *metapb.Cluster | ||
| storage storage.Storage | ||
| minResolvedTS atomic.Value // Store as uint64 | ||
|
|
@@ -462,6 +469,10 @@ func (c *RaftCluster) checkSchedulingService() { | |
| func (c *RaftCluster) checkTSOService() { | ||
| if c.isKeyspaceGroupEnabled { | ||
| if c.opt.GetMicroserviceConfig().IsTSODynamicSwitchingEnabled() { | ||
| prev := c.tsoDynamicSwitchingState.Swap(tsoDynamicSwitchingStateEnabled) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not use CAS?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if prev == tsoDynamicSwitchingStateDisabled { | ||
| log.Info("TSO dynamic switching is enabled, resuming TSO service checks") | ||
| } | ||
| servers, err := discovery.Discover(c.etcdClient, constant.TSOServiceName) | ||
| if err != nil || len(servers) == 0 { | ||
| if err := c.startTSOJobsIfNeeded(); err != nil { | ||
|
|
@@ -479,6 +490,11 @@ func (c *RaftCluster) checkTSOService() { | |
| c.SetServiceIndependent(constant.TSOServiceName) | ||
| } | ||
| } | ||
| } else { | ||
| prev := c.tsoDynamicSwitchingState.Swap(tsoDynamicSwitchingStateDisabled) | ||
| if prev != tsoDynamicSwitchingStateDisabled { | ||
| log.Info("TSO dynamic switching is disabled by config, skipping TSO service checks") | ||
| } | ||
| } | ||
| return | ||
| } | ||
|
|
@@ -546,7 +562,7 @@ func (c *RaftCluster) stopTSOJobsIfNeeded() { | |
| if !c.tsoAllocator.IsInitialize() { | ||
| return | ||
| } | ||
| log.Info("closing the TSO allocator") | ||
| log.Info("closing the embedded TSO allocator") | ||
| c.tsoAllocator.Reset(false) | ||
| failpoint.Inject("updateAfterResetTSO", func() { | ||
| if err := c.tsoAllocator.UpdateTSO(); !errorspkg.Is(err, errs.ErrUpdateTimestamp) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.