Skip to content

feat(mysql-dual-conn): add endpoint to trigger COM_STMT_RESET#137

Open
khareyash05 wants to merge 1 commit into
mainfrom
feat/mysql-dual-conn-stmt-reset
Open

feat(mysql-dual-conn): add endpoint to trigger COM_STMT_RESET#137
khareyash05 wants to merge 1 commit into
mainfrom
feat/mysql-dual-conn-stmt-reset

Conversation

@khareyash05
Copy link
Copy Markdown
Member

Description

Adds GET /api/oms/stmt-reset/{n} to mysql-dual-conn that re-executes a
server-side prepared statement n times on the same JDBC connection.
Also updates the OMS JDBC URL with
useServerPrepStmts=true&cachePrepStmts=true&useCursorFetch=true so MySQL
Connector/J 8.x emits COM_STMT_RESET between re-executions.

This lets keploy's existing java_linux CI pipeline exercise the
COM_STMT_RESET synthetic-OK fallback added in keploy/keploy#4217 without
needing to wire a brand new sample app into keploy's workflows. The
existing dual-handshake test path is unaffected — the Camunda pool keeps
the original JDBC URL, and the new endpoint is purely additive.

Related: keploy/keploy#4217 (the match.go fix this endpoint exercises).
A separate PR will be opened against keploy/keploy to add a
curl http://localhost:8080/api/oms/stmt-reset/5 line into
.github/workflows/test_workflow_scripts/java/mysql_dual_conn/java-linux.sh.

Fixes # (n/a)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

cd mysql-dual-conn
docker compose up -d                           # MySQL 8 with myntra_oms + camunda DBs
mvn -B -DskipTests package                     # produces target/mysql-dual-conn-0.0.1-SNAPSHOT.jar

# Record
keploy record -c "java -jar target/mysql-dual-conn-0.0.1-SNAPSHOT.jar"

# In another shell
curl http://localhost:8080/api/query-both
curl http://localhost:8080/api/oms/stmt-reset/5

# Replay
keploy test -c "java -jar target/mysql-dual-conn-0.0.1-SNAPSHOT.jar" --delay 20

The replay log shows the COM_STMT_RESET debug line (stmt id) from
keploy/keploy#4217, and the run completes without
CJCommunicationsException / Socket is closed.

Additional Context

  • The OMS pool was chosen over the Camunda pool deliberately so the
    existing dual-handshake assertions stay unchanged.
  • The endpoint uses JdbcTemplate.execute(ConnectionCallback) to pin all
    n executions to one physical connection; otherwise HikariCP could
    hand out a fresh connection per executeQuery() and the
    COM_STMT_RESET packet would never be emitted.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have signed the commit message (--signoff)

Adds GET /api/oms/stmt-reset/{n} which re-executes a server-side prepared
statement n times on the SAME JDBC connection. Updates the OMS JDBC URL
with useServerPrepStmts=true, cachePrepStmts=true, and useCursorFetch=true
so MySQL Connector/J 8.x emits COM_STMT_RESET between re-executions.

This exercises the COM_STMT_RESET synthetic-OK fallback added in
keploy/keploy#4217 during keploy record/replay against this existing
samples-java CI app, avoiding the need to wire a brand new sample
(spring-mysql-redis) into keploy's java_linux pipeline. The existing
dual-handshake test path is unchanged — the Camunda pool keeps the
original JDBC URL, and the new endpoint is purely additive.

Signed-off-by: Yash Khare <khareyash05@gmail.com>
gouravkrosx pushed a commit to keploy/keploy that referenced this pull request May 29, 2026
…4225)

Adds one curl to /api/oms/stmt-reset/5 inside the mysql-dual-conn
record loop so the java_linux pipeline now exercises the
COM_STMT_RESET synthetic-OK fallback added in #4217. The endpoint
itself is added in keploy/samples-java#137.

Without this, the only Java + MySQL CI app exercises COM_QUERY and
HandshakeResponse41 paths but never re-executes a server-prepared
statement on the same JDBC connection, so the COM_STMT_RESET
branch in matchCommand has no e2e coverage. With this curl, all
three java_linux compat-matrix cells (record_latest_replay_build,
record_build_replay_latest, record_build_replay_build) will fail
if the synthetic-OK fallback ever regresses.

Signed-off-by: Yash Khare <khareyash05@gmail.com>
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.

1 participant