diff --git a/api/leveldb/leveldb_wt.cc b/api/leveldb/leveldb_wt.cc
index 6425a5a8dfd..8fc7d1ca092 100644
--- a/api/leveldb/leveldb_wt.cc
+++ b/api/leveldb/leveldb_wt.cc
@@ -93,8 +93,6 @@ Status WiredTigerErrorToStatus(int wiredTigerError, const char *msg) {
return Status::NotFound(Slice(msg));
else if (wiredTigerError == WT_ERROR || wiredTigerError == WT_PANIC)
return Status::Corruption(Slice(msg));
- else if (wiredTigerError == WT_DEADLOCK)
- return Status::IOError("DEADLOCK"); // TODO: Is this the best translation?
else if (wiredTigerError == ENOTSUP)
return Status::NotSupported(Slice(msg));
else if (wiredTigerError == EINVAL)
@@ -103,6 +101,8 @@ Status WiredTigerErrorToStatus(int wiredTigerError, const char *msg) {
wiredTigerError == EIO || wiredTigerError == EBADF ||
wiredTigerError == EEXIST || wiredTigerError == ENOSPC)
return Status::IOError(Slice(msg));
+ else if (wiredTigerError == WT_ROLLBACK)
+ return Status::IOError("ROLLBACK"); // TODO: Is this the best translation?
else
return Status::Corruption(Slice(msg));
}
@@ -395,7 +395,7 @@ DbImpl::Write(const WriteOptions& options, WriteBatch* updates)
throw;
}
#endif
- if (!status.ok() || (ret = handler.GetWiredTigerStatus()) != WT_DEADLOCK)
+ if (!status.ok() || (ret = handler.GetWiredTigerStatus()) != WT_ROLLBACK)
break;
// Roll back the transaction on deadlock so we can try again
if (need_txn && (ret = session->rollback_transaction(session, NULL)) != 0) {
diff --git a/dist/api_data.py b/dist/api_data.py
index d133c8a082c..4cfa126f2fa 100644
--- a/dist/api_data.py
+++ b/dist/api_data.py
@@ -8,11 +8,6 @@ class Error:
self.flags = flags
errors = [
- Error('WT_DEADLOCK', 'conflict between concurrent operations', '''
- This error is generated when an operation cannot be completed
- due to a conflict with concurrent operations. The operation
- may be retried; if a transaction is in progress, it should be
- rolled back and the operation retried in a new transaction.'''),
Error('WT_DUPLICATE_KEY', 'attempt to insert an existing key', '''
This error is generated when the application attempts to insert
a record with the same key as an existing record without the
@@ -29,6 +24,11 @@ errors = [
This error indicates an underlying problem that requires the
application exit and restart.'''),
Error('WT_RESTART', 'restart the operation (internal)', undoc=True),
+ Error('WT_ROLLBACK', 'conflict between concurrent operations', '''
+ This error is generated when an operation cannot be completed
+ due to a conflict with concurrent operations. The operation
+ may be retried; if a transaction is in progress, it should be
+ rolled back and the operation retried in a new transaction.'''),
]
class Method:
diff --git a/dist/s_define.list b/dist/s_define.list
index 3bae650c013..618c31d2d7a 100644
--- a/dist/s_define.list
+++ b/dist/s_define.list
@@ -37,6 +37,7 @@ WT_ATOMIC_SUB2
WT_BARRIER
WT_BLOCK_DESC_SIZE
WT_CACHE_LINE_ALIGNMENT
+WT_DEADLOCK
WT_DEBUG_BYTE
WT_HANDLE_CLOSED
WT_HANDLE_NULLABLE
diff --git a/dist/s_style b/dist/s_style
index 8afde0aba6e..e36924dffb9 100755
--- a/dist/s_style
+++ b/dist/s_style
@@ -59,6 +59,11 @@ for f in \
cat $t
fi
+ if grep WT_DEADLOCK $f | grep -v '#define.WT_DEADLOCK' > $t; then
+ echo "$f: WT_DEADLOCK deprecated in favor of WT_ROLLBACK"
+ cat $t
+ fi
+
if ! expr "$f" : 'examples/c/.*' > /dev/null &&
! expr "$f" : 'ext/datasources/helium/helium.c' > /dev/null &&
! expr "$f" : 'src/include/os.h' > /dev/null &&
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c
index d4f571ccaf6..c979c7b7cea 100644
--- a/examples/c/ex_all.c
+++ b/examples/c/ex_all.c
@@ -703,7 +703,7 @@ transaction_ops(WT_CONNECTION *conn, WT_SESSION *session)
* and all cursors are reset.
*/
break;
- case WT_DEADLOCK: /* Update conflict */
+ case WT_ROLLBACK: /* Update conflict */
default: /* Other error */
ret = session->rollback_transaction(session, NULL);
/* The rollback_transaction call resets all cursors. */
diff --git a/examples/java/com/wiredtiger/examples/ex_all.java b/examples/java/com/wiredtiger/examples/ex_all.java
index a0a2e2cdc6a..8648d95a185 100644
--- a/examples/java/com/wiredtiger/examples/ex_all.java
+++ b/examples/java/com/wiredtiger/examples/ex_all.java
@@ -666,7 +666,7 @@ transaction_ops(Connection conn, Session session)
* If commit_transaction fails, the transaction was rolled-back.
*/
break;
- case wiredtiger.WT_DEADLOCK: /* Update conflict */
+ case wiredtiger.WT_ROLLBACK: /* Update conflict */
default: /* Other error */
ret = session.rollback_transaction(null);
/* The rollback_transaction call resets all open cursors. */
diff --git a/ext/datasources/helium/helium.c b/ext/datasources/helium/helium.c
index 2c1b5891fa1..f5be26e9119 100644
--- a/ext/datasources/helium/helium.c
+++ b/ext/datasources/helium/helium.c
@@ -806,7 +806,7 @@ cache_value_update_check(WT_CURSOR *wtcursor)
for (i = 0, cp = cursor->cache; i < cursor->cache_entries; ++i, ++cp)
if (!cache_value_aborted(wtcursor, cp) &&
!wtext->transaction_visible(wtext, session, cp->txnid))
- return (WT_DEADLOCK);
+ return (WT_ROLLBACK);
return (0);
}
diff --git a/src/btree/bt_evict.c b/src/btree/bt_evict.c
index 2d192309c8a..ff049553c7f 100644
--- a/src/btree/bt_evict.c
+++ b/src/btree/bt_evict.c
@@ -1118,7 +1118,7 @@ __evict_get_ref(
__wt_txn_am_oldest(session)) {
F_CLR(cache, WT_EVICT_STUCK);
WT_STAT_FAST_CONN_INCR(session, txn_fail_cache);
- return (WT_DEADLOCK);
+ return (WT_ROLLBACK);
}
/*
diff --git a/src/conn/api_strerror.c b/src/conn/api_strerror.c
index 8cd410d4f01..1ad136eae12 100644
--- a/src/conn/api_strerror.c
+++ b/src/conn/api_strerror.c
@@ -16,8 +16,6 @@ wiredtiger_strerror(int error)
return ("Successful return: 0");
switch (error) {
- case WT_DEADLOCK:
- return ("WT_DEADLOCK: conflict between concurrent operations");
case WT_DUPLICATE_KEY:
return ("WT_DUPLICATE_KEY: attempt to insert an existing key");
case WT_ERROR:
@@ -28,6 +26,8 @@ wiredtiger_strerror(int error)
return ("WT_PANIC: WiredTiger library panic");
case WT_RESTART:
return ("WT_RESTART: restart the operation (internal)");
+ case WT_ROLLBACK:
+ return ("WT_ROLLBACK: conflict between concurrent operations");
default:
if (error > 0 && (p = strerror(error)) != NULL)
return (p);
diff --git a/src/docs/cursor-ops.dox b/src/docs/cursor-ops.dox
index d9d8f19868c..e4832267f08 100644
--- a/src/docs/cursor-ops.dox
+++ b/src/docs/cursor-ops.dox
@@ -126,7 +126,7 @@ the cursor. These operations are WT_CURSOR::remove, WT_CURSOR::search,
WT_CURSOR::search_near and WT_CURSOR::update, but do not include
WT_CURSOR::insert, as it does not position the cursor.
-If such an operation fails (for example, due to a ::WT_DEADLOCK error),
+If such an operation fails (for example, due to a ::WT_ROLLBACK error),
it may be retried without calling WT_CURSOR::set_key or
WT_CURSOR::set_value again. That is, the cursor may still reference the
application-supplied memory until it is successfully positioned.
diff --git a/src/docs/error-handling.dox b/src/docs/error-handling.dox
index 0b4ac778639..ea8b721bd7d 100644
--- a/src/docs/error-handling.dox
+++ b/src/docs/error-handling.dox
@@ -4,7 +4,7 @@ WiredTiger operations return a value of 0 on success and a non-zero
value on error. Error codes may be either positive or negative:
positive error codes are standard error codes as described for
POSIX-like systems (for example, EINVAL or EBUSY), negative error codes
-are WiredTiger-specific (for example, WT_DEADLOCK).
+are WiredTiger-specific (for example, WT_ROLLBACK).
WiredTiger-specific error codes always appear in the -31,800 to -31,999
range.
@@ -25,9 +25,6 @@ The following is a list of possible WiredTiger-specific errors:
@if IGNORE_BUILT_BY_API_ERR_BEGIN
@endif
-@par WT_DEADLOCK
-This error is generated when an operation cannot be completed due to a conflict with concurrent operations. The operation may be retried; if a transaction is in progress, it should be rolled back and the operation retried in a new transaction.
-
@par WT_DUPLICATE_KEY
This error is generated when the application attempts to insert a record with the same key as an existing record without the 'overwrite' configuration to WT_SESSION::open_cursor.
@@ -40,6 +37,9 @@ This error indicates an operation did not find a value to return. This includes
@par WT_PANIC
This error indicates an underlying problem that requires the application exit and restart.
+@par WT_ROLLBACK
+This error is generated when an operation cannot be completed due to a conflict with concurrent operations. The operation may be retried; if a transaction is in progress, it should be rolled back and the operation retried in a new transaction.
+
@if IGNORE_BUILT_BY_API_ERR_END
@endif
diff --git a/src/docs/transactions.dox b/src/docs/transactions.dox
index 7f3acaa245d..8b57152cf52 100644
--- a/src/docs/transactions.dox
+++ b/src/docs/transactions.dox
@@ -42,7 +42,7 @@ If WT_SESSION::commit_transaction returns an error for any reason, the
transaction was rolled back, not committed.
When transactions are used, data operations can encounter a conflict and
-fail with the ::WT_DEADLOCK error. If this error occurs, transactions
+fail with the ::WT_ROLLBACK error. If this error occurs, transactions
should be rolled back with WT_SESSION::rollback_transaction and the
operation retried.
@@ -76,14 +76,14 @@ the bottleneck of a centralized lock manager and ensures transactional
operations do not block: reads do not block writes, and vice versa.
Further, writes do not block writes, although concurrent transactions
-updating the same value will fail with ::WT_DEADLOCK. Some applications
+updating the same value will fail with ::WT_ROLLBACK. Some applications
may benefit from application-level synchronization to avoid repeated
attempts to rollback and update the same value.
-Operations in transactions may also fail with the ::WT_DEADLOCK error if
+Operations in transactions may also fail with the ::WT_ROLLBACK error if
some resource cannot be allocated after repeated attempts. For example, if
the cache is not large enough to hold the updates required to satisfy
-transactional readers, an operation may fail and return ::WT_DEADLOCK.
+transactional readers, an operation may fail and return ::WT_ROLLBACK.
@section transaction_isolation Isolation levels
diff --git a/src/docs/upgrading.dox b/src/docs/upgrading.dox
index 71b666abdec..d9346faa170 100644
--- a/src/docs/upgrading.dox
+++ b/src/docs/upgrading.dox
@@ -1,5 +1,16 @@
/*! @page upgrading Upgrading WiredTiger applications
+@section version_241 Upgrading to Version 2.4.1
+
+