Package org.apache.ignite.internal.cdc
Interface CdcManager
-
- All Superinterfaces:
GridCacheSharedManager
- All Known Implementing Classes:
CdcUtilityActiveCdcManager
public interface CdcManager extends GridCacheSharedManager
CDC manager responsible for logic of capturing data within Ignite node. Communication betweenCdcManagerandCdcMaincomponents is established through CDC management WAL records.CdcManagerlogs them, whileCdcMainlistens to them:-
This manager can log
CdcManagerRecordwith committed consumer state. This record will be handled byCdcMainthe same way it handlesCdcConsumer.onEvents(Iterator)when it returnstrue. -
This manager must log
CdcManagerStopRecordafter it stopped handling records by any reason.CdcMainwill start consume records instead sinceCdcManagerRecord.walState()of last consumedCdcManagerRecord. -
Apache Ignite provides a default implementation -
CdcUtilityActiveCdcManager. It is disabled from the beginning, logs theCdcManagerStopRecordafter Ignite node started, and then delegates consuming CDC events to theCdcMainutility.
PluginProviderthat will return the implementation withPluginProvider.createComponent(PluginContext, Class)method. TheClassparameter in the method isCdcManagerclass.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidafterBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr, GridCacheDatabaseSharedManager.RestoreBinaryState restoreState)Callback is executed only once on Ignite node start when binary memory has fully restored and WAL logging is resumed.voidcollect(ByteBuffer dataBuf)Callback to collect written WAL records.booleanenabled()If this manager isn't enabled then Ignite skips notifying the manager with following methods.-
Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheSharedManager
onDisconnected, onKernalStart, onKernalStop, onReconnected, printMemoryStats, start, stop
-
-
-
-
Method Detail
-
enabled
boolean enabled()
If this manager isn't enabled then Ignite skips notifying the manager with following methods.- Returns:
trueif manager is enabled, otherwisefalse.
-
afterBinaryMemoryRestore
default void afterBinaryMemoryRestore(IgniteCacheDatabaseSharedManager mgr, GridCacheDatabaseSharedManager.RestoreBinaryState restoreState) throws IgniteCheckedException
Callback is executed only once on Ignite node start when binary memory has fully restored and WAL logging is resumed. It's executed before the first call ofcollect(ByteBuffer).Implementation suggestions:
- Callback can be used for restoring CDC state on Ignite node start, collecting missed events from WAL segments.
- Be aware, this method runs in the Ignite system thread and might get longer the Ignite start procedure.
- Ignite node will fail in case the method throws an exception.
- Throws:
IgniteCheckedException
-
collect
void collect(ByteBuffer dataBuf)
Callback to collect written WAL records. The provided buffer is a continuous part of WAL segment file. The buffer might contain full content of a segment or only piece of it. There are guarantees:- This method is invoked sequentially.
- Provided
dataBufis a continuation of the previous one. dataBufcontains finite number of completed WAL records. No partially written WAL records are present.- Records can be read from the buffer with
RecordSerializer.readRecord(FileInput, WALPointer). dataBufmust not be changed within this method.
Implementation suggestions:
-
Frequence of calling the method depends on frequence of fsyncing WAL segment.
See
IgniteSystemProperties.IGNITE_WAL_SEGMENT_SYNC_TIMEOUT. -
It must handle the content of the
dataBufwithin the calling thread. Content of the buffer will not be changed before this method returns. - It must not block the calling thread and work quickly.
- Ignite will ignore any
Throwablethrowed from this method.
- Parameters:
dataBuf- Buffer that contains data to collect.
-
-