Skip to content

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

Closed
slayerjain wants to merge 1 commit into
mainfrom
feat/tidb-stmt-cache-cross-query
Closed

feat(tidb-stmt-cache): add /api/cross orphaned same-param-shape endpoint#144
slayerjain wants to merge 1 commit into
mainfrom
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 with an identical one-int parameter signature in
a single request (SELECT ? AS v and SELECT ? + 1000 AS w). When both
PREPAREs predate keploy's record window (orphaned mocks), this exercises the
parameter-aware orphaned-EXECUTE path — a param-only match must not serve query
B's row for query A. a must echo v, b must be v+1000.

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

What type of PR is this?

  • ✅ Test (sample-app endpoint for e2e coverage)
curl localhost:8080/api/cross/7   # -> {"a":7,"b":1007}

In-repo replacement for #143 (which was from a fork). Branch moved here so CI runs without the fork guard.

🤖 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]>
@slayerjain

Copy link
Copy Markdown
Member Author

Redundant — the same /api/cross endpoint was already merged via #143. Closing.

@slayerjain slayerjain closed this Jun 9, 2026

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 sample to exercise Keploy’s orphaned prepared-statement EXECUTE matching when two different SQL queries share the same single-int parameter shape in one request.

Changes:

  • Introduces GET /api/cross/{v} that runs SELECT ? AS v and SELECT ? + 1000 AS w back-to-back and returns {a, b}.
  • Documents the intended orphaned-mock matching behavior and expected response invariants.

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

Comment on lines +101 to +103
public Map<String, Object> cross(@PathVariable("v") int v) {
Integer a = jdbc.queryForObject("SELECT ? AS v", Integer.class, v);
Integer b = jdbc.queryForObject("SELECT ? + 1000 AS w", Integer.class, v);
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