Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
a336cb20
Commit
a336cb20
authored
Jul 22, 2019
by
Will DeVries
Committed by
Sergei Petrunia
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some transaction handling errors.
parent
ea5b6a6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
14 deletions
+22
-14
mysql-test/suite/clustrixdb/basics.result
mysql-test/suite/clustrixdb/basics.result
+0
-0
storage/clustrixdb/clustrix_connection.cc
storage/clustrixdb/clustrix_connection.cc
+3
-0
storage/clustrixdb/ha_clustrixdb.cc
storage/clustrixdb/ha_clustrixdb.cc
+19
-14
No files found.
mysql-test/suite/clustrixdb/basics.result
View file @
a336cb20
No preview for this file type
storage/clustrixdb/clustrix_connection.cc
View file @
a336cb20
...
...
@@ -189,6 +189,7 @@ int clustrix_connection::rollback_trans()
int
clustrix_connection
::
begin_stmt_trans
()
{
assert
(
has_transaction
);
if
(
has_statement_trans
)
return
0
;
...
...
@@ -202,6 +203,7 @@ int clustrix_connection::begin_stmt_trans()
int
clustrix_connection
::
commit_stmt_trans
()
{
assert
(
has_transaction
);
const
char
*
stmt
=
"RELEASE SAVEPOINT STMT_TRANS"
;
int
error_code
=
mysql_real_query
(
&
clustrix_net
,
stmt
,
strlen
(
stmt
));
if
(
error_code
)
...
...
@@ -212,6 +214,7 @@ int clustrix_connection::commit_stmt_trans()
int
clustrix_connection
::
rollback_stmt_trans
()
{
assert
(
has_transaction
);
const
char
*
stmt
=
"ROLLBACK TO STMT_TRANS"
;
int
error_code
=
mysql_real_query
(
&
clustrix_net
,
stmt
,
strlen
(
stmt
));
if
(
error_code
)
...
...
storage/clustrixdb/ha_clustrixdb.cc
View file @
a336cb20
...
...
@@ -825,16 +825,17 @@ int ha_clustrixdb::external_lock(THD *thd, int lock_type)
int
error_code
;
clustrix_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
lock_type
!=
F_UNLCK
)
{
trx
->
begin_trans
();
trx
->
begin_stmt_trans
();
if
((
error_code
=
trx
->
begin_trans
()))
return
error_code
;
if
((
error_code
=
trx
->
begin_stmt_trans
()))
return
error_code
;
trans_register_ha
(
thd
,
FALSE
,
clustrixdb_hton
);
if
(
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
trans_register_ha
(
thd
,
TRUE
,
clustrixdb_hton
);
}
//if (lock_type != F_UNLCK)
//DBUG_ASSERT(trx && trx == get_trx(thd, &error_code));
return
0
;
}
...
...
@@ -931,11 +932,13 @@ static int clustrixdb_commit(handlerton *hton, THD *thd, bool all)
clustrix_connection
*
trx
=
(
clustrix_connection
*
)
thd_get_ha_data
(
thd
,
hton
);
assert
(
trx
);
if
(
trx
->
has_stmt_trans
()
&&
((
error_code
=
trx
->
commit_stmt_trans
())))
return
error_code
;
if
(
all
&&
trx
->
has_trans
())
if
(
all
||
!
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
{
if
(
trx
->
has_trans
())
error_code
=
trx
->
commit_trans
();
}
else
{
if
(
trx
->
has_stmt_trans
())
error_code
=
trx
->
commit_stmt_trans
();
}
return
error_code
;
}
...
...
@@ -946,11 +949,13 @@ static int clustrixdb_rollback(handlerton *hton, THD *thd, bool all)
clustrix_connection
*
trx
=
(
clustrix_connection
*
)
thd_get_ha_data
(
thd
,
hton
);
assert
(
trx
);
if
(
trx
->
has_stmt_trans
()
&&
((
error_code
=
trx
->
rollback_stmt_trans
())))
return
error_code
;
if
(
all
||
trx
->
has_trans
())
error_code
=
trx
->
rollback_trans
();
if
(
all
||
!
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
{
if
(
trx
->
has_trans
())
error_code
=
trx
->
rollback_trans
();
}
else
{
if
(
trx
->
has_stmt_trans
())
error_code
=
trx
->
rollback_stmt_trans
();
}
return
error_code
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment