github-actions[bot] commented on code in PR #70176:
URL: https://github.com/apache/doris/pull/70176#discussion_r4488531469
##########
fe/fe-connector/fe-connector-adbc/src/main/java/org/apache/doris/connector/adbc/AdbcClient.java:
##########
@@ -121,6 +134,69 @@ public <T> T withConnection(AdbcConnectionCall<T> body) {
}
}
+ /** The remote identity, shared by metadata routing and automatic SQL
dialect selection. */
+ Optional<String> vendorName() {
+ Optional<String> known = vendorName.get();
+ if (known != null) {
+ return known;
+ }
+ synchronized (DRIVER_INFO_LOCK) {
Review Comment:
[P1] Synchronize native DriverInfo readers as well as probes
This excludes other vendor probes, but ordinary `withConnection()` calls
still bypass the guard. In the pinned Flight driver 1.12.0,
[`getFlightClient`](https://github.com/apache/arrow-adbc/blob/apache-arrow-adbc-24/go/adbc/driver/flightsql/flightsql_database.go#L436)
reads the shared `DriverInfo` map on every connection open, while
[`PrepareDriverInfo`](https://github.com/apache/arrow-adbc/blob/apache-arrow-adbc-24/go/adbc/driver/flightsql/flightsql_connection.go#L749)
writes it after the vendor RPC. For example, warm catalog A's namespace list,
then run its first `SHOW TABLES` concurrently with catalog B's first vendor
probe using the same library. A's unguarded connection open can overlap B's
write and trigger Go's fatal `concurrent map read and map write`, terminating
FE. The new mandatory metadata probes expose this even with explicit
`sql_dialect` overrides. Protect the native map's readers and writers, or use a
driver with synchronized/isolated state; serializing only `vend
orName()` leaves this crash reachable. The new concurrency tests overlap
probes through fake connections and do not exercise this reader path.
##########
fe/fe-connector/fe-connector-adbc/src/main/java/org/apache/doris/connector/adbc/AdbcDorisMetadata.java:
##########
@@ -0,0 +1,93 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.connector.adbc;
+
+import org.apache.doris.connector.spi.DorisConnectorException;
+
+import org.apache.arrow.adbc.core.AdbcConnection;
+import org.apache.arrow.adbc.core.AdbcException;
+import org.apache.arrow.adbc.core.AdbcStatement;
+import org.apache.arrow.vector.VectorSchemaRoot;
+import org.apache.arrow.vector.ipc.ArrowReader;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Consumer;
+
+/** Metadata confined to the remote catalog that the ADBC connection uses for
SQL execution. */
+final class AdbcDorisMetadata {
+ private static final DorisDialect DIALECT = new DorisDialect();
+
+ private AdbcDorisMetadata() {
+ }
+
+ static boolean isDorisSource(AdbcClient client) {
+ // sql_dialect changes SQL rendering, not the remote vendor's metadata
capabilities.
+ return
client.vendorName().map(String::trim).filter(DIALECT::matchesVendor).isPresent();
Review Comment:
[P2] Keep vendor identity scoped to the remote server
The pinned Flight driver's vendor response can belong to another catalog
even with probes serialized. Keep catalog A alive against Doris and warm its
vendor, then discover catalog B using the same driver against a Flight server
whose `GetSqlInfo` is unimplemented. Native
[`PrepareDriverInfo`](https://github.com/apache/arrow-adbc/blob/apache-arrow-adbc-24/go/adbc/driver/flightsql/flightsql_connection.go#L696)
returns success without clearing the global driver-info map, and
[`Base.GetInfo`](https://github.com/apache/arrow-adbc/blob/apache-arrow-adbc-24/go/adbc/driver/internal/driverbase/connection.go#L176)
returns A's `DorisFE`. B caches that value and this branch sends `SELECT
CURRENT_CATALOG()`/`SHOW DATABASES` to a source that may only implement
standard Flight metadata. Before this change, B could use `sql_dialect=ansi`
with `GetObjects`; that override now cannot avoid the misrouting. Obtain
source-scoped identity or isolate the native vendor state before selecting
Doris-only SQ
L, and cover a Doris server followed by a server without SQL-info support.
--
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]