Skip to content

Commit

Permalink
disable tso fallback by default
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Oct 8, 2024
1 parent 34e7a75 commit 039088d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,11 @@ func (c *RaftCluster) checkTSOService() {
}
c.SetServiceIndependent(constant.TSOServiceName)
} else if c.opt.GetMicroServiceConfig().IsTSOFallbackEnabled() {
// TSO server is not available, we need to initialize the PD's allocator group and
// TSO server is not available.
// If TSO fallback is enabled, we need to initialize the PD's allocator group and
// let PD provide the timestamp through UnsetServiceIndependent.
// Otherwise, we will wait for the TSO service to be available.
// In this case, no timestamp will be provided.
if !allocator.IsInitialize() {
log.Info("initializing the global TSO allocator")
if err := allocator.Initialize(0); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const (
maxCheckRegionSplitInterval = 100 * time.Millisecond

defaultEnableSchedulingFallback = true
defaultEnableTSOFallback = true
defaultEnableTSOFallback = false
)

// Special keys for Labels
Expand Down
2 changes: 1 addition & 1 deletion server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ func (s *GrpcServer) Tso(stream pdpb.PD_TsoServer) error {
if s.forwardToTSOService() {
if request.GetCount() == 0 {
err = errs.ErrGenerateTimestamp.FastGenByArgs("tso count should be positive")
return status.Errorf(codes.Unknown, err.Error())
return status.Error(codes.Unknown, err.Error())
}

forwardedHost, ok := s.GetServicePrimaryAddr(stream.Context(), constant.TSOServiceName)
Expand Down

0 comments on commit 039088d

Please sign in to comment.