Skip to content

Commit

Permalink
[branch-2.1](arrow-flight-sql) Fix return result from FE Arrow Flight…
Browse files Browse the repository at this point in the history
… server error 0.0.0.0:xxx, connection refused (#40229)

pick #40002
  • Loading branch information
xinyiZzz authored Sep 2, 2024
1 parent b104e93 commit 5db2c8b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.doris.service.arrowflight;

import org.apache.doris.common.Config;
import org.apache.doris.service.FrontendOptions;
import org.apache.doris.service.arrowflight.auth2.FlightBearerTokenAuthenticator;
import org.apache.doris.service.arrowflight.sessions.FlightSessionsManager;
import org.apache.doris.service.arrowflight.sessions.FlightSessionsWithTokenManager;
Expand Down Expand Up @@ -45,7 +46,6 @@ public class DorisFlightSqlService {

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

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

0 comments on commit 5db2c8b

Please sign in to comment.