Dropped Packet Listener
Starting from version 17.2.2 a new ability was added to define a listener to the redolog dropped packet and gain information on what data was dropped.
public interface IDroppedPacketListener {
void onPacketDropped(DroppedPacketInfo info);
}
com.gs.drop-packet.listener system property should be set with the class name that implements the above listener interface.
To verify that the listener was initiated successfully, look at the log for:
INFO [com.gigaspaces.replication.backlog.async] - <Your listener Class name> listener was initialized successfully, event will be passed
1. Listener must have default constructor.
2. The listener is called synchronously with the operation and should not contain time consuming operations, in case such needed it should run code in asynchronous manner.
3. In case the listener throw exception it will not be invoked next time, and the following error will be added to the log: onPacketDropped listener failed, listener will not be invoked next time
DroppedPacketInfo includes information about the lost packet:
|
Property |
Description |
|---|---|
|
packetKey |
key value |
|
targetMemberName |
name |
|
operationType |
eg. "WRITE", "UPDATE", "REMOVE_ENTRY" |
|
typeName |
object class name |
|
entryUid |
entry UID (may be null) |
|
limitReachedPolicy |
which limit policy was reached |
|
isTransient |
is related entry transient (should not be persisted to mirror) |
Example for logging listener implementation:
public class LoggingDroppedPacketListener implements IDroppedPacketListener {
private static final Logger logger =
Logger.getLogger(LoggingDroppedPacketListener.class.getName());
/** Required no-arg constructor for reflective instantiation by GigaSpaces. */
public LoggingDroppedPacketListener() {
}
@Override
public void onPacketDropped(DroppedPacketInfo info) {
if (logger.isLoggable(Level.WARNING))
logger.warning("Packet dropped from replication backlog: " + info);
}
}
In case of transaction there will be several lines with the same packet key, one per each operation. For example, writing 3 objects under transaction with the logging listener will result in the following output:
WARNING [com.gigaspaces.internal.cluster.node.impl.backlog.LoggingDroppedPacketListener] - Packet dropped from replication backlog: DroppedPacketInfo{packetKey=1, targetMemberName='DroppedPacketListenerTestSpace_container2:DroppedPacketListenerTestSpace', operationType='WRITE', typeName='com.gigaspaces.internal.cluster.node.impl.backlog.DroppedPacketListenerTest$TestEntry', entryUid='1824038474^85^500^0^0', policy=DROP_OLDEST, isTransient=false}
WARNING [com.gigaspaces.internal.cluster.node.impl.backlog.LoggingDroppedPacketListener] - Packet dropped from replication backlog: DroppedPacketInfo{packetKey=1, targetMemberName='DroppedPacketListenerTestSpace_container2:DroppedPacketListenerTestSpace', operationType='WRITE', typeName='com.gigaspaces.internal.cluster.node.impl.backlog.DroppedPacketListenerTest$TestEntry', entryUid='1824038474^85^501^0^0', policy=DROP_OLDEST, isTransient=false}
WARNING [com.gigaspaces.internal.cluster.node.impl.backlog.LoggingDroppedPacketListener] - Packet dropped from replication backlog: DroppedPacketInfo{packetKey=1, targetMemberName='DroppedPacketListenerTestSpace_container2:DroppedPacketListenerTestSpace', operationType='WRITE', typeName='com.gigaspaces.internal.cluster.node.impl.backlog.DroppedPacketListenerTest$TestEntry', entryUid='1824038474^85^502^0^0', policy=DROP_OLDEST, isTransient=false}
In-Memory Data Grid - achieve unparalleled speed, persistence, and accuracy.