Read Repair
Warning
|
Experimental API |
Warning
|
LimitationsA consistency check is incompatible with the following cache configurations:
|
Read Repair
refers to a technique of repairing inconsistencies between primary and backup copies of data during normal read operations. When a specific key (or keys) is read by a user operation, Ignite checks the values for the given key in all backup copies.
The Read Repair
mode is designed to maintain consistency. However, read operations become ~2 times more costly because backup copies are checked in addition to the primary copy. It is generally not advisable to use this mode all the time, but rather on a once-in-a-while basis.
To enable the Read Repair
mode, it is necessary to obtain an instance of the cache that enables Read Repair reads as follows:
IgniteCache<Object, Object> cache =
ignite.cache("my_cache").withReadRepair(ReadRepairStrategy.CHECK_ONLY);
Object value = cache.get(42);
Strategies
In case consistency violations were found, the values across the topology will be replaced by repaired values according to the chosen strategy:
Strategy | Description |
---|---|
|
Last write (the newest entry) wins.
|
|
Value from the primary node wins. |
|
The relative majority, any value found more times than any other wins. Works for an even number of copies (which is typical of Ignite) instead of an absolute majority. May cause IgniteException when it is unable to detect values found more times than any other.
When 4 copies (3 backups) are given, any value found two or more times, when others are found only once, is the winner. |
|
Inconsistent entries will be removed. |
|
Only check will be performed. |
Events
Сonsistency Violation Event will be recorded for each violation in case it’s configured as recordable. You may listen to this event to get notified about inconsistency issues.
Please, refer to the Working with Events section for the information on how to listen to events.
Transactional Caches
- Values will be repaired
-
-
automatically for transactions that have
TransactionConcurrency.OPTIMISTIC
concurrency mode orTransactionIsolation.READ_COMMITTED
isolation level, -
at commit() phase for transactions that have
TransactionConcurrency.PESSIMISTIC
concurrency mode and isolation level other thanTransactionIsolation.READ_COMMITTED
-
Warning
|
LimitationsThis proxy usage does not guarantee "all copies check" in case the value have been already cached inside the transaction. In case you don’t use a |
Atomic Caches
Values will be repaired automatically.
Warning
|
LimitationsDue to the nature of an atomic cache, false-positive results can be observed. For example, an attempt to check consistency under cache’s loading may lead to a consistency violation exception. By default, the implementation tries to check the given key three times. The number of attempts can be changed using |
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.