Skip to content

tpcc: close prepared statements before RefreshConn#209

Open
together-wang wants to merge 1 commit into
pingcap:masterfrom
together-wang:agent/close-tpcc-statements-before-refresh
Open

tpcc: close prepared statements before RefreshConn#209
together-wang wants to merge 1 commit into
pingcap:masterfrom
together-wang:agent/close-tpcc-statements-before-refresh

Conversation

@together-wang

Copy link
Copy Markdown

Summary

  • close all TPCC prepared statements before refreshing a connection
  • clear statement maps so the next run prepares statements only for the new connection
  • reuse the same cleanup path during thread teardown
  • add a regression test covering statement close and map cleanup

Fixes #208.

Why

When a TPCC connection is refreshed after a failed ping or at the configured refresh interval, the old prepared statements were left open while the new connection prepared another full statement set. Repeating this cycle can retain server-side prepared statements and their associated parser/plan-cache memory.

Closing the old statements before RefreshConn releases the old connection's statement resources before the new set is prepared.

Validation

  • GOEXPERIMENT=jsonv2 go test ./tpcc ./pkg/workload -count=1
  • GOEXPERIMENT=jsonv2 go test ./... -count=1
  • GOEXPERIMENT=jsonv2 go vet ./...

@pingcap-cla-assistant

pingcap-cla-assistant Bot commented Jul 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@together-wang
together-wang marked this pull request as ready for review July 13, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[tpcc] close prepared statements before RefreshConn to avoid statement accumulation

1 participant