public static class TransactionsCleanupConfig.Builder extends Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
TransactionsCleanupConfig.Builder |
addCollection(TransactionKeyspace collection)
Adds a collection to the set of metadata collections that will be cleaned up automatically.
|
TransactionsCleanupConfig.Builder |
addCollections(Collection<TransactionKeyspace> collections)
Adds collections to the set of metadata collections that will be cleaned up automatically.
|
com.couchbase.client.core.transaction.config.CoreTransactionsCleanupConfig |
build() |
TransactionsCleanupConfig.Builder |
cleanupClientAttempts(boolean cleanupClientAttempts)
Controls where a background thread is created to cleanup any transaction attempts made by this client.
|
TransactionsCleanupConfig.Builder |
cleanupLostAttempts(boolean cleanupLostAttempts)
Controls where a background process is created to cleanup any 'lost' transaction attempts: that is, those for
which the regular cleanup process has failed.
|
TransactionsCleanupConfig.Builder |
cleanupWindow(Duration cleanupWindow)
Part of the lost attempts background cleanup process.
|
@Stability.Internal public com.couchbase.client.core.transaction.config.CoreTransactionsCleanupConfig build()
public TransactionsCleanupConfig.Builder cleanupClientAttempts(boolean cleanupClientAttempts)
This should be left at its default of true. Without this, this client's transactions will only be cleaned up by the lost attempts cleanup process, which is by necessity slower.
public TransactionsCleanupConfig.Builder cleanupLostAttempts(boolean cleanupLostAttempts)
This should be left at its default of true. Without at least one client performing this cleanup, 'lost' transactions will not be removed.
public TransactionsCleanupConfig.Builder cleanupWindow(Duration cleanupWindow)
This process is an implementation detail, but currently consists of polling multiple documents. The default setting of 60 seconds is tuned to reduce impact on the cluster. If the application would prefer to discover lost transactions more swiftly, but at the cost of more frequent polling, it can feel free to reduce this parameter, while monitoring resource usage.
The trade-off to appreciate is that if a document is in a transaction A, it is effectively locked from being updated by another transaction until transaction A has been completed - that is, committed or rolled back. In rare cases such as application crashes, the transaction will remain incomplete - that is, it will be lost - until the lost transactions process discovers it.
public TransactionsCleanupConfig.Builder addCollection(TransactionKeyspace collection)
This will also start cleanup immediately rather than on the first transaction (unless cleanup has been explicitly disabled.)
public TransactionsCleanupConfig.Builder addCollections(Collection<TransactionKeyspace> collections)
This will also start cleanup immediately rather than on the first transaction (unless cleanup has been explicitly disabled.)
Copyright © 2024 Couchbase, Inc.. All rights reserved.