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


##########
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:
   Thanks for the follow-up. The connection-open freeze is fixed, but I think 
this is still stale one level later: `createStatement` and `prepare` now read 
`THREAD_LOCAL_REMOTE_ADDRESS`, then store that value on the statement/prepared 
statement. Later execution RPCs do not refresh it: 
`DruidMeta.prepareAndExecute` calls `DruidJdbcStatement.execute(...)`, which 
builds the `DirectStatement` with `DruidJdbcStatement.remoteAddress`, and 
`DruidMeta.execute` calls `DruidJdbcPreparedStatement.execute(...)`, whose 
`PreparedStatement.execute(...)` uses the address captured during `prepare`. So 
a long-lived Statement/PreparedStatement reused after reconnect or from another 
remote is still attributed to the create/prepare caller rather than the actual 
execute caller. Could you pass the current `THREAD_LOCAL_REMOTE_ADDRESS.get()` 
through the execute paths as well?
   
   Reviewed 8 of 13 changed files for 
[apache/druid#19231](https://github.com/apache/druid/pull/19231).



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