kianWei721 commented on issue #18633:
URL: https://github.com/apache/iotdb/issues/18633#issuecomment-5667444388

   I'm working on this.
   
   I checked the current master (63ae0f3) and the path described above is 
unchanged:
   - `Session.getQuerySessionConnection()` falls back to the default connection 
when `constructSessionConnection` fails, but the failed endpoint stays in the 
`NodesSupplier` round-robin list, so every rotation pays the full connection 
timeout again.
   - `ShowAvailableUrlsTask` still only skips `Removing` DataNodes, so 
`Unknown` nodes are re-added on every node list refresh.
   
   Proposed fix (client side):
   1. When a query endpoint fails to connect, isolate it for a short period. 
`getQueryEndPoint()` skips isolated endpoints and only falls back to the 
default connection when none are left. Once the period expires the endpoint is 
eligible again, so a recovered node is picked up without restarting the client; 
a successful connection clears the mark. Keeping this state in the node 
supplier lets all sessions of a `SessionPool` share it.
   2. Make `RoundRobinPolicy` thread-safe, since a single supplier is shared by 
every session in the pool.
   3. Unit tests: an isolated endpoint is not retried within the period, is 
retried after it, and the all-isolated case still falls back to the default 
connection.
   
   A few questions before I open the PR:
   - Should the isolation period be a new builder option, or an internal 
default?
   - Should `SHOW AVAILABLE URLS` also exclude `Unknown` nodes? I'd suggest a 
separate PR for that, since client-side isolation is still needed when a node 
is `Running` but unreachable from the client.
   - `SessionConnection.reconnect()` also iterates over all available nodes. 
Should it skip isolated endpoints as well, or keep that for a follow-up?


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

Reply via email to