Skip to content

Commit 1914028

Browse files
committed
JAVA-1178: Added a test for wtimeout check in GLE response, and removed some code that is dead now that jnote/wnote are no longer checked
1 parent 201ae41 commit 1914028

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/main/com/mongodb/DBCollectionImpl.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,6 @@ private BulkWriteResult executeWriteProtocol() {
860860
WriteResult writeResult = executeWriteProtocol(i);
861861
if (writeConcern.callGetLastError()) {
862862
bulkWriteBatchCombiner.addResult(getResult(writeResult), indexMap);
863-
// When a journaled write is requested but journaling is disabled, it's not thrown as an exception.
864-
if (isWriteConcernError(writeResult.getLastError())) {
865-
bulkWriteBatchCombiner.addWriteConcernErrorResult(getWriteConcernError(writeResult.getLastError()));
866-
}
867863
}
868864
} catch (WriteConcernException writeException) {
869865
if (isWriteConcernError(writeException.getCommandResult())) {

src/test/com/mongodb/BulkWriteOperationSpecification.groovy

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,23 @@ class BulkWriteOperationSpecification extends FunctionalSpecification {
634634
ordered << [true, false]
635635
}
636636

637+
def 'when a replication timeout occurs, an exception is thrown'() {
638+
assumeTrue(isReplicaSet())
639+
640+
given:
641+
def operation = collection.initializeUnorderedBulkOperation()
642+
operation.insert(new BasicDBObject('_id', 1))
643+
644+
when:
645+
operation.execute(new WriteConcern(2, 1))
646+
647+
then:
648+
thrown(BulkWriteException)
649+
650+
where:
651+
ordered << [true, false]
652+
}
653+
637654
def 'when j write concern is used on a server without journaling or write commands, BulkWriteException is thrown'() {
638655
assumeTrue(!isSharded() && isServerStartedWithJournalingDisabled() && !serverIsAtLeastVersion(2.6))
639656

0 commit comments

Comments
 (0)