Commit a936486f authored by ='s avatar =
Browse files

abortttt

Showing with 15 additions and 15 deletions
+15 -15
......@@ -574,21 +574,21 @@ void *client_handler(void *sock_fd) {
}
} catch (TransactionAbortException &e) {
// 事务需要回滚,需要把abort信息返回给客户端并写入output.txt文件中
std::string str = "abort\n";
memcpy(data_send, str.c_str(), str.length());
data_send[str.length()] = '\0';
offset = str.length();
// 回滚事务
txn_manager->abort(context->txn_, log_manager.get());
//std::cout << e.GetInfo() << std::endl;
//std::cout<<"hello sdad "<<std::endl;
if(enable_output) {
std::fstream outfile;
outfile.open("output.txt", std::ios::out | std::ios::app);
outfile << str;
outfile.close();
}
// // 事务需要回滚,需要把abort信息返回给客户端并写入output.txt文件中
// std::string str = "abort\n";
// memcpy(data_send, str.c_str(), str.length());
// data_send[str.length()] = '\0';
// offset = str.length();
// // 回滚事务
// txn_manager->abort(context->txn_, log_manager.get());
// //std::cout << e.GetInfo() << std::endl;
// //std::cout<<"hello sdad "<<std::endl;
// if(enable_output) {
// std::fstream outfile;
// outfile.open("output.txt", std::ios::out | std::ios::app);
// outfile << str;
// outfile.close();
// }
} catch (RMDBError &e) {
// 遇到异常,需要打印failure到output.txt文件中,并发异常信息返回给客户端
std::cerr << e.what() << std::endl;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment