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
6195a016
Commit
6195a016
authored
Jul 01, 2019
by
Will DeVries
Committed by
Sergei Petrunia
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove st_clustrixdb_trx.
parent
84cfedff
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
146 additions
and
172 deletions
+146
-172
storage/clustrixdb/clustrix_connection.cc
storage/clustrixdb/clustrix_connection.cc
+43
-2
storage/clustrixdb/clustrix_connection.h
storage/clustrixdb/clustrix_connection.h
+17
-0
storage/clustrixdb/ha_clustrixdb.cc
storage/clustrixdb/ha_clustrixdb.cc
+73
-137
storage/clustrixdb/ha_clustrixdb.h
storage/clustrixdb/ha_clustrixdb.h
+1
-19
storage/clustrixdb/ha_clustrixdb_pushdown.cc
storage/clustrixdb/ha_clustrixdb_pushdown.cc
+12
-14
No files found.
storage/clustrixdb/clustrix_connection.cc
View file @
6195a016
...
...
@@ -154,10 +154,14 @@ int clustrix_connection::read_query_response()
int
clustrix_connection
::
begin_trans
()
{
if
(
has_transaction
)
return
0
;
const
char
*
stmt
=
"BEGIN TRANSACTION"
;
int
error_code
=
mysql_real_query
(
&
clustrix_net
,
stmt
,
strlen
(
stmt
));
if
(
error_code
)
return
mysql_errno
(
&
clustrix_net
);
has_transaction
=
TRUE
;
return
error_code
;
}
...
...
@@ -167,6 +171,8 @@ int clustrix_connection::commit_trans()
int
error_code
=
mysql_real_query
(
&
clustrix_net
,
stmt
,
strlen
(
stmt
));
if
(
error_code
)
return
mysql_errno
(
&
clustrix_net
);
has_transaction
=
FALSE
;
has_statement_trans
=
FALSE
;
return
error_code
;
}
...
...
@@ -176,6 +182,41 @@ int clustrix_connection::rollback_trans()
int
error_code
=
mysql_real_query
(
&
clustrix_net
,
stmt
,
strlen
(
stmt
));
if
(
error_code
)
return
mysql_errno
(
&
clustrix_net
);
has_transaction
=
FALSE
;
has_statement_trans
=
FALSE
;
return
error_code
;
}
int
clustrix_connection
::
begin_stmt_trans
()
{
if
(
has_statement_trans
)
return
0
;
const
char
*
stmt
=
"SAVEPOINT STMT_TRANS"
;
int
error_code
=
mysql_real_query
(
&
clustrix_net
,
stmt
,
strlen
(
stmt
));
if
(
error_code
)
return
mysql_errno
(
&
clustrix_net
);
has_statement_trans
=
TRUE
;
return
error_code
;
}
int
clustrix_connection
::
commit_stmt_trans
()
{
const
char
*
stmt
=
"RELEASE SAVEPOINT STMT_TRANS"
;
int
error_code
=
mysql_real_query
(
&
clustrix_net
,
stmt
,
strlen
(
stmt
));
if
(
error_code
)
return
mysql_errno
(
&
clustrix_net
);
has_statement_trans
=
FALSE
;
return
error_code
;
}
int
clustrix_connection
::
rollback_stmt_trans
()
{
const
char
*
stmt
=
"ROLLBACK TO STMT_TRANS"
;
int
error_code
=
mysql_real_query
(
&
clustrix_net
,
stmt
,
strlen
(
stmt
));
if
(
error_code
)
return
mysql_errno
(
&
clustrix_net
);
has_statement_trans
=
FALSE
;
return
error_code
;
}
...
...
@@ -330,7 +371,7 @@ int clustrix_connection::scan_init(ulonglong clustrix_table_oid, uint index,
* Sends a command over mysql protocol connection to initiate an
* arbitrary query using a query text.
* Uses field types, field metadata and nullability to explicitly
* cast result to expected data type. Exploits RBR TABLE_MAP_EVENT
* cast result to expected data type. Exploits RBR TABLE_MAP_EVENT
* format + sends SQL text.
* @args
* stmt& Query text to send
...
...
@@ -356,7 +397,7 @@ int clustrix_connection::scan_query_init(String &stmt, uchar *fieldtype,
if
((
error_code
=
add_command_operand_str
(
fieldtype
,
fields
)))
return
error_code
;
if
((
error_code
=
add_command_operand_str
(
field_metadata
,
field_metadata_size
)))
return
error_code
;
...
...
storage/clustrixdb/clustrix_connection.h
View file @
6195a016
...
...
@@ -36,12 +36,17 @@ class clustrix_connection
uchar
*
reply_buffer
;
size_t
reply_length
;
bool
has_transaction
;
bool
has_statement_trans
;
public:
ulonglong
last_insert_id
;
clustrix_connection
()
:
command_buffer
(
NULL
),
command_buffer_length
(
0
),
command_length
(
0
)
{
memset
(
&
clustrix_net
,
0
,
sizeof
(
MYSQL
));
has_statement_trans
=
FALSE
;
has_transaction
=
FALSE
;
}
~
clustrix_connection
()
...
...
@@ -64,6 +69,18 @@ class clustrix_connection
int
begin_trans
();
int
commit_trans
();
int
rollback_trans
();
inline
bool
has_trans
()
{
return
has_transaction
;
}
int
begin_stmt_trans
();
int
commit_stmt_trans
();
int
rollback_stmt_trans
();
inline
bool
has_stmt_trans
()
{
return
has_statement_trans
;
}
int
create_table
(
String
&
stmt
);
int
delete_table
(
String
&
stmt
);
...
...
storage/clustrixdb/ha_clustrixdb.cc
View file @
6195a016
This diff is collapsed.
Click to expand it.
storage/clustrixdb/ha_clustrixdb.h
View file @
6195a016
...
...
@@ -21,27 +21,9 @@ Copyright (c) 2019, MariaDB Corporation.
#include "../../sql/rpl_record.h"
size_t
estimate_row_size
(
TABLE
*
table
);
class
st_clustrixdb_trx
;
st_clustrixdb_trx
*
get_trx
(
THD
*
thd
,
int
*
error_code
);
clustrix_connection
*
get_trx
(
THD
*
thd
,
int
*
error_code
);
bool
get_enable_sh
(
THD
*
thd
);
class
ha_clustrixdb
;
class
st_clustrixdb_trx
{
public:
THD
*
thd
;
clustrix_connection
*
clustrix_net
;
//query_id_t query_id;
//MEM_ROOT mem_root; /* Memory allocated for the executing transaction */
bool
has_transaction
;
st_clustrixdb_trx
(
THD
*
trx_thd
);
~
st_clustrixdb_trx
();
int
net_init
();
int
begin_trans
();
};
class
ha_clustrixdb
:
public
handler
{
private:
...
...
storage/clustrixdb/ha_clustrixdb_pushdown.cc
View file @
6195a016
...
...
@@ -99,7 +99,7 @@ create_clustrixdb_select_handler(THD* thd, SELECT_LEX* select_lex)
int
error_code
=
0
;
int
field_metadata_size
=
0
;
ulonglong
scan_refid
=
0
;
st_clustrixdb_trx
*
trx
=
0
;
clustrix_connection
*
trx
=
NULL
;
// We presume this number is equal to types.elements in get_field_types
uint
items_number
=
select_lex
->
get_item_list
()
->
elements
;
...
...
@@ -125,7 +125,7 @@ create_clustrixdb_select_handler(THD* thd, SELECT_LEX* select_lex)
if
(
!
trx
)
goto
err
;
if
((
error_code
=
trx
->
clustrix_net
->
scan_query_init
(
query
,
fieldtype
,
items_number
,
if
((
error_code
=
trx
->
scan_query_init
(
query
,
fieldtype
,
items_number
,
null_bits
,
num_null_bytes
,
field_metadata
,
field_metadata_size
,
&
scan_refid
)))
{
goto
err
;
}
...
...
@@ -169,12 +169,12 @@ ha_clustrixdb_select_handler::ha_clustrixdb_select_handler(
ha_clustrixdb_select_handler
::~
ha_clustrixdb_select_handler
()
{
int
error_code
;
st_clustrixdb_trx
*
trx
=
get_trx
(
thd
,
&
error_code
);
clustrix_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
!
trx
)
{
// TBD Log this
}
if
(
trx
&&
scan_refid
)
trx
->
clustrix_net
->
scan_end
(
scan_refid
);
trx
->
scan_end
(
scan_refid
);
// If the ::init_scan has been executed
if
(
table__
)
...
...
@@ -217,7 +217,7 @@ int ha_clustrixdb_select_handler::init_scan()
int
ha_clustrixdb_select_handler
::
next_row
()
{
int
error_code
=
0
;
st_clustrixdb_trx
*
trx
=
get_trx
(
thd
,
&
error_code
);
clustrix_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
!
trx
)
return
error_code
;
...
...
@@ -225,8 +225,7 @@ int ha_clustrixdb_select_handler::next_row()
uchar
*
rowdata
;
ulong
rowdata_length
;
if
((
error_code
=
trx
->
clustrix_net
->
scan_next
(
scan_refid
,
&
rowdata
,
&
rowdata_length
)))
if
((
error_code
=
trx
->
scan_next
(
scan_refid
,
&
rowdata
,
&
rowdata_length
)))
return
error_code
;
uchar
const
*
current_row_end
;
...
...
@@ -284,7 +283,7 @@ create_clustrixdb_derived_handler(THD* thd, TABLE_LIST *derived)
int
error_code
=
0
;
int
field_metadata_size
=
0
;
ulonglong
scan_refid
=
0
;
st_clustrixdb_trx
*
trx
=
0
;
clustrix_connection
*
trx
=
NULL
;
// We presume this number is equal to types.elements in get_field_types
uint
items_number
=
select_lex
->
get_item_list
()
->
elements
;
...
...
@@ -310,7 +309,7 @@ create_clustrixdb_derived_handler(THD* thd, TABLE_LIST *derived)
if
(
!
trx
)
goto
err
;
if
((
error_code
=
trx
->
clustrix_net
->
scan_query_init
(
query
,
fieldtype
,
items_number
,
if
((
error_code
=
trx
->
scan_query_init
(
query
,
fieldtype
,
items_number
,
null_bits
,
num_null_bytes
,
field_metadata
,
field_metadata_size
,
&
scan_refid
)))
{
goto
err
;
}
...
...
@@ -354,12 +353,12 @@ ha_clustrixdb_derived_handler::ha_clustrixdb_derived_handler(
ha_clustrixdb_derived_handler
::~
ha_clustrixdb_derived_handler
()
{
int
error_code
;
st_clustrixdb_trx
*
trx
=
get_trx
(
thd
,
&
error_code
);
clustrix_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
!
trx
)
{
// TBD Log this.
}
if
(
trx
&&
scan_refid
)
trx
->
clustrix_net
->
scan_end
(
scan_refid
);
trx
->
scan_end
(
scan_refid
);
// If the ::init_scan has been executed
if
(
table__
)
...
...
@@ -402,7 +401,7 @@ int ha_clustrixdb_derived_handler::init_scan()
int
ha_clustrixdb_derived_handler
::
next_row
()
{
int
error_code
=
0
;
st_clustrixdb_trx
*
trx
=
get_trx
(
thd
,
&
error_code
);
clustrix_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
!
trx
)
return
error_code
;
...
...
@@ -410,8 +409,7 @@ int ha_clustrixdb_derived_handler::next_row()
uchar
*
rowdata
;
ulong
rowdata_length
;
if
((
error_code
=
trx
->
clustrix_net
->
scan_next
(
scan_refid
,
&
rowdata
,
&
rowdata_length
)))
if
((
error_code
=
trx
->
scan_next
(
scan_refid
,
&
rowdata
,
&
rowdata_length
)))
return
error_code
;
uchar
const
*
current_row_end
;
...
...
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