-
Notifications
You must be signed in to change notification settings - Fork 1
/
handler.go
599 lines (540 loc) · 19.4 KB
/
handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
// Copyright 2016 TiKV Project Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package server
import (
"encoding/json"
"net/http"
"net/url"
"path"
"path/filepath"
"strconv"
"time"
"github.com/pingcap/errors"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/log"
"github.com/tikv/pd/pkg/core"
"github.com/tikv/pd/pkg/core/storelimit"
"github.com/tikv/pd/pkg/encryption"
"github.com/tikv/pd/pkg/errs"
mcsutils "github.com/tikv/pd/pkg/mcs/utils"
"github.com/tikv/pd/pkg/schedule"
sc "github.com/tikv/pd/pkg/schedule/config"
sche "github.com/tikv/pd/pkg/schedule/core"
"github.com/tikv/pd/pkg/schedule/handler"
"github.com/tikv/pd/pkg/schedule/schedulers"
"github.com/tikv/pd/pkg/statistics"
"github.com/tikv/pd/pkg/statistics/utils"
"github.com/tikv/pd/pkg/storage"
"github.com/tikv/pd/pkg/tso"
"github.com/tikv/pd/pkg/utils/apiutil"
"github.com/tikv/pd/pkg/utils/syncutil"
"github.com/tikv/pd/server/cluster"
"github.com/tikv/pd/server/config"
"go.uber.org/zap"
)
// SchedulerConfigHandlerPath is the api router path of the schedule config handler.
var SchedulerConfigHandlerPath = "/api/v1/scheduler-config"
type server struct {
*Server
}
func (s *server) GetCoordinator() *schedule.Coordinator {
c := s.GetRaftCluster()
if c == nil {
return nil
}
return c.GetCoordinator()
}
func (s *server) GetCluster() sche.SchedulerCluster {
return s.GetRaftCluster()
}
// Handler is a helper to export methods to handle API/RPC requests.
type Handler struct {
*handler.Handler
s *Server
opt *config.PersistOptions
pluginChMap map[string]chan string
pluginChMapLock syncutil.RWMutex
}
func newHandler(s *Server) *Handler {
h := handler.NewHandler(&server{
Server: s,
})
return &Handler{
Handler: h,
s: s,
opt: s.persistOptions,
pluginChMap: make(map[string]chan string),
pluginChMapLock: syncutil.RWMutex{},
}
}
// GetRaftCluster returns RaftCluster.
func (h *Handler) GetRaftCluster() (*cluster.RaftCluster, error) {
rc := h.s.GetRaftCluster()
if rc == nil {
return nil, errs.ErrNotBootstrapped.GenWithStackByArgs()
}
return rc, nil
}
// IsSchedulerExisted returns whether scheduler is existed.
func (h *Handler) IsSchedulerExisted(name string) (bool, error) {
rc, err := h.GetRaftCluster()
if err != nil {
return false, err
}
return rc.GetCoordinator().GetSchedulersController().IsSchedulerExisted(name)
}
// GetScheduleConfig returns ScheduleConfig.
func (h *Handler) GetScheduleConfig() *sc.ScheduleConfig {
return h.s.GetScheduleConfig()
}
// GetHotRegionsWriteInterval gets interval for PD to store Hot Region information..
func (h *Handler) GetHotRegionsWriteInterval() time.Duration {
return h.opt.GetHotRegionsWriteInterval()
}
// GetHotRegionsReservedDays gets days hot region information is kept.
func (h *Handler) GetHotRegionsReservedDays() uint64 {
return h.opt.GetHotRegionsReservedDays()
}
// HistoryHotRegionsRequest wrap request condition from tidb.
// it is request from tidb
type HistoryHotRegionsRequest struct {
StartTime int64 `json:"start_time,omitempty"`
EndTime int64 `json:"end_time,omitempty"`
RegionIDs []uint64 `json:"region_ids,omitempty"`
StoreIDs []uint64 `json:"store_ids,omitempty"`
PeerIDs []uint64 `json:"peer_ids,omitempty"`
IsLearners []bool `json:"is_learners,omitempty"`
IsLeaders []bool `json:"is_leaders,omitempty"`
HotRegionTypes []string `json:"hot_region_type,omitempty"`
}
// GetAllRequestHistoryHotRegion gets all hot region info in HistoryHotRegion form.
func (h *Handler) GetAllRequestHistoryHotRegion(request *HistoryHotRegionsRequest) (*storage.HistoryHotRegions, error) {
var hotRegionTypes = storage.HotRegionTypes
if len(request.HotRegionTypes) != 0 {
hotRegionTypes = request.HotRegionTypes
}
iter := h.GetHistoryHotRegionIter(hotRegionTypes, request.StartTime, request.EndTime)
var results []*storage.HistoryHotRegion
regionSet, storeSet, peerSet, learnerSet, leaderSet :=
make(map[uint64]bool), make(map[uint64]bool),
make(map[uint64]bool), make(map[bool]bool), make(map[bool]bool)
for _, id := range request.RegionIDs {
regionSet[id] = true
}
for _, id := range request.StoreIDs {
storeSet[id] = true
}
for _, id := range request.PeerIDs {
peerSet[id] = true
}
for _, isLearner := range request.IsLearners {
learnerSet[isLearner] = true
}
for _, isLeader := range request.IsLeaders {
leaderSet[isLeader] = true
}
var next *storage.HistoryHotRegion
var err error
for next, err = iter.Next(); next != nil && err == nil; next, err = iter.Next() {
if len(regionSet) != 0 && !regionSet[next.RegionID] {
continue
}
if len(storeSet) != 0 && !storeSet[next.StoreID] {
continue
}
if len(peerSet) != 0 && !peerSet[next.PeerID] {
continue
}
if !learnerSet[next.IsLearner] {
continue
}
if !leaderSet[next.IsLeader] {
continue
}
results = append(results, next)
}
return &storage.HistoryHotRegions{
HistoryHotRegion: results,
}, err
}
// AddScheduler adds a scheduler.
func (h *Handler) AddScheduler(name string, args ...string) error {
c, err := h.GetRaftCluster()
if err != nil {
return err
}
var removeSchedulerCb func(string) error
if c.IsServiceIndependent(mcsutils.SchedulingServiceName) {
removeSchedulerCb = c.GetCoordinator().GetSchedulersController().RemoveSchedulerHandler
} else {
removeSchedulerCb = c.GetCoordinator().GetSchedulersController().RemoveScheduler
}
s, err := schedulers.CreateScheduler(name, c.GetOperatorController(), h.s.storage, schedulers.ConfigSliceDecoder(name, args), removeSchedulerCb)
if err != nil {
return err
}
log.Info("create scheduler", zap.String("scheduler-name", s.GetName()), zap.Strings("scheduler-args", args))
if c.IsServiceIndependent(mcsutils.SchedulingServiceName) {
if err = c.AddSchedulerHandler(s, args...); err != nil {
log.Error("can not add scheduler handler", zap.String("scheduler-name", s.GetName()), zap.Strings("scheduler-args", args), errs.ZapError(err))
return err
}
log.Info("add scheduler handler successfully", zap.String("scheduler-name", name), zap.Strings("scheduler-args", args))
} else {
if err = c.AddScheduler(s, args...); err != nil {
log.Error("can not add scheduler", zap.String("scheduler-name", s.GetName()), zap.Strings("scheduler-args", args), errs.ZapError(err))
return err
}
log.Info("add scheduler successfully", zap.String("scheduler-name", name), zap.Strings("scheduler-args", args))
}
if err = h.opt.Persist(c.GetStorage()); err != nil {
log.Error("can not persist scheduler config", errs.ZapError(err))
return err
}
log.Info("persist scheduler config successfully", zap.String("scheduler-name", name), zap.Strings("scheduler-args", args))
return nil
}
// RemoveScheduler removes a scheduler by name.
func (h *Handler) RemoveScheduler(name string) error {
c, err := h.GetRaftCluster()
if err != nil {
return err
}
if c.IsServiceIndependent(mcsutils.SchedulingServiceName) {
if err = c.RemoveSchedulerHandler(name); err != nil {
log.Error("can not remove scheduler handler", zap.String("scheduler-name", name), errs.ZapError(err))
} else {
log.Info("remove scheduler handler successfully", zap.String("scheduler-name", name))
}
} else {
if err = c.RemoveScheduler(name); err != nil {
log.Error("can not remove scheduler", zap.String("scheduler-name", name), errs.ZapError(err))
} else {
log.Info("remove scheduler successfully", zap.String("scheduler-name", name))
}
}
return err
}
// AddBalanceLeaderScheduler adds a balance-leader-scheduler.
func (h *Handler) AddBalanceLeaderScheduler() error {
return h.AddScheduler(schedulers.BalanceLeaderType)
}
// AddBalanceWitnessScheduler adds a balance-witness-scheduler.
func (h *Handler) AddBalanceWitnessScheduler() error {
return h.AddScheduler(schedulers.BalanceWitnessType)
}
// AddTransferWitnessLeaderScheduler adds a transfer-witness-leader-scheduler.
func (h *Handler) AddTransferWitnessLeaderScheduler() error {
return h.AddScheduler(schedulers.TransferWitnessLeaderType)
}
// AddBalanceRegionScheduler adds a balance-region-scheduler.
func (h *Handler) AddBalanceRegionScheduler() error {
return h.AddScheduler(schedulers.BalanceRegionType)
}
// AddBalanceHotRegionScheduler adds a balance-hot-region-scheduler.
func (h *Handler) AddBalanceHotRegionScheduler() error {
return h.AddScheduler(schedulers.HotRegionType)
}
// AddEvictSlowTrendScheduler adds a evict-slow-trend-scheduler.
func (h *Handler) AddEvictSlowTrendScheduler() error {
return h.AddScheduler(schedulers.EvictSlowTrendType)
}
// AddLabelScheduler adds a label-scheduler.
func (h *Handler) AddLabelScheduler() error {
return h.AddScheduler(schedulers.LabelType)
}
// AddScatterRangeScheduler adds a balance-range-leader-scheduler
func (h *Handler) AddScatterRangeScheduler(args ...string) error {
return h.AddScheduler(schedulers.ScatterRangeType, args...)
}
// AddGrantLeaderScheduler adds a grant-leader-scheduler.
func (h *Handler) AddGrantLeaderScheduler(storeID uint64) error {
return h.AddScheduler(schedulers.GrantLeaderType, strconv.FormatUint(storeID, 10))
}
// AddEvictLeaderScheduler adds an evict-leader-scheduler.
func (h *Handler) AddEvictLeaderScheduler(storeID uint64) error {
return h.AddScheduler(schedulers.EvictLeaderType, strconv.FormatUint(storeID, 10))
}
// AddShuffleLeaderScheduler adds a shuffle-leader-scheduler.
func (h *Handler) AddShuffleLeaderScheduler() error {
return h.AddScheduler(schedulers.ShuffleLeaderType)
}
// AddShuffleRegionScheduler adds a shuffle-region-scheduler.
func (h *Handler) AddShuffleRegionScheduler() error {
return h.AddScheduler(schedulers.ShuffleRegionType)
}
// AddShuffleHotRegionScheduler adds a shuffle-hot-region-scheduler.
func (h *Handler) AddShuffleHotRegionScheduler(limit uint64) error {
return h.AddScheduler(schedulers.ShuffleHotRegionType, strconv.FormatUint(limit, 10))
}
// AddEvictSlowStoreScheduler adds a evict-slow-store-scheduler.
func (h *Handler) AddEvictSlowStoreScheduler() error {
return h.AddScheduler(schedulers.EvictSlowStoreType)
}
// AddSplitBucketScheduler adds a split-bucket-scheduler.
func (h *Handler) AddSplitBucketScheduler() error {
return h.AddScheduler(schedulers.SplitBucketType)
}
// AddRandomMergeScheduler adds a random-merge-scheduler.
func (h *Handler) AddRandomMergeScheduler() error {
return h.AddScheduler(schedulers.RandomMergeType)
}
// AddGrantHotRegionScheduler adds a grant-hot-region-scheduler
func (h *Handler) AddGrantHotRegionScheduler(leaderID, peers string) error {
return h.AddScheduler(schedulers.GrantHotRegionType, leaderID, peers)
}
// SetAllStoresLimit is used to set limit of all stores.
func (h *Handler) SetAllStoresLimit(ratePerMin float64, limitType storelimit.Type) error {
c, err := h.GetRaftCluster()
if err != nil {
return err
}
return c.SetAllStoresLimit(limitType, ratePerMin)
}
// SetAllStoresLimitTTL is used to set limit of all stores with ttl
func (h *Handler) SetAllStoresLimitTTL(ratePerMin float64, limitType storelimit.Type, ttl time.Duration) error {
c, err := h.GetRaftCluster()
if err != nil {
return err
}
c.SetAllStoresLimitTTL(limitType, ratePerMin, ttl)
return nil
}
// SetLabelStoresLimit is used to set limit of label stores.
func (h *Handler) SetLabelStoresLimit(ratePerMin float64, limitType storelimit.Type, labels []*metapb.StoreLabel) error {
c, err := h.GetRaftCluster()
if err != nil {
return err
}
for _, store := range c.GetStores() {
for _, label := range labels {
for _, sl := range store.GetLabels() {
if label.Key == sl.Key && label.Value == sl.Value {
// TODO: need to handle some of stores are persisted, and some of stores are not.
_ = c.SetStoreLimit(store.GetID(), limitType, ratePerMin)
}
}
}
}
return nil
}
// SetStoreLimit is used to set the limit of a store.
func (h *Handler) SetStoreLimit(storeID uint64, ratePerMin float64, limitType storelimit.Type) error {
c, err := h.GetRaftCluster()
if err != nil {
return err
}
return c.SetStoreLimit(storeID, limitType, ratePerMin)
}
// GetRegionsByType gets the region with specified type.
func (h *Handler) GetRegionsByType(typ statistics.RegionStatisticType) ([]*core.RegionInfo, error) {
c := h.s.GetRaftCluster()
if c == nil {
return nil, errs.ErrNotBootstrapped.FastGenByArgs()
}
return c.GetRegionStatsByType(typ), nil
}
// GetSchedulerConfigHandler gets the handler of schedulers.
func (h *Handler) GetSchedulerConfigHandler() (http.Handler, error) {
c, err := h.GetRaftCluster()
if err != nil {
return nil, err
}
mux := http.NewServeMux()
for name, handler := range c.GetSchedulerHandlers() {
prefix := path.Join(pdRootPath, SchedulerConfigHandlerPath, name)
urlPath := prefix + "/"
mux.Handle(urlPath, http.StripPrefix(prefix, handler))
}
return mux, nil
}
// ResetTS resets the ts with specified tso.
func (h *Handler) ResetTS(ts uint64, ignoreSmaller, skipUpperBoundCheck bool, _ uint32) error {
log.Info("reset-ts",
zap.Uint64("new-ts", ts),
zap.Bool("ignore-smaller", ignoreSmaller),
zap.Bool("skip-upper-bound-check", skipUpperBoundCheck))
tsoAllocator, err := h.s.tsoAllocatorManager.GetAllocator(tso.GlobalDCLocation)
if err != nil {
return err
}
if tsoAllocator == nil {
return errs.ErrServerNotStarted
}
return tsoAllocator.SetTSO(ts, ignoreSmaller, skipUpperBoundCheck)
}
// SetStoreLimitScene sets the limit values for different scenes
func (h *Handler) SetStoreLimitScene(scene *storelimit.Scene, limitType storelimit.Type) {
rc := h.s.GetRaftCluster()
if rc == nil {
return
}
rc.GetStoreLimiter().ReplaceStoreLimitScene(scene, limitType)
}
// GetStoreLimitScene returns the limit values for different scenes
func (h *Handler) GetStoreLimitScene(limitType storelimit.Type) *storelimit.Scene {
rc := h.s.GetRaftCluster()
if rc == nil {
return nil
}
return rc.GetStoreLimiter().StoreLimitScene(limitType)
}
// GetProgressByID returns the progress details for a given store ID.
func (h *Handler) GetProgressByID(storeID string) (action string, p, ls, cs float64, err error) {
return h.s.GetRaftCluster().GetProgressByID(storeID)
}
// GetProgressByAction returns the progress details for a given action.
func (h *Handler) GetProgressByAction(action string) (p, ls, cs float64, err error) {
return h.s.GetRaftCluster().GetProgressByAction(action)
}
// PluginLoad loads the plugin referenced by the pluginPath
func (h *Handler) PluginLoad(pluginPath string) error {
h.pluginChMapLock.Lock()
defer h.pluginChMapLock.Unlock()
cluster, err := h.GetRaftCluster()
if err != nil {
return err
}
c := cluster.GetCoordinator()
ch := make(chan string)
h.pluginChMap[pluginPath] = ch
// make sure path is in data dir
filePath, err := filepath.Abs(pluginPath)
if err != nil || !isPathInDirectory(filePath, h.s.GetConfig().DataDir) {
return errs.ErrFilePathAbs.Wrap(err)
}
c.LoadPlugin(pluginPath, ch)
return nil
}
// PluginUnload unloads the plugin referenced by the pluginPath
func (h *Handler) PluginUnload(pluginPath string) error {
h.pluginChMapLock.Lock()
defer h.pluginChMapLock.Unlock()
if ch, ok := h.pluginChMap[pluginPath]; ok {
ch <- schedule.PluginUnload
return nil
}
return errs.ErrPluginNotFound.FastGenByArgs(pluginPath)
}
// GetAddr returns the server urls for clients.
func (h *Handler) GetAddr() string {
return h.s.GetAddr()
}
// SetStoreLimitTTL set storeLimit with ttl
func (h *Handler) SetStoreLimitTTL(data string, value float64, ttl time.Duration) error {
return h.s.SaveTTLConfig(map[string]any{
data: value,
}, ttl)
}
// IsLeader return true if this server is leader
func (h *Handler) IsLeader() bool {
return h.s.member.IsLeader()
}
// GetHistoryHotRegions get hot region info in HistoryHotRegion form.
func (h *Handler) GetHistoryHotRegions(typ utils.RWType) ([]storage.HistoryHotRegion, error) {
hotRegions, err := h.GetHotRegions(typ)
if hotRegions == nil || err != nil {
return nil, err
}
hotPeers := hotRegions.AsPeer
return h.packHotRegions(hotPeers, typ.String())
}
func (h *Handler) packHotRegions(hotPeersStat statistics.StoreHotPeersStat, hotRegionType string) (historyHotRegions []storage.HistoryHotRegion, err error) {
c, err := h.GetRaftCluster()
if err != nil {
return nil, err
}
for _, hotPeersStat := range hotPeersStat {
stats := hotPeersStat.Stats
for _, hotPeerStat := range stats {
region := c.GetRegion(hotPeerStat.RegionID)
if region == nil {
continue
}
meta := region.GetMeta()
meta, err := encryption.EncryptRegion(meta, h.s.encryptionKeyManager)
if err != nil {
return nil, err
}
stat := storage.HistoryHotRegion{
// store in ms.
// TODO: distinguish store heartbeat interval and region heartbeat interval
// read statistic from store heartbeat, write statistic from region heartbeat
UpdateTime: int64(region.GetInterval().GetEndTimestamp() * 1000),
RegionID: hotPeerStat.RegionID,
StoreID: hotPeerStat.StoreID,
PeerID: region.GetStorePeer(hotPeerStat.StoreID).GetId(),
IsLeader: hotPeerStat.IsLeader,
IsLearner: core.IsLearner(region.GetPeer(hotPeerStat.StoreID)),
HotDegree: int64(hotPeerStat.HotDegree),
FlowBytes: hotPeerStat.ByteRate,
KeyRate: hotPeerStat.KeyRate,
QueryRate: hotPeerStat.QueryRate,
StartKey: string(region.GetStartKey()),
EndKey: string(region.GetEndKey()),
EncryptionMeta: meta.GetEncryptionMeta(),
HotRegionType: hotRegionType,
}
historyHotRegions = append(historyHotRegions, stat)
}
}
return
}
// GetHistoryHotRegionIter return a iter which iter all qualified item .
func (h *Handler) GetHistoryHotRegionIter(
hotRegionTypes []string,
startTime, endTime int64,
) storage.HotRegionStorageIterator {
iter := h.s.hotRegionStorage.NewIterator(hotRegionTypes, startTime, endTime)
return iter
}
// RedirectSchedulerUpdate update scheduler config. Export this func to help handle damaged store.
func (h *Handler) redirectSchedulerUpdate(name string, storeID float64) error {
input := make(map[string]any)
input["name"] = name
input["store_id"] = storeID
updateURL, err := url.JoinPath(h.GetAddr(), "pd", SchedulerConfigHandlerPath, name, "config")
if err != nil {
return err
}
body, err := json.Marshal(input)
if err != nil {
return err
}
return apiutil.PostJSONIgnoreResp(h.s.GetHTTPClient(), updateURL, body)
}
// AddEvictOrGrant add evict leader scheduler or grant leader scheduler.
func (h *Handler) AddEvictOrGrant(storeID float64, name string) (exist bool, err error) {
if exist, err = h.IsSchedulerExisted(name); !exist {
if err != nil && !errors.ErrorEqual(err, errs.ErrSchedulerNotFound.FastGenByArgs()) {
return exist, err
}
switch name {
case schedulers.EvictLeaderName:
err = h.AddEvictLeaderScheduler(uint64(storeID))
case schedulers.GrantLeaderName:
err = h.AddGrantLeaderScheduler(uint64(storeID))
}
if err != nil {
return exist, err
}
} else {
if err := h.redirectSchedulerUpdate(name, storeID); err != nil {
return exist, err
}
log.Info("update scheduler", zap.String("scheduler-name", name), zap.Uint64("store-id", uint64(storeID)))
return exist, nil
}
return exist, nil
}