Skip to content

Commit 6117c18

Browse files
authored
Bump Couchbase SDK to 3.4.0. (#1603)
Closes #1596.
1 parent 932901e commit 6117c18

File tree

4 files changed

+40
-9
lines changed

4 files changed

+40
-9
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
</parent>
1919

2020
<properties>
21-
<couchbase>3.3.4</couchbase>
22-
<couchbase.osgi>3.3.4</couchbase.osgi>
21+
<couchbase>3.4.0</couchbase>
22+
<couchbase.osgi>3.4.0</couchbase.osgi>
2323
<springdata.commons>3.0.0-SNAPSHOT</springdata.commons>
2424
<java-module-name>spring.data.couchbase</java-module-name>
2525
<hibernate.validator>7.0.1.Final</hibernate.validator>

src/main/java/org/springframework/data/couchbase/core/ReactiveInsertByIdOperationSupport.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.data.couchbase.core;
1717

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

2021
import reactor.core.publisher.Flux;
@@ -30,7 +31,12 @@
3031
import org.springframework.data.couchbase.core.support.PseudoArgs;
3132
import org.springframework.util.Assert;
3233

34+
import com.couchbase.client.core.cnc.CbTracing;
35+
import com.couchbase.client.core.cnc.RequestSpan;
36+
import com.couchbase.client.core.cnc.TracingIdentifiers;
3337
import com.couchbase.client.core.msg.kv.DurabilityLevel;
38+
import com.couchbase.client.core.transaction.CoreTransactionAttemptContext;
39+
import com.couchbase.client.core.transaction.support.SpanWrapper;
3440
import com.couchbase.client.java.kv.InsertOptions;
3541
import com.couchbase.client.java.kv.PersistTo;
3642
import com.couchbase.client.java.kv.ReplicateTo;
@@ -97,15 +103,21 @@ public Mono<T> one(T object) {
97103
.flatMap(converted -> TransactionalSupport.checkForTransactionInThreadLocalStorage().flatMap(ctxOpt -> {
98104
if (!ctxOpt.isPresent()) {
99105
return collection.reactive()
100-
.insert(converted.getId().toString(), converted.export(), buildOptions(pArgs.getOptions(), converted))
106+
.insert(converted.getId().toString(), converted.export(),
107+
buildOptions(pArgs.getOptions(), converted))
101108
.flatMap(result -> this.support.applyResult(object, converted, converted.getId(), result.cas(),
102109
null, null));
103110
} else {
104111
rejectInvalidTransactionalOptions();
105-
return ctxOpt.get().getCore()
112+
CoreTransactionAttemptContext internal = ctxOpt.get().getCore();
113+
RequestSpan span = CbTracing.newSpan(internal.core().context(), TRANSACTION_OP_INSERT,
114+
internal.span());
115+
span.attribute(TracingIdentifiers.ATTR_OPERATION, TRANSACTION_OP_INSERT);
116+
return internal
106117
.insert(makeCollectionIdentifier(collection.async()), converted.getId().toString(),
107118
template.getCouchbaseClientFactory().getCluster().environment().transcoder()
108-
.encode(converted.export()).encoded())
119+
.encode(converted.export()).encoded(),
120+
new SpanWrapper(span))
109121
.flatMap(result -> this.support.applyResult(object, converted, converted.getId(), result.cas(),
110122
null, null));
111123
}

src/main/java/org/springframework/data/couchbase/core/ReactiveRemoveByIdOperationSupport.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.data.couchbase.core;
1717

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

2021
import reactor.core.publisher.Flux;
@@ -29,9 +30,13 @@
2930
import org.springframework.data.couchbase.core.support.PseudoArgs;
3031
import org.springframework.util.Assert;
3132

33+
import com.couchbase.client.core.cnc.CbTracing;
34+
import com.couchbase.client.core.cnc.RequestSpan;
35+
import com.couchbase.client.core.cnc.TracingIdentifiers;
3236
import com.couchbase.client.core.msg.kv.DurabilityLevel;
3337
import com.couchbase.client.core.transaction.CoreTransactionAttemptContext;
3438
import com.couchbase.client.core.transaction.CoreTransactionGetResult;
39+
import com.couchbase.client.core.transaction.support.SpanWrapper;
3540
import com.couchbase.client.java.ReactiveCollection;
3641
import com.couchbase.client.java.kv.PersistTo;
3742
import com.couchbase.client.java.kv.RemoveOptions;
@@ -101,7 +106,8 @@ public Mono<RemoveResult> one(final Object id) {
101106

102107
return TransactionalSupport.checkForTransactionInThreadLocalStorage().flatMap(s -> {
103108
if (!s.isPresent()) {
104-
return rc.remove(id.toString(), buildRemoveOptions(pArgs.getOptions())).map(r -> RemoveResult.from(id.toString(), r));
109+
return rc.remove(id.toString(), buildRemoveOptions(pArgs.getOptions()))
110+
.map(r -> RemoveResult.from(id.toString(), r));
105111
} else {
106112
rejectInvalidTransactionalOptions();
107113

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

121130
}

src/main/java/org/springframework/data/couchbase/core/ReactiveReplaceByIdOperationSupport.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.springframework.data.couchbase.core;
1717

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

2021
import reactor.core.publisher.Flux;
@@ -30,10 +31,14 @@
3031
import org.springframework.data.couchbase.core.support.PseudoArgs;
3132
import org.springframework.util.Assert;
3233

34+
import com.couchbase.client.core.cnc.CbTracing;
35+
import com.couchbase.client.core.cnc.RequestSpan;
36+
import com.couchbase.client.core.cnc.TracingIdentifiers;
3337
import com.couchbase.client.core.io.CollectionIdentifier;
3438
import com.couchbase.client.core.msg.kv.DurabilityLevel;
3539
import com.couchbase.client.core.transaction.CoreTransactionAttemptContext;
3640
import com.couchbase.client.core.transaction.CoreTransactionGetResult;
41+
import com.couchbase.client.core.transaction.support.SpanWrapper;
3742
import com.couchbase.client.core.transaction.util.DebugUtil;
3843
import com.couchbase.client.java.kv.PersistTo;
3944
import com.couchbase.client.java.kv.ReplaceOptions;
@@ -124,9 +129,14 @@ public Mono<T> one(T object) {
124129
if (getResult.cas() != cas) {
125130
return Mono.error(TransactionalSupport.retryTransactionOnCasMismatch(ctx, getResult.cas(), cas));
126131
}
132+
CoreTransactionAttemptContext internal = ctxOpt.get().getCore();
133+
RequestSpan span = CbTracing.newSpan(internal.core().context(), TRANSACTION_OP_REPLACE,
134+
internal.span());
135+
span.attribute(TracingIdentifiers.ATTR_OPERATION, TRANSACTION_OP_REPLACE);
127136
return ctx.replace(getResult, template.getCouchbaseClientFactory().getCluster().environment()
128-
.transcoder().encode(converted.export()).encoded());
129-
}).flatMap(result -> support.applyResult(object, converted, converted.getId(), result.cas(), null, null));
137+
.transcoder().encode(converted.export()).encoded(), new SpanWrapper(span));
138+
}).flatMap(
139+
result -> support.applyResult(object, converted, converted.getId(), result.cas(), null, null));
130140
}
131141
})).onErrorMap(throwable -> {
132142
if (throwable instanceof RuntimeException) {

0 commit comments

Comments
 (0)