DemonicTutor opened a new pull request, #13871:
URL: https://github.com/apache/ignite/pull/13871

   Fixes #13870.
   
   On a server node segmented with `SegmentationPolicy.NOOP`, operations that 
wait for a discovery custom message never return, for example 
`QueryCursor.close()` of a continuous query and `getOrCreateCache()`. 
`GridDiscoveryManager.onSegmentation()` disconnects the discovery SPI, which 
stops the ring message worker, but `ServerImpl.sendCustomEvent()` still adds 
messages to that worker's queue: they are never sent and nothing fails.
   
   ### Changes
   
   - `ServerImpl.sendCustomEvent()` throws `IgniteSpiException` while the SPI 
is disconnecting or disconnected, as `ClientImpl.sendCustomEvent()` does for a 
stopped or segmented client. `GridDiscoveryManager.sendCustomEvent()` wraps it, 
so `getOrCreateCache()` and the other callers fail at once instead of waiting 
forever.
   - `GridContinuousProcessor` remembers the local segmentation and from then 
on completes `stopRoutine()` locally: the routine is already unregistered on 
the node, and the stop request could not reach the other nodes anyway (they 
drop the auto-unsubscribe routines of a failed node themselves). A cursor close 
after the segmentation succeeds, also inside an `EVT_NODE_SEGMENTED` listener, 
which runs before `onSegmentation()` disconnects the SPI.
   
   ### Behaviour change to review
   
   Callers that catch a failed send now log an error where the message used to 
vanish, for example `CacheAffinitySharedManager` ("Failed to send affinity 
change message."). One path can now reach the failure handler: if the lone node 
finishes, as coordinator, an exchange that was in flight at the segmentation 
and has to send a `ChangeGlobalStateFinishMessage` or an 
`ExchangeFailureMessage` 
(`GridDhtPartitionsExchangeFuture.finishExchangeOnCoordinator()`), that 
exchange now fails and the exchange worker reports `SYSTEM_WORKER_TERMINATION`. 
Before, the node kept running with the state transition never finished, or with 
the exchange never completed.
   
   ### Tests
   
   New `TcpDiscoveryNoopSegmentationTest`, added to 
`IgniteSpiDiscoverySelfTestSuite2`: three server nodes with 
`SegmentationPolicy.NOOP`; another node fails one of them with `failNode()`, 
which segments it.
   
   | Test | Before | `ServerImpl` change only | `GridContinuousProcessor` 
change only | This PR |
   |---|---|---|---|---|
   | `testCloseContinuousQueryAfterSegmentation` | hangs | fails: `Failed to 
send custom message` | passes | passes |
   | `testCloseContinuousQueryInSegmentationListener` | hangs | hangs | passes 
| passes |
   | `testCreateCacheAfterSegmentation` | hangs | passes | hangs | passes |
   
   "Hangs": the operation does not complete within the test's 10 s timeout.
   
   Also run with the change on JDK 17: `TcpDiscoverySelfTest`, 
`TcpClientDiscoverySpiSelfTest`, `TcpDiscoverySegmentationPolicyTest`, 
`TcpDiscoveryNetworkIssuesTest`, `TcpDiscoverySpiMBeanTest`, 
`TcpCommunicationSpiSkipMessageSendTest`, `IgniteSlowClientDetectionSelfTest`, 
`GridEventConsumeSelfTest`. All pass, except two `TcpDiscoverySelfTest` tests 
that check a 300 KB string log 
(`testNoRingMessageWorkerAbnormalFailureOnSegmentation`, 
`testNodeShutdownOnRingMessageWorkerFailure`): with all these classes in one 
JVM, thread dumps fill that log, and they fail the same way on master; run 
alone, they pass. Checkstyle passes.
   
   There is no JIRA ticket yet; the report is #13870. I will rename the PR to 
the `IGNITE-XXXX` pattern once there is one.
   


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