FrankChen021 commented on code in PR #19231:
URL: https://github.com/apache/druid/pull/19231#discussion_r3420715120


##########
sql/src/main/java/org/apache/druid/sql/avatica/DruidMeta.java:
##########
@@ -804,6 +816,8 @@ private DruidConnection openDruidConnection(
       final Map<String, Object> context
   )
   {
+    String remoteAddress = THREAD_LOCAL_REMOTE_ADDRESS.get();

Review Comment:
   [P2] Do not freeze the remote address at connection open
   
   The handlers set `THREAD_LOCAL_REMOTE_ADDRESS` for every Avatica RPC, but 
only `openDruidConnection` reads it and then stores the value on 
`DruidConnection`. Later `createStatement`, `prepare`, `prepareAndExecute`, and 
`execute` paths use that stored address, so a long-lived JDBC connection that 
reconnects through a different proxy/socket, or any reused Avatica connection 
id from another remote, has SQL request logs and the `remoteAddress` metric 
attributed to the opener instead of the actual requester. Please pass the 
current request address into statement/execute creation or refresh the 
connection address per RPC.



-- 
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]

Reply via email to