Search before asking
Version
4.0.5
What happened
DDL statements (CREATE DATABASE, CREATE TABLE, etc.) executed via Arrow Flight SQL protocol crash with:
java.lang.RuntimeException: getMysqlChannel not in mysql connection
This is a regression introduced in 4.0.5 (works in 4.0.3). The root cause is commit 1a8590e0b22 ("fix Support CLIENT_DEPRECATE_EOF to fix empty result with MySQL driver 9.5.0 #61050 (#61062)").
Root Cause Analysis
The CLIENT_DEPRECATE_EOF fix added context.getMysqlChannel().clientDeprecatedEOF() calls in StmtExecutor.java at two locations (lines ~1537 and ~1587):
if (!context.getMysqlChannel().clientDeprecatedEOF()) {
// send EOF packet
}
These code paths are also traversed during Flight SQL DDL execution. However, FlightSqlConnectContext.getMysqlChannel() throws RuntimeException("getMysqlChannel not in mysql connection") (see FlightSqlConnectContext.java:54-56), because Flight SQL does not use MySQL channels.
The fix should add a connectType check before calling getMysqlChannel():
if (context.getConnectType() == ConnectType.MYSQL
&& !context.getMysqlChannel().clientDeprecatedEOF()) {
// send EOF packet
}
Similar guards already exist in other parts of the codebase, e.g., InsertIntoTableCommand.java:383:
if (ctx.getConnectType() == ConnectType.MYSQL && ctx.getMysqlChannel() != null) {
ctx.getMysqlChannel().reset();
}
Full Stack Trace
INTERNAL: [FlightSQL] get flight info statement failed, after executeQueryStatement handleQuery,
java.lang.RuntimeException: after executeQueryStatement handleQuery, error code: ERR_UNKNOWN_ERROR,
error msg: RuntimeException, msg: getMysqlChannel not in mysql connection (Internal; ExecuteQuery)
at org.apache.doris.service.arrowflight.sessions.FlightSqlConnectContext.getMysqlChannel(FlightSqlConnectContext.java:55)
at org.apache.doris.qe.StmtExecutor.sendFields(StmtExecutor.java:1537)
What you expected to happen
DDL statements should execute successfully via Arrow Flight SQL, as they did in 4.0.3.
How to reproduce
- Connect to Doris 4.0.5 using ADBC Flight SQL client (e.g.,
adbc_driver_flightsql)
- Execute any DDL statement:
import adbc_driver_flightsql.dbapi as flight_sql
conn = flight_sql.connect(uri="grpc://fe-host:8070", db_kwargs={"username": "root", "password": "pass"})
cursor = conn.cursor()
cursor.execute("CREATE DATABASE IF NOT EXISTS test_db") # CRASHES
- Error:
RuntimeException: getMysqlChannel not in mysql connection
Anything else
Are you willing to submit PR?
Code of Conduct
Search before asking
Version
4.0.5
What happened
DDL statements (CREATE DATABASE, CREATE TABLE, etc.) executed via Arrow Flight SQL protocol crash with:
This is a regression introduced in 4.0.5 (works in 4.0.3). The root cause is commit
1a8590e0b22("fix Support CLIENT_DEPRECATE_EOF to fix empty result with MySQL driver 9.5.0 #61050 (#61062)").Root Cause Analysis
The CLIENT_DEPRECATE_EOF fix added
context.getMysqlChannel().clientDeprecatedEOF()calls inStmtExecutor.javaat two locations (lines ~1537 and ~1587):These code paths are also traversed during Flight SQL DDL execution. However,
FlightSqlConnectContext.getMysqlChannel()throwsRuntimeException("getMysqlChannel not in mysql connection")(seeFlightSqlConnectContext.java:54-56), because Flight SQL does not use MySQL channels.The fix should add a
connectTypecheck before callinggetMysqlChannel():Similar guards already exist in other parts of the codebase, e.g.,
InsertIntoTableCommand.java:383:Full Stack Trace
What you expected to happen
DDL statements should execute successfully via Arrow Flight SQL, as they did in 4.0.3.
How to reproduce
adbc_driver_flightsql)RuntimeException: getMysqlChannel not in mysql connectionAnything else
POST /api/query/{catalog}/{db}) instead of Flight SQL.Are you willing to submit PR?
Code of Conduct