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

table: move add TTL insert rows metrics code out of table package #54521

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions pkg/executor/insert_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,12 @@ func (e *InsertValues) addRecordWithAutoIDHint(
}
}
}

if e.Table.Meta().TTLInfo != nil {
// update the TTL metrics if the table is a TTL table
vars.TxnCtx.InsertTTLRowsCount++
}

return nil
}

Expand Down
8 changes: 0 additions & 8 deletions pkg/table/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -1069,10 +1069,6 @@ func (t *TableCommon) AddRecord(sctx table.MutateContext, r []types.Datum, opts
return recordID, nil
}

if shouldIncreaseTTLMetricCount(t.meta) {
sessVars.TxnCtx.InsertTTLRowsCount += 1
}

colSizeBuffer := sctx.GetMutateBuffers().GetColSizeDeltaBufferWithCap(len(t.Cols()))
for id, col := range t.Cols() {
size, err := codec.EstimateValueSize(sc.TypeCtx(), r[id])
Expand Down Expand Up @@ -1742,10 +1738,6 @@ func shouldWriteBinlog(vars *variable.SessionVars, tblInfo *model.TableInfo) boo
return !vars.InRestrictedSQL
}

func shouldIncreaseTTLMetricCount(tblInfo *model.TableInfo) bool {
return tblInfo.TTLInfo != nil
}

func (t *TableCommon) getMutation(ctx table.MutateContext) *binlog.TableMutation {
return ctx.StmtGetMutation(t.tableID)
}
Expand Down