github-actions[bot] commented on code in PR #68321:
URL: https://github.com/apache/doris/pull/68321#discussion_r4089298820
##########
fe/fe-connector/fe-connector-jdbc/src/main/java/org/apache/doris/connector/jdbc/client/JdbcMySQLConnectorClient.java:
##########
@@ -76,10 +77,15 @@ private void detectDoris() {
try {
conn = getConnection();
stmt = conn.createStatement();
- rs = stmt.executeQuery("SHOW VARIABLES LIKE 'version_comment'");
+ rs = stmt.executeQuery("SHOW VARIABLES LIKE 'server_identity'");
Review Comment:
[P2] Make this an exact variable lookup in both JDBC implementations. In
`SHOW ... LIKE`, each `_` is a one-character wildcard, but this branch trusts
the first row and never verifies `Variable_name`. A MySQL/MariaDB-compatible
endpoint without `server_identity` but with a matching name such as
`serverXidentity` can therefore suppress the `version_comment` fallback—or be
misclassified if that row carries the marker. Please escape both underscores
and validate/iterate the returned name before treating the identity as
authoritative; the legacy copy has the same issue.
##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -1385,6 +1387,9 @@ public void checkQuerySlotCount(String slotCnt) {
@VarAttrDef.VarAttr(name = HAVE_QUERY_CACHE, flag = VarAttrDef.READ_ONLY)
public boolean haveQueryCache = false;
+ @VarAttrDef.VarAttr(name = SERVER_IDENTITY, flag = VarAttrDef.READ_ONLY)
+ public String serverIdentity = APACHE_DORIS_SERVER_IDENTITY;
Review Comment:
[P2] Keep the server identity outside mutable session state. Streaming jobs
accept arbitrary `session.*` properties, and `SessionVariable.readFromMap`
writes annotated fields without enforcing `READ_ONLY`; `StreamingInsertTask`
then installs that object before planning the insert. As a result,
`session.server_identity=mysql` passes validation and an insert expression
using `@@server_identity` resolves to `mysql`, even though this is meant to be
a stable read-only product marker. Please make this an immutable/global
variable (as `version_comment` is), or protect every session restore/override
path, and cover this override with a test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]