Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
137754: sql: avoid some vevent-related allocs r=tbg a=tbg

Extracted from cockroachdb#137569.

Epic: CRDB-42584

Co-authored-by: Tobias Grieger <[email protected]>
  • Loading branch information
craig[bot] and tbg committed Dec 23, 2024
2 parents ac3c5f2 + a1de65e commit 427e159
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/sql/exec_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -2736,6 +2736,7 @@ func (st *SessionTracing) Enabled() bool {
// logical planning starts.
func (st *SessionTracing) TracePlanStart(ctx context.Context, stmtTag string) {
if st.enabled {
stmtTag := stmtTag // alloc only if taken
log.VEventf(ctx, 2, "planning starts: %s", stmtTag)
}
}
Expand Down Expand Up @@ -2773,7 +2774,10 @@ func (st *SessionTracing) TraceRetryInformation(ctx context.Context, retries int
// TraceExecStart conditionally emits a trace message at the moment
// plan execution starts.
func (st *SessionTracing) TraceExecStart(ctx context.Context, engine redact.SafeString) {
log.VEventfDepth(ctx, 2, 1, "execution starts: %s engine", engine)
if log.ExpensiveLogEnabledVDepth(ctx, 2, 1) {
engine := engine // heap alloc only if needed
log.VEventfDepth(ctx, 2, 1, "execution starts: %s engine", engine)
}
}

// TraceExecConsume creates a context for TraceExecRowsResult below.
Expand Down

0 comments on commit 427e159

Please sign in to comment.