Class LostCleanupDistributed
- java.lang.Object
-
- com.couchbase.transactions.cleanup.LostCleanupDistributed
-
@Internal public class LostCleanupDistributed extends java.lang.Object
Runs the algorithm to find 'lost' transactions, distributing the work between clients.The user specifies that lost transactions should be found inside a certain cleanup window of X seconds.
As this algo is distributed and tries to require minimal co-operation between clients (they simply read and write a Client Record doc periodically, there are flaws including:
Two clients can read the same client record at the same time and miss each other's updates A client can read the record just before a new client removes itself
The idea is that these conflicts will sort themselves out on the next iteration, and that in the vast majority of cases each ATR will be checked in X seconds.
-
-
Constructor Summary
Constructors Constructor Description LostCleanupDistributed(MergedTransactionConfig config, ClusterData clusterData, java.util.function.Supplier<Cleaner> cleanerSupplier)
LostCleanupDistributed(TransactionConfig config, ClusterData clusterData, java.util.function.Supplier<Cleaner> cleanerSupplier)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.lang.String>
atrsToHandle(int indexOfThisClient, int numActiveClients, int numAtrs)
java.lang.String
clientUuid()
reactor.core.publisher.Flux<TransactionCleanupAttempt>
handleATRCleanup(java.lang.String bp, com.couchbase.client.java.ReactiveCollection atrCollection, java.lang.String atrId, ATRStats stats, java.time.Duration safetyMargin)
reactor.core.publisher.Flux<TransactionCleanupAttempt>
handleATRCleanup(java.lang.String bp, com.couchbase.client.java.ReactiveCollection atrCollection, java.lang.String atrId, ATRStats stats, java.time.Duration safetyMargin, SpanWrapper pspan)
Looks at an ATR, finds any expired entries, and cleans them up.void
stop()
void
stopThreads()
-
-
-
Constructor Detail
-
LostCleanupDistributed
public LostCleanupDistributed(TransactionConfig config, ClusterData clusterData, java.util.function.Supplier<Cleaner> cleanerSupplier)
-
LostCleanupDistributed
public LostCleanupDistributed(MergedTransactionConfig config, ClusterData clusterData, java.util.function.Supplier<Cleaner> cleanerSupplier)
-
-
Method Detail
-
clientUuid
public java.lang.String clientUuid()
-
stop
public void stop()
-
stopThreads
public void stopThreads()
-
atrsToHandle
public static java.util.List<java.lang.String> atrsToHandle(int indexOfThisClient, int numActiveClients, int numAtrs)
-
handleATRCleanup
public reactor.core.publisher.Flux<TransactionCleanupAttempt> handleATRCleanup(java.lang.String bp, com.couchbase.client.java.ReactiveCollection atrCollection, java.lang.String atrId, ATRStats stats, java.time.Duration safetyMargin)
-
handleATRCleanup
public reactor.core.publisher.Flux<TransactionCleanupAttempt> handleATRCleanup(java.lang.String bp, com.couchbase.client.java.ReactiveCollection atrCollection, java.lang.String atrId, ATRStats stats, java.time.Duration safetyMargin, SpanWrapper pspan)
Looks at an ATR, finds any expired entries, and cleans them up. Called only from lost.
-
-