Skip to content

Commit dca0278

Browse files
authored
Ensure TimeoutContext is present for a subsequent commit operation. (#1376)
JAVA-5425
1 parent b02a5f9 commit dca0278

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

driver-sync/src/main/com/mongodb/client/internal/ClientSessionImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ private void commitTransaction(final boolean resetTimeout) {
203203
.execute(new CommitTransactionOperation(writeConcern,
204204
transactionState == TransactionState.COMMITTED)
205205
.recoveryToken(getRecoveryToken()), readConcern, this);
206-
setTimeoutContext(null);
207206
}
208207
} catch (MongoException e) {
209208
clearTransactionContextOnError(e);

driver-sync/src/test/functional/com/mongodb/client/AbstractClientSideOperationsTimeoutProseTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
import org.junit.jupiter.api.AfterAll;
5757
import org.junit.jupiter.api.AfterEach;
5858
import org.junit.jupiter.api.BeforeEach;
59-
import org.junit.jupiter.api.Disabled;
6059
import org.junit.jupiter.api.DisplayName;
6160
import org.junit.jupiter.api.Named;
6261
import org.junit.jupiter.api.Tag;
@@ -713,7 +712,6 @@ public void test10CustomTestWithTransactionUsesASingleTimeoutWithLock() {
713712
@Tag("setsFailPoint")
714713
@Test
715714
@DisplayName("Should ignore wTimeoutMS of WriteConcern to initial and subsequent commitTransaction operations")
716-
@Disabled //TODO JAVA-5425
717715
public void shouldIgnoreWtimeoutMsOfWriteConcernToInitialAndSubsequentCommitTransactionOperations() {
718716
assumeTrue(serverVersionAtLeast(4, 4));
719717
assumeFalse(isStandalone());
@@ -738,7 +736,14 @@ public void shouldIgnoreWtimeoutMsOfWriteConcernToInitialAndSubsequentCommitTran
738736
}
739737
List<CommandStartedEvent> commandStartedEvents = commandListener.getCommandStartedEvents("commitTransaction");
740738
assertEquals(2, commandStartedEvents.size());
741-
commandStartedEvents.forEach(e -> assertFalse(e.getCommand().containsKey("writeConcern")));
739+
740+
commandStartedEvents.forEach(e -> {
741+
BsonDocument command = e.getCommand();
742+
if (command.containsKey("writeConcern")) {
743+
BsonDocument writeConcern = command.getDocument("writeConcern");
744+
assertFalse(writeConcern.isEmpty());
745+
assertFalse(writeConcern.containsKey("wTimeoutMS"));
746+
}});
742747
}
743748

744749
private static Stream<Arguments> test8ServerSelectionArguments() {

driver-sync/src/test/functional/com/mongodb/client/ClientSideOperationTimeoutTest.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ public static void checkSkipCSOTTest(final String fileDescription, final String
9494
&& testDescription.equals("timeoutMS can be overridden for close"));
9595

9696
assumeFalse("TODO (CSOT) - JAVA-5259 No client.withTimeout", testDescription.endsWith("on client"));
97-
98-
assumeFalse("TODO (CSOT) - JAVA-4052", fileDescription.startsWith("timeoutMS behaves correctly for retryable operations"));
99-
assumeFalse("TODO (CSOT) - JAVA-4052", fileDescription.startsWith("legacy timeouts behave correctly for retryable operations"));
100-
101-
assumeFalse("TODO (CSOT) - JAVA-4062", testDescription.contains("wTimeoutMS is ignored")
102-
|| testDescription.contains("ignores wTimeoutMS"));
10397
}
10498

10599
private static final List<String> RACY_GET_MORE_TESTS = asList(

0 commit comments

Comments
 (0)