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
e3bd28ff
Commit
e3bd28ff
authored
Oct 08, 2019
by
Will DeVries
Committed by
Sergei Petrunia
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix transaction assertions and rename some methods.
parent
62b8d3d4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
46 deletions
+46
-46
storage/clustrixdb/clustrix_connection.cc
storage/clustrixdb/clustrix_connection.cc
+21
-21
storage/clustrixdb/clustrix_connection.h
storage/clustrixdb/clustrix_connection.h
+12
-12
storage/clustrixdb/ha_clustrixdb.cc
storage/clustrixdb/ha_clustrixdb.cc
+13
-13
No files found.
storage/clustrixdb/clustrix_connection.cc
View file @
e3bd28ff
...
...
@@ -213,18 +213,18 @@ int clustrix_connection::send_transaction_cmd()
DBUG_RETURN
(
error_code
);
}
bool
clustrix_connection
::
begin_trans
()
bool
clustrix_connection
::
begin_trans
action
()
{
DBUG_ENTER
(
"clustrix_connection::begin_trans"
);
DBUG_ENTER
(
"clustrix_connection::begin_trans
action
"
);
assert
(
!
has_transaction
);
commit_flag_next
|=
CLUSTRIX_TRANS_BEGIN
;
has_transaction
=
TRUE
;
DBUG_RETURN
(
TRUE
);
}
bool
clustrix_connection
::
commit_trans
()
bool
clustrix_connection
::
commit_trans
action
()
{
DBUG_ENTER
(
"clustrix_connection::commit_trans"
);
DBUG_ENTER
(
"clustrix_connection::commit_trans
action
"
);
assert
(
has_transaction
);
if
(
commit_flag_next
&
CLUSTRIX_TRANS_BEGIN
)
{
...
...
@@ -234,13 +234,13 @@ bool clustrix_connection::commit_trans()
commit_flag_next
|=
CLUSTRIX_TRANS_COMMIT
;
has_transaction
=
FALSE
;
has_
statement_trans
=
FALSE
;
has_
anonymous_savepoint
=
FALSE
;
DBUG_RETURN
(
TRUE
);
}
bool
clustrix_connection
::
rollback_trans
()
bool
clustrix_connection
::
rollback_trans
action
()
{
DBUG_ENTER
(
"clustrix_connection::rollback_trans"
);
DBUG_ENTER
(
"clustrix_connection::rollback_trans
action
"
);
assert
(
has_transaction
);
if
(
commit_flag_next
&
CLUSTRIX_TRANS_BEGIN
)
{
...
...
@@ -250,7 +250,7 @@ bool clustrix_connection::rollback_trans()
commit_flag_next
|=
CLUSTRIX_TRANS_ROLLBACK
;
has_transaction
=
FALSE
;
has_
statement_trans
=
FALSE
;
has_
anonymous_savepoint
=
FALSE
;
DBUG_RETURN
(
TRUE
);
}
...
...
@@ -264,42 +264,42 @@ void clustrix_connection::auto_commit_closed()
assert
(
has_transaction
);
if
(
commit_flag_next
&
CLUSTRIX_TRANS_COMMIT_ON_FINISH
)
{
has_transaction
=
FALSE
;
has_
statement_trans
=
FALSE
;
has_
anonymous_savepoint
=
FALSE
;
commit_flag_next
&=
~
CLUSTRIX_TRANS_COMMIT_ON_FINISH
;
}
}
bool
clustrix_connection
::
begin_stmt_trans
()
bool
clustrix_connection
::
set_anonymous_savepoint
()
{
DBUG_ENTER
(
"clustrix_connection::
begin_stmt_trans
"
);
DBUG_ENTER
(
"clustrix_connection::
set_anonymous_savepoint
"
);
assert
(
has_transaction
);
assert
(
!
has_
statement_trans
);
assert
(
!
has_
anonymous_savepoint
);
commit_flag_next
|=
CLUSTRIX_STMT_NEW
;
has_
statement_trans
=
TRUE
;
has_
anonymous_savepoint
=
TRUE
;
DBUG_RETURN
(
TRUE
);
}
bool
clustrix_connection
::
commit_stmt_trans
()
bool
clustrix_connection
::
release_anonymous_savepoint
()
{
DBUG_ENTER
(
"clustrix_connection::
commit_stmt_trans
"
);
DBUG_ENTER
(
"clustrix_connection::
release_anonymous_savepoint
"
);
assert
(
has_transaction
);
assert
(
has_
statement_trans
);
assert
(
has_
anonymous_savepoint
);
if
(
commit_flag_next
&
CLUSTRIX_STMT_NEW
)
{
commit_flag_next
&=
~
CLUSTRIX_STMT_NEW
;
DBUG_RETURN
(
FALSE
);
}
has_
statement_trans
=
FALSE
;
has_
anonymous_savepoint
=
FALSE
;
DBUG_RETURN
(
TRUE
);
}
bool
clustrix_connection
::
rollback_
stmt_trans
()
bool
clustrix_connection
::
rollback_
to_anonymous_savepoint
()
{
DBUG_ENTER
(
"clustrix_connection::rollback_
stmt_trans
"
);
DBUG_ENTER
(
"clustrix_connection::rollback_
to_anonymous_savepoint
"
);
assert
(
has_transaction
);
assert
(
has_
statement_trans
);
assert
(
has_
anonymous_savepoint
);
if
(
commit_flag_next
&
CLUSTRIX_STMT_NEW
)
{
commit_flag_next
&=
~
CLUSTRIX_STMT_NEW
;
...
...
@@ -307,7 +307,7 @@ bool clustrix_connection::rollback_stmt_trans()
}
commit_flag_next
|=
CLUSTRIX_STMT_ROLLBACK
;
has_
statement_trans
=
FALSE
;
has_
anonymous_savepoint
=
FALSE
;
DBUG_RETURN
(
TRUE
);
}
...
...
storage/clustrixdb/clustrix_connection.h
View file @
e3bd28ff
...
...
@@ -37,7 +37,7 @@ class clustrix_connection
size_t
reply_length
;
bool
has_transaction
;
bool
has_
statement_trans
;
bool
has_
anonymous_savepoint
;
int
commit_flag_next
;
public:
...
...
@@ -46,7 +46,7 @@ class clustrix_connection
{
DBUG_ENTER
(
"clustrix_connection::clustrix_connection"
);
memset
(
&
clustrix_net
,
0
,
sizeof
(
MYSQL
));
has_
statement_trans
=
FALSE
;
has_
anonymous_savepoint
=
FALSE
;
has_transaction
=
FALSE
;
commit_flag_next
=
0
;
DBUG_VOID_RETURN
;
...
...
@@ -73,22 +73,21 @@ class clustrix_connection
void
disconnect
(
bool
is_destructor
=
FALSE
);
int
send_transaction_cmd
();
bool
begin_trans
();
bool
commit_trans
();
bool
rollback_trans
();
bool
begin_trans
action
();
bool
commit_trans
action
();
bool
rollback_trans
action
();
void
auto_commit_next
();
void
auto_commit_closed
();
inline
bool
has_trans
()
inline
bool
has_open_transaction
()
{
return
has_transaction
;
}
bool
begin_stmt_trans
();
bool
commit_stmt_trans
();
bool
rollback_
stmt_trans
();
inline
bool
has_
stmt_trans
()
bool
set_anonymous_savepoint
();
bool
release_anonymous_savepoint
();
bool
rollback_
to_anonymous_savepoint
();
inline
bool
has_
open_anonymous_savepoint
()
{
return
has_
statement_trans
;
return
has_
anonymous_savepoint
;
}
int
run_query
(
String
&
stmt
);
...
...
@@ -151,5 +150,6 @@ class clustrix_connection
int
begin_command
(
uchar
command
);
int
send_command
();
int
read_query_response
();
void
auto_commit_closed
();
};
#endif // _clustrix_connection_h
storage/clustrixdb/ha_clustrixdb.cc
View file @
e3bd28ff
...
...
@@ -409,7 +409,7 @@ int ha_clustrixdb::write_row(const uchar *buf)
if
(
!
trx
)
return
error_code
;
assert
(
trx
->
has_
stmt_trans
());
assert
(
trx
->
has_
open_transaction
());
/* Convert the row format to binlog (packed) format */
uchar
*
packed_new_row
=
(
uchar
*
)
my_alloca
(
estimate_row_size
(
table
));
...
...
@@ -442,7 +442,7 @@ int ha_clustrixdb::update_row(const uchar *old_data, const uchar *new_data)
if
(
!
trx
)
DBUG_RETURN
(
error_code
);
assert
(
trx
->
has_
stmt_trans
());
assert
(
trx
->
has_
open_transaction
());
size_t
row_size
=
estimate_row_size
(
table
);
size_t
packed_key_len
;
...
...
@@ -502,7 +502,7 @@ int ha_clustrixdb::delete_row(const uchar *buf)
if
(
!
trx
)
return
error_code
;
assert
(
trx
->
has_
stmt_trans
());
assert
(
trx
->
has_
open_transaction
());
// The estimate should consider only key fields widths.
size_t
packed_key_len
;
...
...
@@ -932,11 +932,11 @@ 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_trans
action
();
trans_register_ha
(
thd
,
FALSE
,
clustrixdb_hton
);
if
(
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
{
trx
->
begin_stmt_trans
();
trx
->
set_anonymous_savepoint
();
trans_register_ha
(
thd
,
TRUE
,
clustrixdb_hton
);
}
}
...
...
@@ -1039,11 +1039,11 @@ static int clustrixdb_commit(handlerton *hton, THD *thd, bool all)
bool
send_cmd
;
if
(
all
||
!
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
{
if
(
trx
->
has_
trans
())
send_cmd
=
trx
->
commit_trans
();
if
(
trx
->
has_
open_transaction
())
send_cmd
=
trx
->
commit_trans
action
();
}
else
{
if
(
trx
->
has_
stmt_trans
())
send_cmd
=
trx
->
commit_stmt_trans
();
if
(
trx
->
has_
open_anonymous_savepoint
())
send_cmd
=
trx
->
release_anonymous_savepoint
();
}
if
(
send_cmd
)
...
...
@@ -1059,11 +1059,11 @@ static int clustrixdb_rollback(handlerton *hton, THD *thd, bool all)
bool
send_cmd
;
if
(
all
||
!
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
{
if
(
trx
->
has_
trans
())
send_cmd
=
trx
->
rollback_trans
();
if
(
trx
->
has_
open_transaction
())
send_cmd
=
trx
->
rollback_trans
action
();
}
else
{
if
(
trx
->
has_
stmt_trans
())
send_cmd
=
trx
->
rollback_
stmt_trans
();
if
(
trx
->
has_
open_anonymous_savepoint
())
send_cmd
=
trx
->
rollback_
to_anonymous_savepoint
();
}
if
(
send_cmd
)
...
...
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