Skip to content

feat(tidb-stmt-cache): add /api/cross orphaned same-param-shape endpoint#143

Merged
slayerjain merged 1 commit into
keploy:mainfrom
slayerjain:feat/tidb-stmt-cache-cross-query
Jun 9, 2026
Merged

feat(tidb-stmt-cache): add /api/cross orphaned same-param-shape endpoint#143
slayerjain merged 1 commit into
keploy:mainfrom
slayerjain:feat/tidb-stmt-cache-cross-query

Conversation

@slayerjain

Copy link
Copy Markdown
Member

Describe the changes that are made

Adds GET /api/cross/{v} to the tidb-stmt-cache sample.

It issues two distinct prepared queries that share an identical one-int
parameter signature
inside a single request:

Integer a = jdbc.queryForObject("SELECT ? AS v", Integer.class, v);        // expect v
Integer b = jdbc.queryForObject("SELECT ? + 1000 AS w", Integer.class, v); // expect v+1000

When both COM_STMT_PREPAREs predate keploy's record window (orphaned mocks,
expectedQuery==""), this exercises the matcher's parameter-aware
orphaned-EXECUTE path: a param-only match must not serve query B's row for
query A just because the bound parameter is equal. a must echo v and b
must be v+1000.

No schema or JDBC-URL change; reuses the existing kv table flags
(useServerPrepStmts=true&cachePrepStmts=true).

Links & References

Closes: NA

🔗 Related PRs

  • Consumed by the keploy/keploy java_linux tidb-stmt-cache e2e job (companion PR).

What type of PR is this?

  • ✅ Test (sample-app endpoint for e2e coverage)

Are there any sample code or steps to test the changes?

  • 👍 yes
curl localhost:8080/api/cross/7   # -> {"a":7,"b":1007}

🤖 Generated with Claude Code

Adds GET /api/cross/{v}, which issues two DISTINCT prepared queries with an
identical one-int parameter signature ("SELECT ? AS v" and "SELECT ? + 1000 AS
w") inside a single request. When both PREPAREs predate the record window
(orphaned mocks, expectedQuery==""), this exercises the matcher's
parameter-aware orphaned-EXECUTE path: a param-only match must not serve query
B's row for query A. a must echo v and b must be v+1000.

Consumed by the keploy/keploy java_linux tidb-stmt-cache e2e job.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: slayerjain <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new endpoint to the tidb-stmt-cache Spring sample to exercise Keploy’s orphaned-EXECUTE matching behavior when two distinct prepared statements share the same one-int parameter shape within a single request.

Changes:

  • Add GET /api/cross/{v} that executes two different prepared SELECT statements with the same bound parameter.
  • Return both results in a single JSON payload ({"a": v, "b": v+1000}) to detect cross-statement mismatches during replay.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@slayerjain slayerjain merged commit d9e09f4 into keploy:main Jun 9, 2026
2 checks passed
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.

2 participants