...
ID | IEP-14 | ||||||||
Author | |||||||||
SponsorAnton Vinogradov | Andrey Gura | ||||||||
Created | Feb 20 2018 | ||||||||
Status |
|
Table of Contents |
---|
...
The following system workers are critical and ignite node will be inoperative in case of termination one of this worker:
disco-event-worker
tcp-disco-sock-reader
tcp-disco-srvr
tcp-disco-msg-worker
tcp-comm-worker
grid-nio-worker-tcp-comm
exchange-worker
sys-stripe
grid-timeout-worker
db-checkpoint-thread
wal-file-archiver
wal-write-worker
wal-file-decompressor
ttl-cleanup-worker
nio-acceptor
...
Code Block | ||
---|---|---|
| ||
interface FailureHandler { voidboolean onFailure(Ignite ignite, FailureContext failureCtx); } class FailureContext { FailureType type; Throwable error; } enum FailureType { SEGMENTATION, SYSTEM_WORKER_TERMINATION, CRITICAL_ERROR } |
...
Default failure handler is StopNodeOrHaltFailureProcessor
where tryStop
value is false
.
Critical system worker must catch all exceptions ( Throwable
and derived classes) in high-level try-catch
block and take into account that thread could be terminated due to an programmatic mistake that leads to unintentional worker termination. So basic template should looks like the following code snippet:
Code Block | ||
---|---|---|
| ||
@Override
public void run() {
Throwable err = null;
try {
// Critical worker's code.
}
catch(Throwable e) {
err = e;
}
finally {
// Call failure handler.
FailureContext failureCtx = new FaulureCtx(FailureType.SYSTEM_WORKER_TERMINATION, err);
ctx.failure().process(failureCtx); // Handle failure. Where ctx - kernal context.
}
} |
Example of using FailureHandler
in IgniteConfiguration
via Spring XML:
Code Block | ||
---|---|---|
| ||
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="failureHandler">
<bean class="org.apache.ignite.failure.StopNodeFailureHandler"/>
</property>
</bean> |
It's possible that node won't be stopped correctly in case of FailureAction.STOP_NODE
due to some bugs and it can lead to process hanging. This bugs should be discovered ad fixed in the future.
Jira | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|