Skip to content
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

fix partition state pinned by mo table stats and adding some metrics. #21167

Merged
merged 5 commits into from
Jan 9, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions pkg/vm/engine/disttae/mo_table_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -1450,6 +1450,8 @@ func (tp *tablePair) Done(err error) {
}
tp.errChan = nil
}

tp.pState = nil
}

type statsList struct {
Expand Down Expand Up @@ -1573,20 +1575,22 @@ func (d *dynamicCtx) tableStatsExecutor(
tbls := d.tableStock.tbls[:]
d.Unlock()

if timeout, err = d.alphaTask(
timeout, err = d.alphaTask(
newCtx, service,
tbls,
"main routine",
); err != nil {
logutil.Info(logHeader,
zap.String("source", "table stats top executor"),
zap.String("exit by alpha err", err.Error()))
return err
}
)

d.Lock()

if len(d.tableStock.tbls) > 0 && !timeout {
executeTicker.Reset(d.conf.UpdateDuration)

for i := range d.tableStock.tbls {
d.tableStock.tbls[i].pState = nil
}
d.tableStock.tbls = d.tableStock.tbls[:0]

if len(d.tableStock.tbls) > 0 && !timeout && err == nil {
// if alpha timeout, this round should mark as failed,
// skip the update of the special stats start.
if _, err = d.updateSpecialStatsStart(
Expand All @@ -1596,9 +1600,14 @@ func (d *dynamicCtx) tableStatsExecutor(
}
}

executeTicker.Reset(d.conf.UpdateDuration)
d.tableStock.tbls = d.tableStock.tbls[:0]
d.Unlock()

if err != nil {
logutil.Info(logHeader,
zap.String("source", "table stats top executor"),
zap.String("exit by alpha err", err.Error()))
return err
}
}
}
}
Expand Down Expand Up @@ -1774,6 +1783,8 @@ func (d *dynamicCtx) alphaTask(
if waitErrDur >= time.Minute*5 {
// waiting reached the limit
for i := range tblBackup {
// cannot pin this pState
tblBackup[i].pState = nil
if !tblBackup[i].valid {
continue
}
Expand Down
Loading