Skip to content

Bump Couchbase SDK to 3.4.0. #1603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</parent>

<properties>
<couchbase>3.3.4</couchbase>
<couchbase.osgi>3.3.4</couchbase.osgi>
<couchbase>3.4.0</couchbase>
<couchbase.osgi>3.4.0</couchbase.osgi>
<springdata.commons>3.0.0-SNAPSHOT</springdata.commons>
<java-module-name>spring.data.couchbase</java-module-name>
<hibernate.validator>7.0.1.Final</hibernate.validator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.couchbase.core;

import static com.couchbase.client.core.cnc.TracingIdentifiers.TRANSACTION_OP_INSERT;
import static com.couchbase.client.java.transactions.internal.ConverterUtil.makeCollectionIdentifier;

import reactor.core.publisher.Flux;
Expand All @@ -30,7 +31,12 @@
import org.springframework.data.couchbase.core.support.PseudoArgs;
import org.springframework.util.Assert;

import com.couchbase.client.core.cnc.CbTracing;
import com.couchbase.client.core.cnc.RequestSpan;
import com.couchbase.client.core.cnc.TracingIdentifiers;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
import com.couchbase.client.core.transaction.CoreTransactionAttemptContext;
import com.couchbase.client.core.transaction.support.SpanWrapper;
import com.couchbase.client.java.kv.InsertOptions;
import com.couchbase.client.java.kv.PersistTo;
import com.couchbase.client.java.kv.ReplicateTo;
Expand Down Expand Up @@ -97,15 +103,21 @@ public Mono<T> one(T object) {
.flatMap(converted -> TransactionalSupport.checkForTransactionInThreadLocalStorage().flatMap(ctxOpt -> {
if (!ctxOpt.isPresent()) {
return collection.reactive()
.insert(converted.getId().toString(), converted.export(), buildOptions(pArgs.getOptions(), converted))
.insert(converted.getId().toString(), converted.export(),
buildOptions(pArgs.getOptions(), converted))
.flatMap(result -> this.support.applyResult(object, converted, converted.getId(), result.cas(),
null, null));
} else {
rejectInvalidTransactionalOptions();
return ctxOpt.get().getCore()
CoreTransactionAttemptContext internal = ctxOpt.get().getCore();
RequestSpan span = CbTracing.newSpan(internal.core().context(), TRANSACTION_OP_INSERT,
internal.span());
span.attribute(TracingIdentifiers.ATTR_OPERATION, TRANSACTION_OP_INSERT);
return internal
.insert(makeCollectionIdentifier(collection.async()), converted.getId().toString(),
template.getCouchbaseClientFactory().getCluster().environment().transcoder()
.encode(converted.export()).encoded())
.encode(converted.export()).encoded(),
new SpanWrapper(span))
.flatMap(result -> this.support.applyResult(object, converted, converted.getId(), result.cas(),
null, null));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.couchbase.core;

import static com.couchbase.client.core.cnc.TracingIdentifiers.TRANSACTION_OP_REMOVE;
import static com.couchbase.client.java.transactions.internal.ConverterUtil.makeCollectionIdentifier;

import reactor.core.publisher.Flux;
Expand All @@ -29,9 +30,13 @@
import org.springframework.data.couchbase.core.support.PseudoArgs;
import org.springframework.util.Assert;

import com.couchbase.client.core.cnc.CbTracing;
import com.couchbase.client.core.cnc.RequestSpan;
import com.couchbase.client.core.cnc.TracingIdentifiers;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
import com.couchbase.client.core.transaction.CoreTransactionAttemptContext;
import com.couchbase.client.core.transaction.CoreTransactionGetResult;
import com.couchbase.client.core.transaction.support.SpanWrapper;
import com.couchbase.client.java.ReactiveCollection;
import com.couchbase.client.java.kv.PersistTo;
import com.couchbase.client.java.kv.RemoveOptions;
Expand Down Expand Up @@ -101,7 +106,8 @@ public Mono<RemoveResult> one(final Object id) {

return TransactionalSupport.checkForTransactionInThreadLocalStorage().flatMap(s -> {
if (!s.isPresent()) {
return rc.remove(id.toString(), buildRemoveOptions(pArgs.getOptions())).map(r -> RemoveResult.from(id.toString(), r));
return rc.remove(id.toString(), buildRemoveOptions(pArgs.getOptions()))
.map(r -> RemoveResult.from(id.toString(), r));
} else {
rejectInvalidTransactionalOptions();

Expand All @@ -115,7 +121,10 @@ public Mono<RemoveResult> one(final Object id) {
if (getResult.cas() != cas) {
return Mono.error(TransactionalSupport.retryTransactionOnCasMismatch(ctx, getResult.cas(), cas));
}
return ctx.remove(getResult).map(r -> new RemoveResult(id.toString(), 0, null));
CoreTransactionAttemptContext internal = ctx;
RequestSpan span = CbTracing.newSpan(internal.core().context(), TRANSACTION_OP_REMOVE, internal.span());
span.attribute(TracingIdentifiers.ATTR_OPERATION, TRANSACTION_OP_REMOVE);
return ctx.remove(getResult, new SpanWrapper(span)).map(r -> new RemoveResult(id.toString(), 0, null));
});

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.couchbase.core;

import static com.couchbase.client.core.cnc.TracingIdentifiers.TRANSACTION_OP_REPLACE;
import static com.couchbase.client.java.transactions.internal.ConverterUtil.makeCollectionIdentifier;

import reactor.core.publisher.Flux;
Expand All @@ -30,10 +31,14 @@
import org.springframework.data.couchbase.core.support.PseudoArgs;
import org.springframework.util.Assert;

import com.couchbase.client.core.cnc.CbTracing;
import com.couchbase.client.core.cnc.RequestSpan;
import com.couchbase.client.core.cnc.TracingIdentifiers;
import com.couchbase.client.core.io.CollectionIdentifier;
import com.couchbase.client.core.msg.kv.DurabilityLevel;
import com.couchbase.client.core.transaction.CoreTransactionAttemptContext;
import com.couchbase.client.core.transaction.CoreTransactionGetResult;
import com.couchbase.client.core.transaction.support.SpanWrapper;
import com.couchbase.client.core.transaction.util.DebugUtil;
import com.couchbase.client.java.kv.PersistTo;
import com.couchbase.client.java.kv.ReplaceOptions;
Expand Down Expand Up @@ -124,9 +129,14 @@ public Mono<T> one(T object) {
if (getResult.cas() != cas) {
return Mono.error(TransactionalSupport.retryTransactionOnCasMismatch(ctx, getResult.cas(), cas));
}
CoreTransactionAttemptContext internal = ctxOpt.get().getCore();
RequestSpan span = CbTracing.newSpan(internal.core().context(), TRANSACTION_OP_REPLACE,
internal.span());
span.attribute(TracingIdentifiers.ATTR_OPERATION, TRANSACTION_OP_REPLACE);
return ctx.replace(getResult, template.getCouchbaseClientFactory().getCluster().environment()
.transcoder().encode(converted.export()).encoded());
}).flatMap(result -> support.applyResult(object, converted, converted.getId(), result.cas(), null, null));
.transcoder().encode(converted.export()).encoded(), new SpanWrapper(span));
}).flatMap(
result -> support.applyResult(object, converted, converted.getId(), result.cas(), null, null));
}
})).onErrorMap(throwable -> {
if (throwable instanceof RuntimeException) {
Expand Down