Skip to content

Commit 9f757fb

Browse files
committed
JAVA-2647: Remove initialClusterTime and initialOperationTime properties from ClientSessionOptions
1 parent 2545049 commit 9f757fb

File tree

4 files changed

+2
-71
lines changed

4 files changed

+2
-71
lines changed

driver/src/main/com/mongodb/ClientSessionOptions.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
import com.mongodb.annotations.Immutable;
2121
import com.mongodb.annotations.NotThreadSafe;
22-
import org.bson.BsonDocument;
23-
import org.bson.BsonTimestamp;
2422

2523
/**
2624
* The options to apply to a {@code ClientSession}.
@@ -34,8 +32,6 @@
3432
public final class ClientSessionOptions {
3533

3634
private final Boolean causallyConsistent;
37-
private final BsonDocument initialClusterTime;
38-
private final BsonTimestamp initialOperationTime;
3935

4036
/**
4137
* Whether operations using the session should causally consistent with each other.
@@ -47,23 +43,6 @@ public Boolean isCausallyConsistent() {
4743
return causallyConsistent;
4844
}
4945

50-
/**
51-
* Gets the initial cluster time to apply to the client session
52-
*
53-
* @return the initial cluster time, which may be null
54-
*/
55-
public BsonDocument getInitialClusterTime() {
56-
return initialClusterTime;
57-
}
58-
59-
/**
60-
* Gets the initial operation time to apply to the client session
61-
* @return the initial operation time, which may be null
62-
*/
63-
public BsonTimestamp getInitialOperationTime() {
64-
return initialOperationTime;
65-
}
66-
6746
/**
6847
* Gets an instance of a builder
6948
*
@@ -79,8 +58,6 @@ public static Builder builder() {
7958
@NotThreadSafe
8059
public static final class Builder {
8160
private Boolean causallyConsistent;
82-
private BsonDocument initialClusterTime;
83-
private BsonTimestamp initialOperationTime;
8461

8562
/**
8663
* Sets whether operations using the session should causally consistent with each other.
@@ -93,27 +70,6 @@ public Builder causallyConsistent(final boolean causallyConsistent) {
9370
return this;
9471
}
9572

96-
/**
97-
* Sets the initial cluster time to apply to the client session
98-
*
99-
* @param initialClusterTime the initial cluster time, which may be null
100-
* @return this
101-
*/
102-
public Builder initialClusterTime(final BsonDocument initialClusterTime) {
103-
this.initialClusterTime = initialClusterTime;
104-
return this;
105-
}
106-
107-
/**
108-
* Gets the initial operation time to apply to the client session
109-
*
110-
* @param initialOperationTime the initial operation time, which may be null
111-
* @return this
112-
*/
113-
public Builder initialOperationTime(final BsonTimestamp initialOperationTime) {
114-
this.initialOperationTime = initialOperationTime;
115-
return this;
116-
}
11773
/**
11874
* Build the session options instance.
11975
*
@@ -129,7 +85,5 @@ private Builder() {
12985

13086
private ClientSessionOptions(final Builder builder) {
13187
this.causallyConsistent = builder.causallyConsistent;
132-
this.initialClusterTime = builder.initialClusterTime;
133-
this.initialOperationTime = builder.initialOperationTime;
13488
}
13589
}

driver/src/main/com/mongodb/Mongo.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,6 @@ static class ClientSessionImpl implements ClientSession {
874874
this.mongo = mongo;
875875
this.serverSession = mongo.serverSessionPool.get();
876876
this.options = options;
877-
clusterTime = options.getInitialClusterTime();
878-
operationTime = options.getInitialOperationTime();
879877
closed = false;
880878
}
881879

driver/src/test/functional/com/mongodb/MongoClientSessionSpecification.groovy

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,22 +197,14 @@ class MongoClientSessionSpecification extends FunctionalSpecification {
197197
when:
198198
def clientSession = Fixture.getMongoClient().startSession(ClientSessionOptions.builder()
199199
.causallyConsistent(causallyConsistent)
200-
.initialClusterTime(initialClusterTime)
201-
.initialOperationTime(initialOperationTime)
202200
.build())
203201

204202
then:
205203
clientSession != null
206204
clientSession.isCausallyConsistent() == causallyConsistent
207-
clientSession.getClusterTime() == initialClusterTime
208-
clientSession.getOperationTime() == initialOperationTime
209205

210206
where:
211-
[causallyConsistent, initialClusterTime, initialOperationTime] << [
212-
[true, false],
213-
[null, new BsonDocument('x', new BsonInt32(1))],
214-
[null, new BsonTimestamp(42, 1)]
215-
].combinations()
207+
causallyConsistent << [true, false]
216208
}
217209

218210
@IgnoreIf({ !serverVersionAtLeast(3, 5) })

driver/src/test/unit/com/mongodb/ClientSessionOptionsSpecification.groovy

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
package com.mongodb
1818

19-
import org.bson.BsonDocument
20-
import org.bson.BsonInt32
21-
import org.bson.BsonTimestamp
2219
import spock.lang.Specification
2320

2421
class ClientSessionOptionsSpecification extends Specification {
@@ -29,28 +26,18 @@ class ClientSessionOptionsSpecification extends Specification {
2926

3027
then:
3128
options.isCausallyConsistent() == null
32-
options.getInitialClusterTime() == null
33-
options.getInitialOperationTime() == null
3429
}
3530

3631
def 'should apply options set in builder'() {
3732
when:
3833
def options = ClientSessionOptions.builder()
3934
.causallyConsistent(causallyConsistent)
40-
.initialClusterTime(initialClusterTime)
41-
.initialOperationTime(initialOperationTime)
4235
.build()
4336

4437
then:
4538
options.isCausallyConsistent() == causallyConsistent
46-
options.getInitialClusterTime() == initialClusterTime
47-
options.getInitialOperationTime() == initialOperationTime
4839

4940
where:
50-
[causallyConsistent, initialClusterTime, initialOperationTime] << [
51-
[true, false],
52-
[null, new BsonDocument('x', new BsonInt32(1))],
53-
[null, new BsonTimestamp(42, 1)]
54-
].combinations()
41+
causallyConsistent << [true, false]
5542
}
5643
}

0 commit comments

Comments
 (0)