[ 
https://issues.apache.org/jira/browse/IGNITE-29299?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladislav Pyatkov updated IGNITE-29299:
---------------------------------------
    Description: 
Ignite 2 exposes server-assigned connection IDs in SYS.CLIENT_CONNECTIONS and 
uses them in connection-management APIs, but thin clients do not receive this 
ID during handshake. This makes it difficult to correlate client-side request 
failures and reconnect events with server-side connections, especially behind 
NAT or TCP proxies.

Return the existing server connection ID in the successful handshake response 
and expose it through the public Java thin-client ConnectionDescription API, 
connection/request monitoring events, and diagnostic logs. Keep the ID per 
channel so that events from the old and new connections remain distinguishable 
after reconnect.

Proposed public API addition to 
org.apache.ignite.client.events.ConnectionDescription:
{code:java}
/**
 * Returns the server-assigned connection ID, matching SYS.CLIENT_CONNECTIONS.
 * Returns null before a successful handshake or if unsupported by the server.
 */
@Nullable
public Long connectionId();
{code}

Example usage after the change:
{code:java}
configuration.setEventListeners(new ConnectionEventListener() {
    @Override
    public void onHandshakeSuccess(HandshakeSuccessEvent event) {
        ConnectionDescription connection = event.connectionDescription();

        log.info("Ignite connection opened: nodeId={}, connectionId={}",
            connection.serverNodeId(), connection.connectionId());
    }
});
{code}

The same ID should be available through connectionDescription() in 
ConnectionClosedEvent and request monitoring events, including 
RequestFailEvent, so applications can log nodeId, connectionId and requestId 
together. Include the ID in standard client diagnostic logs as well.

Negotiate support with a protocol feature flag to preserve compatibility with 
older clients and servers.

  was:
Ignite 2 exposes server-assigned connection IDs in SYS.CLIENT_CONNECTIONS and 
uses them in connection-management APIs, but thin clients do not receive this 
ID during handshake. This makes it difficult to correlate client-side request 
failures and reconnect events with server-side connections, especially behind 
NAT or TCP proxies.

Return the existing server connection ID in the successful handshake response 
and expose it through the public Java thin-client ConnectionDescription API, 
connection/request monitoring events, and diagnostic logs. Keep the ID per 
channel so that events from the old and new connections remain distinguishable 
after reconnect.

Negotiate support with a protocol feature flag to preserve compatibility with 
older clients and servers. The ID should be unavailable before a successful 
handshake or when the server does not support the feature.


> [Thin client] Expose server connection ID in handshake and monitoring events
> ----------------------------------------------------------------------------
>
>                 Key: IGNITE-29299
>                 URL: https://issues.apache.org/jira/browse/IGNITE-29299
>             Project: Ignite
>          Issue Type: Improvement
>          Components: thin client
>            Reporter: Vladislav Pyatkov
>            Priority: Major
>
> Ignite 2 exposes server-assigned connection IDs in SYS.CLIENT_CONNECTIONS and 
> uses them in connection-management APIs, but thin clients do not receive this 
> ID during handshake. This makes it difficult to correlate client-side request 
> failures and reconnect events with server-side connections, especially behind 
> NAT or TCP proxies.
> Return the existing server connection ID in the successful handshake response 
> and expose it through the public Java thin-client ConnectionDescription API, 
> connection/request monitoring events, and diagnostic logs. Keep the ID per 
> channel so that events from the old and new connections remain 
> distinguishable after reconnect.
> Proposed public API addition to 
> org.apache.ignite.client.events.ConnectionDescription:
> {code:java}
> /**
>  * Returns the server-assigned connection ID, matching SYS.CLIENT_CONNECTIONS.
>  * Returns null before a successful handshake or if unsupported by the server.
>  */
> @Nullable
> public Long connectionId();
> {code}
> Example usage after the change:
> {code:java}
> configuration.setEventListeners(new ConnectionEventListener() {
>     @Override
>     public void onHandshakeSuccess(HandshakeSuccessEvent event) {
>         ConnectionDescription connection = event.connectionDescription();
>         log.info("Ignite connection opened: nodeId={}, connectionId={}",
>             connection.serverNodeId(), connection.connectionId());
>     }
> });
> {code}
> The same ID should be available through connectionDescription() in 
> ConnectionClosedEvent and request monitoring events, including 
> RequestFailEvent, so applications can log nodeId, connectionId and requestId 
> together. Include the ID in standard client diagnostic logs as well.
> Negotiate support with a protocol feature flag to preserve compatibility with 
> older clients and servers.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to