Skip to content

Commit

Permalink
fix slow store with system metadata (pingcap#13)
Browse files Browse the repository at this point in the history
* fix slow store with system metadata

Co-authored-by: artem_danilov <[email protected]>
  • Loading branch information
2 people authored and GitHub Enterprise committed Oct 27, 2023
1 parent 2a58cd8 commit 520ce83
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 520ce83

Please sign in to comment.