Skip to content

Commit 3225453

Browse files
kush789skyzh
andauthoredNov 23, 2022
chore: removed AbortReason::DEADLOCK, add ExecutionException (#479)
* Update transaction.h * new execution error Signed-off-by: Alex Chi <[email protected]> Signed-off-by: Alex Chi <[email protected]> Co-authored-by: Alex Chi <[email protected]>
1 parent 5e0b917 commit 3225453

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed
 

‎src/include/common/exception.h

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ enum class ExceptionType {
4747
OUT_OF_MEMORY = 9,
4848
/** Method not implemented. */
4949
NOT_IMPLEMENTED = 11,
50+
/** Execution exception. */
51+
EXECUTION = 12,
5052
};
5153

5254
class Exception : public std::runtime_error {
@@ -117,4 +119,10 @@ class NotImplementedException : public Exception {
117119
explicit NotImplementedException(const std::string &msg) : Exception(ExceptionType::NOT_IMPLEMENTED, msg) {}
118120
};
119121

122+
class ExecutionException : public Exception {
123+
public:
124+
ExecutionException() = delete;
125+
explicit ExecutionException(const std::string &msg) : Exception(ExceptionType::EXECUTION, msg) {}
126+
};
127+
120128
} // namespace bustub

‎src/include/concurrency/transaction.h

-3
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class IndexWriteRecord {
106106
enum class AbortReason {
107107
LOCK_ON_SHRINKING,
108108
UPGRADE_CONFLICT,
109-
DEADLOCK,
110109
LOCK_SHARED_ON_READ_UNCOMMITTED,
111110
TABLE_LOCK_NOT_PRESENT,
112111
ATTEMPTED_INTENTION_LOCK_ON_ROW,
@@ -135,8 +134,6 @@ class TransactionAbortException : public std::exception {
135134
case AbortReason::UPGRADE_CONFLICT:
136135
return "Transaction " + std::to_string(txn_id_) +
137136
" aborted because another transaction is already waiting to upgrade its lock\n";
138-
case AbortReason::DEADLOCK:
139-
return "Transaction " + std::to_string(txn_id_) + " aborted on deadlock\n";
140137
case AbortReason::LOCK_SHARED_ON_READ_UNCOMMITTED:
141138
return "Transaction " + std::to_string(txn_id_) + " aborted on lockshared on READ_UNCOMMITTED\n";
142139
case AbortReason::TABLE_LOCK_NOT_PRESENT:

‎src/include/execution/execution_engine.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "buffer/buffer_pool_manager.h"
1818
#include "catalog/catalog.h"
19+
#include "concurrency/transaction.h"
1920
#include "concurrency/transaction_manager.h"
2021
#include "execution/executor_context.h"
2122
#include "execution/executor_factory.h"
@@ -62,7 +63,7 @@ class ExecutionEngine {
6263
try {
6364
executor->Init();
6465
PollExecutor(executor.get(), plan, result_set);
65-
} catch (const Exception &ex) {
66+
} catch (const ExecutionException &ex) {
6667
#ifndef NDEBUG
6768
LOG_ERROR("Error Encountered in Executor Execution: %s", ex.what());
6869
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.