Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
educg-net-25737-2462428
db2024-1105
Commits
a936486f
Commit
a936486f
authored
10 months ago
by
=
Browse files
Options
Download
Patches
Plain Diff
abortttt
parent
37290c9a
zywoo
6800
6800+
6800++
6800h
6800z
9800h
9800z
lovestory
moneys
neon
nico
niko
pru
recordlock6793
release-v1
riven
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rmdb.cpp
+15
-15
src/rmdb.cpp
with
15 additions
and
15 deletions
+15
-15
src/rmdb.cpp
+
15
−
15
View file @
a936486f
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets