summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/libs/retryable_writes_util.js12
-rw-r--r--jstests/multiVersion/shell_retryable_writes_downgrade.js4
-rw-r--r--jstests/noPassthrough/auto_retry_on_network_error.js4
-rw-r--r--jstests/noPassthrough/retryable_writes_standalone_api.js4
-rw-r--r--jstests/noPassthrough/shell_can_retry_writes.js4
-rw-r--r--jstests/noPassthrough/transaction_reaper.js4
-rw-r--r--jstests/replsets/retryable_writes_direct_write_to_config_transactions.js4
-rw-r--r--jstests/replsets/retryable_writes_failover.js4
-rw-r--r--jstests/replsets/rollback_transaction_table.js4
-rw-r--r--jstests/replsets/transaction_table_oplog_replay.js4
-rw-r--r--jstests/sharding/move_chunk_find_and_modify_with_write_retryability.js4
-rw-r--r--jstests/sharding/move_chunk_insert_with_write_retryability.js4
-rw-r--r--jstests/sharding/move_chunk_remove_with_write_retryability.js4
-rw-r--r--jstests/sharding/move_chunk_update_with_write_retryability.js4
-rw-r--r--jstests/sharding/retryable_writes.js4
-rw-r--r--jstests/sharding/session_info_in_oplog.js4
-rw-r--r--jstests/sharding/write_transactions_during_migration.js4
17 files changed, 59 insertions, 17 deletions
diff --git a/jstests/libs/retryable_writes_util.js b/jstests/libs/retryable_writes_util.js
index ba3cd37afe0..d545f4e9ed8 100644
--- a/jstests/libs/retryable_writes_util.js
+++ b/jstests/libs/retryable_writes_util.js
@@ -12,5 +12,15 @@ var RetryableWritesUtil = (function() {
return retryableWriteCommands.has(cmdName);
}
- return {isRetryableWriteCmdName: isRetryableWriteCmdName};
+ const kStorageEnginesWithoutDocumentLocking = new Set(["ephemeralForTest", "mmapv1"]);
+
+ /**
+ * Returns true if the given storage engine supports retryable writes (i.e. supports
+ * document-level locking).
+ */
+ function storageEngineSupportsRetryableWrites(storageEngineName) {
+ return !kStorageEnginesWithoutDocumentLocking.has(storageEngineName);
+ }
+
+ return {isRetryableWriteCmdName, storageEngineSupportsRetryableWrites};
})();
diff --git a/jstests/multiVersion/shell_retryable_writes_downgrade.js b/jstests/multiVersion/shell_retryable_writes_downgrade.js
index f4fac6ced7e..52e8470295a 100644
--- a/jstests/multiVersion/shell_retryable_writes_downgrade.js
+++ b/jstests/multiVersion/shell_retryable_writes_downgrade.js
@@ -5,7 +5,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/noPassthrough/auto_retry_on_network_error.js b/jstests/noPassthrough/auto_retry_on_network_error.js
index 0a0a8b09561..5b59d4aa50a 100644
--- a/jstests/noPassthrough/auto_retry_on_network_error.js
+++ b/jstests/noPassthrough/auto_retry_on_network_error.js
@@ -5,7 +5,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/noPassthrough/retryable_writes_standalone_api.js b/jstests/noPassthrough/retryable_writes_standalone_api.js
index 6dc6f6cd7fa..ff091624358 100644
--- a/jstests/noPassthrough/retryable_writes_standalone_api.js
+++ b/jstests/noPassthrough/retryable_writes_standalone_api.js
@@ -4,7 +4,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/noPassthrough/shell_can_retry_writes.js b/jstests/noPassthrough/shell_can_retry_writes.js
index b8eaefb7e54..fcf41f33198 100644
--- a/jstests/noPassthrough/shell_can_retry_writes.js
+++ b/jstests/noPassthrough/shell_can_retry_writes.js
@@ -5,7 +5,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/noPassthrough/transaction_reaper.js b/jstests/noPassthrough/transaction_reaper.js
index 5146de52234..92b75f2cde6 100644
--- a/jstests/noPassthrough/transaction_reaper.js
+++ b/jstests/noPassthrough/transaction_reaper.js
@@ -1,7 +1,9 @@
(function() {
'use strict';
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/replsets/retryable_writes_direct_write_to_config_transactions.js b/jstests/replsets/retryable_writes_direct_write_to_config_transactions.js
index 9333344d272..4326437b50b 100644
--- a/jstests/replsets/retryable_writes_direct_write_to_config_transactions.js
+++ b/jstests/replsets/retryable_writes_direct_write_to_config_transactions.js
@@ -2,7 +2,9 @@
(function() {
'use strict';
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/replsets/retryable_writes_failover.js b/jstests/replsets/retryable_writes_failover.js
index cccd2d64f24..0c254de15dc 100644
--- a/jstests/replsets/retryable_writes_failover.js
+++ b/jstests/replsets/retryable_writes_failover.js
@@ -5,7 +5,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/replsets/rollback_transaction_table.js b/jstests/replsets/rollback_transaction_table.js
index d48a4820713..6c32be314e8 100644
--- a/jstests/replsets/rollback_transaction_table.js
+++ b/jstests/replsets/rollback_transaction_table.js
@@ -20,7 +20,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/replsets/transaction_table_oplog_replay.js b/jstests/replsets/transaction_table_oplog_replay.js
index 12a93013c88..7ffb1543ce1 100644
--- a/jstests/replsets/transaction_table_oplog_replay.js
+++ b/jstests/replsets/transaction_table_oplog_replay.js
@@ -4,7 +4,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/sharding/move_chunk_find_and_modify_with_write_retryability.js b/jstests/sharding/move_chunk_find_and_modify_with_write_retryability.js
index 9541674d452..55b8ccf3540 100644
--- a/jstests/sharding/move_chunk_find_and_modify_with_write_retryability.js
+++ b/jstests/sharding/move_chunk_find_and_modify_with_write_retryability.js
@@ -3,7 +3,9 @@ load("jstests/sharding/move_chunk_with_session_helper.js");
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/sharding/move_chunk_insert_with_write_retryability.js b/jstests/sharding/move_chunk_insert_with_write_retryability.js
index 144973169f7..d0cbd8adc1d 100644
--- a/jstests/sharding/move_chunk_insert_with_write_retryability.js
+++ b/jstests/sharding/move_chunk_insert_with_write_retryability.js
@@ -3,7 +3,9 @@ load("jstests/sharding/move_chunk_with_session_helper.js");
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/sharding/move_chunk_remove_with_write_retryability.js b/jstests/sharding/move_chunk_remove_with_write_retryability.js
index 0edd77e42ec..d47b44b5ca4 100644
--- a/jstests/sharding/move_chunk_remove_with_write_retryability.js
+++ b/jstests/sharding/move_chunk_remove_with_write_retryability.js
@@ -3,7 +3,9 @@ load("jstests/sharding/move_chunk_with_session_helper.js");
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/sharding/move_chunk_update_with_write_retryability.js b/jstests/sharding/move_chunk_update_with_write_retryability.js
index ae3eab575fc..779619a1fa8 100644
--- a/jstests/sharding/move_chunk_update_with_write_retryability.js
+++ b/jstests/sharding/move_chunk_update_with_write_retryability.js
@@ -3,7 +3,9 @@ load("jstests/sharding/move_chunk_with_session_helper.js");
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/sharding/retryable_writes.js b/jstests/sharding/retryable_writes.js
index c8a76d3dce3..09d53276738 100644
--- a/jstests/sharding/retryable_writes.js
+++ b/jstests/sharding/retryable_writes.js
@@ -5,7 +5,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/sharding/session_info_in_oplog.js b/jstests/sharding/session_info_in_oplog.js
index a25bc02d598..2e979acc6b8 100644
--- a/jstests/sharding/session_info_in_oplog.js
+++ b/jstests/sharding/session_info_in_oplog.js
@@ -6,7 +6,9 @@
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}
diff --git a/jstests/sharding/write_transactions_during_migration.js b/jstests/sharding/write_transactions_during_migration.js
index 5e988328990..18f746bcf38 100644
--- a/jstests/sharding/write_transactions_during_migration.js
+++ b/jstests/sharding/write_transactions_during_migration.js
@@ -15,7 +15,9 @@ load('./jstests/libs/chunk_manipulation_util.js');
(function() {
"use strict";
- if (jsTest.options().storageEngine === "mmapv1") {
+ load("jstests/libs/retryable_writes_util.js");
+
+ if (!RetryableWritesUtil.storageEngineSupportsRetryableWrites(jsTest.options().storageEngine)) {
jsTestLog("Retryable writes are not supported, skipping test");
return;
}