Using Java Transactions 1.1.3 created as:
Transactions.create(
javaCluster.get,
TransactionConfigBuilder.create()
.expirationTime(
Duration.ofSeconds(hubConfiguration.get[duration.Duration](
"hub.storage.couchbase.transactions.expiration-time"
).toSeconds)
)
.keyValueTimeout(
Duration.ofSeconds(hubConfiguration.get[duration.Duration](
"hub.storage.couchbase.transactions.key-value-timeout"
).toSeconds)
).build()
)
Using the transaction context as follows:
transactionContext.insert(
javaConstraintCollection,
core.storage.Storage.constraintPrefix + constraintKey,
java.json.JsonObject.create()
.put("type", "constraint")
.put("for", entityCanonicalName)
)
works only if the javaConstraintCollection
equals to javaBucket.defaultCollection()
.
If the collection is a specific collection, like one from the below list:
transaction fails as follows:
2020-11-25 10:20:34 WARN tracing:513 - [com.couchbase.tracing][OverThresholdRequestsRecordedEvent][10s] Requests over Threshold found: [{"top":[{"operation_name":"SubdocMutateRequest","last_local_id":"24677AE500000002/00000000E56F1092","encode_us":189200,"last_local_address":"192.168.255.6:61671","last_remote_address":"4.couchbase.dev.alpha:11210","last_operation_id":"0x53","total_us":20002409}],"service":"kv","count":1}]
com.couchbase.transactions.error.internal.AttemptExpired: Attempt has expired in stage createdStagedInsert
com.couchbase.transactions.error.internal.AttemptExpired: com.couchbase.transactions.error.internal.AttemptExpired: Attempt has expired in stage createdStagedInsert
at com.couchbase.transactions.AttemptContextReactive.setExpiryOvertimeModeAndFail(AttemptContextReactive.java:2446)
at com.couchbase.transactions.AttemptContextReactive.lambda$null$87(AttemptContextReactive.java:1650)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:88)
at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onError(FluxMapFuseable.java:134)
at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onError(FluxPeekFuseable.java:227)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:165)
at reactor.core.publisher.Operators$MonoSubscriber.onError(Operators.java:1829)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreInner.onError(MonoIgnoreThen.java:235)
at reactor.core.publisher.Operators.error(Operators.java:196)
at reactor.core.publisher.MonoError.subscribe(MonoError.java:52)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.Mono.subscribe(Mono.java:4213)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:172)
at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:56)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.drain(MonoIgnoreThen.java:153)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.ignoreDone(MonoIgnoreThen.java:190)
at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreInner.onComplete(MonoIgnoreThen.java:240)
at reactor.core.publisher.MonoDelay$MonoDelayRunnable.run(MonoDelay.java:118)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.couchbase.transactions.error.internal.AttemptExpired: Attempt has expired in stage createdStagedInsert
at com.couchbase.transactions.AttemptContextReactive.errorIfExpiredAndNotInExpiryOvertimeMode(AttemptContextReactive.java:477)
at com.couchbase.transactions.AttemptContextReactive.lambda$null$83(AttemptContextReactive.java:1590)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)
... 16 more
Other K/V operations on the non-default collections work fine.
The user accessing the server is Admin with full access.