summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorAlex Gorrod <alexg@wiredtiger.com>2014-06-16 14:20:27 +1000
committerAlex Gorrod <alexg@wiredtiger.com>2014-06-16 14:20:27 +1000
commitf39460960701380e4629bfb46f3c3b79e006089e (patch)
tree1650c56bc5694b006c0b358ceee4c4797f94b39f /api
parent7686b6c7d6f3aca6fc20ba1ca75974890de62a6a (diff)
downloadmongo-f39460960701380e4629bfb46f3c3b79e006089e.tar.gz
Fixup error handling in LevelDB WriteBatch implementation.
Diffstat (limited to 'api')
-rw-r--r--api/leveldb/leveldb_wt.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/api/leveldb/leveldb_wt.cc b/api/leveldb/leveldb_wt.cc
index 4ec1351c8e2..8fe820c3955 100644
--- a/api/leveldb/leveldb_wt.cc
+++ b/api/leveldb/leveldb_wt.cc
@@ -534,18 +534,18 @@ DbImpl::Write(const WriteOptions& options, WriteBatch* updates)
WriteBatchHandler handler(cursor);
status = updates->Iterate(&handler);
- // Retry the batch if we got a deadlock return and could roll back
- // the transaction.
- if (handler.getWiredTigerStatus() != WT_DEADLOCK ||
- (ret = session->rollback_transaction(session, NULL)) != 0)
+ if ((ret = handler.getWiredTigerStatus()) != WT_DEADLOCK)
break;
+ // Roll back the transaction on deadlock so we can try again
+ if ((ret = session->rollback_transaction(session, NULL)) != 0)
+ return WiredTigerErrorToStatus(
+ ret, "Rollback transaction failed in Write batch");
}
if (status.ok() && ret == 0)
ret = session->commit_transaction(session, NULL);
- else if ((t_ret = session->rollback_transaction(session, NULL)) != 0 &&
- ret == 0)
- ret = t_ret;
+ else if (ret == 0)
+ ret = session->rollback_transaction(session, NULL);
if (status.ok() && ret != 0)
status = WiredTigerErrorToStatus(ret, NULL);