summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/session/session_api.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2022-01-21 16:03:19 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-21 05:33:29 +0000
commit4648ad942c3cb883677e089bea34e37e5304eaf5 (patch)
treed7b2c8b68ed1fd2bc7c05db81d06f77796fd4098 /src/third_party/wiredtiger/src/session/session_api.c
parent5a68aee5099ab053a97c1ec5cfacee42042e7d6c (diff)
downloadmongo-4648ad942c3cb883677e089bea34e37e5304eaf5.tar.gz
Import wiredtiger: 6b6c57899c9e5d63baa57fc90badfb2995d6ee9d from branch mongodb-master
ref: a0b41e9927..6b6c57899c for: 5.3.0 WT-8686 Map WT_PREPARE_CONFLICT to WT_ROLLBACK for WT_SESSION compact and truncate methods
Diffstat (limited to 'src/third_party/wiredtiger/src/session/session_api.c')
-rw-r--r--src/third_party/wiredtiger/src/session/session_api.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c
index db9ad023416..bd107fcff7c 100644
--- a/src/third_party/wiredtiger/src/session/session_api.c
+++ b/src/third_party/wiredtiger/src/session/session_api.c
@@ -1498,16 +1498,21 @@ __session_truncate(
WT_ERR(__wt_session_range_truncate(session, uri, start, stop));
err:
+ /* Map prepare-conflict to rollback. */
+ if (ret == WT_PREPARE_CONFLICT)
+ ret = WT_ROLLBACK;
+
TXN_API_END(session, ret, false);
if (ret != 0)
WT_STAT_CONN_INCR(session, session_table_truncate_fail);
else
WT_STAT_CONN_INCR(session, session_table_truncate_success);
- /*
- * Only map WT_NOTFOUND to ENOENT if a URI was specified.
- */
- return (ret == WT_NOTFOUND && uri != NULL ? ENOENT : ret);
+
+ /* Map WT_NOTFOUND to ENOENT if a URI was specified. */
+ if (ret == WT_NOTFOUND && uri != NULL)
+ ret = ENOENT;
+ return (ret);
}
/*