From 520ce8347e9c1fb9721de3889bb2cb2d0e73d099 Mon Sep 17 00:00:00 2001 From: Artem Danilov Date: Fri, 27 Oct 2023 09:16:53 -0700 Subject: [PATCH] fix slow store with system metadata (#13) * fix slow store with system metadata Co-authored-by: artem_danilov --- domain/domain.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/domain/domain.go b/domain/domain.go index cb03690cd11b8..a92aebd073c53 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -184,6 +184,7 @@ func (do *Domain) loadInfoSchema(startTS uint64) (infoschema.InfoSchema, bool, i loadSchemaDurationTotal.Observe(time.Since(beginTime).Seconds()) }() snapshot := do.store.GetSnapshot(kv.NewVersion(startTS)) + snapshot.SetOption(kv.TiKVClientReadTimeout, uint64(3000)) m := meta.NewSnapshotMeta(snapshot) neededSchemaVersion, err := m.GetSchemaVersionWithNonEmptyDiff() if err != nil { @@ -198,7 +199,7 @@ func (do *Domain) loadInfoSchema(startTS uint64) (infoschema.InfoSchema, bool, i if is := do.infoCache.GetByVersion(neededSchemaVersion); is != nil { // try to insert here as well to correct the schemaTs if previous is wrong - // the insert method check if schemaTs is zero + // the insert method check if schemaTs is zero do.infoCache.Insert(is, uint64(schemaTs)) return is, true, 0, nil, nil } @@ -794,7 +795,7 @@ func (do *Domain) loadSchemaInLoop(ctx context.Context, lease time.Duration) { defer util.Recover(metrics.LabelDomain, "loadSchemaInLoop", nil, true) // Lease renewal can run at any frequency. // Use lease/2 here as recommend by paper. - ticker := time.NewTicker(lease / 2) + ticker := time.NewTicker(lease / 10) defer func() { ticker.Stop() do.wg.Done()