Skip to content

Commit 96d614f

Browse files
authored
[fix](arrow-flight-sql) Fix return result from FE Arrow Flight server error 0.0.0.0:xxx, connection refused (#40002)
Fix: #36340 Introduced in: #34850 ``` adbc_driver_manager.OperationalError: IO: [FlightSQL] connection error: desc = "transport: Error while dialing: dial tcp 0.0.0.0:8029: connect: connection refused" (Unavailable; DoGet: endpoint 0: [uri:"grpc+tcp://0.0.0.0:8029"]) ``` When query results are returned from FE Arrow Flight server, and Doris FE and ADBC ​​Client are not on the same machine, such as `show tables;`, `show databases;`, the IP in FlightInfo returned by FE to the client is wrong, and `0.0.0.0` is returned instead of the real IP of FE. The client fails to pull the results from `0.0.0.0`. No problem when query results are returned from BE Arrow Flight server, such as the normal query statement `select * from xxx`.
1 parent f87e51c commit 96d614f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fe/fe-core/src/main/java/org/apache/doris/service/arrowflight/DorisFlightSqlService.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.doris.service.arrowflight;
1919

2020
import org.apache.doris.common.Config;
21+
import org.apache.doris.service.FrontendOptions;
2122
import org.apache.doris.service.arrowflight.auth2.FlightBearerTokenAuthenticator;
2223
import org.apache.doris.service.arrowflight.sessions.FlightSessionsManager;
2324
import org.apache.doris.service.arrowflight.sessions.FlightSessionsWithTokenManager;
@@ -45,7 +46,6 @@ public class DorisFlightSqlService {
4546

4647
public DorisFlightSqlService(int port) {
4748
BufferAllocator allocator = new RootAllocator();
48-
Location location = Location.forGrpcInsecure("0.0.0.0", port);
4949
// arrow_flight_token_cache_size less than qe_max_connection to avoid `Reach limit of connections`.
5050
// arrow flight sql is a stateless protocol, connection is usually not actively disconnected.
5151
// bearer token is evict from the cache will unregister ConnectContext.
@@ -54,8 +54,9 @@ public DorisFlightSqlService(int port) {
5454
Config.arrow_flight_token_alive_time);
5555
this.flightSessionsManager = new FlightSessionsWithTokenManager(flightTokenManager);
5656

57-
DorisFlightSqlProducer producer = new DorisFlightSqlProducer(location, flightSessionsManager);
58-
flightServer = FlightServer.builder(allocator, location, producer)
57+
DorisFlightSqlProducer producer = new DorisFlightSqlProducer(
58+
Location.forGrpcInsecure(FrontendOptions.getLocalHostAddress(), port), flightSessionsManager);
59+
flightServer = FlightServer.builder(allocator, Location.forGrpcInsecure("0.0.0.0", port), producer)
5960
.headerAuthenticator(new FlightBearerTokenAuthenticator(flightTokenManager)).build();
6061
LOG.info("Arrow Flight SQL service is created, port: {}, token_cache_size: {}"
6162
+ ", qe_max_connection: {}, token_alive_time: {}",

0 commit comments

Comments
 (0)