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
ff60d07c
Commit
ff60d07c
authored
Feb 13, 2020
by
Will DeVries
Committed by
Sergei Petrunia
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix more spacing issues and formatting issues.
parent
e176abf3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
124 additions
and
132 deletions
+124
-132
storage/xpand/ha_xpand.cc
storage/xpand/ha_xpand.cc
+47
-50
storage/xpand/ha_xpand_pushdown.cc
storage/xpand/ha_xpand_pushdown.cc
+34
-35
storage/xpand/ha_xpand_pushdown.h
storage/xpand/ha_xpand_pushdown.h
+29
-30
storage/xpand/xpand_connection.cc
storage/xpand/xpand_connection.cc
+14
-17
No files found.
storage/xpand/ha_xpand.cc
View file @
ff60d07c
...
...
@@ -153,46 +153,46 @@ static MYSQL_THDVAR_UINT
// Per thread select handler knob
static
MYSQL_THDVAR_BOOL
(
select_handler
,
PLUGIN_VAR_NOCMDARG
,
""
,
NULL
,
NULL
,
1
select_handler
,
PLUGIN_VAR_NOCMDARG
,
""
,
NULL
,
NULL
,
1
);
// Per thread derived handler knob
static
MYSQL_THDVAR_BOOL
(
derived_handler
,
PLUGIN_VAR_NOCMDARG
,
""
,
NULL
,
NULL
,
1
derived_handler
,
PLUGIN_VAR_NOCMDARG
,
""
,
NULL
,
NULL
,
1
);
static
MYSQL_THDVAR_BOOL
(
enable_direct_update
,
PLUGIN_VAR_NOCMDARG
,
""
,
NULL
,
NULL
,
1
enable_direct_update
,
PLUGIN_VAR_NOCMDARG
,
""
,
NULL
,
NULL
,
1
);
bool
select_handler_setting
(
THD
*
thd
)
{
return
(
thd
==
NULL
)
?
false
:
THDVAR
(
thd
,
select_handler
);
return
(
thd
==
NULL
)
?
false
:
THDVAR
(
thd
,
select_handler
);
}
bool
derived_handler_setting
(
THD
*
thd
)
{
return
(
thd
==
NULL
)
?
false
:
THDVAR
(
thd
,
derived_handler
);
return
(
thd
==
NULL
)
?
false
:
THDVAR
(
thd
,
derived_handler
);
}
uint
row_buffer_setting
(
THD
*
thd
)
{
return
THDVAR
(
thd
,
row_buffer
);
return
THDVAR
(
thd
,
row_buffer
);
}
/****************************************************************************
...
...
@@ -223,8 +223,8 @@ size_t estimate_row_size(TABLE *table)
**/
static
void
decode_objectname
(
char
*
buf
,
const
char
*
path
,
size_t
buf_size
)
{
size_t
new_path_len
=
filename_to_tablename
(
path
,
buf
,
buf_size
);
buf
[
new_path_len
]
=
'\0'
;
size_t
new_path_len
=
filename_to_tablename
(
path
,
buf
,
buf_size
);
buf
[
new_path_len
]
=
'\0'
;
}
static
void
decode_file_path
(
const
char
*
path
,
char
*
decoded_dbname
,
...
...
@@ -326,11 +326,11 @@ int ha_xpand::create(const char *name, TABLE *form, HA_CREATE_INFO *info)
// To syncronize the schemas of MDB FE and XPD BE.
if
(
form
->
s
&&
form
->
s
->
db
.
length
)
{
String
createdb_stmt
;
createdb_stmt
.
append
(
"CREATE DATABASE IF NOT EXISTS `"
);
createdb_stmt
.
append
(
form
->
s
->
db
.
str
,
form
->
s
->
db
.
length
);
createdb_stmt
.
append
(
"`"
);
trx
->
run_query
(
createdb_stmt
);
String
createdb_stmt
;
createdb_stmt
.
append
(
"CREATE DATABASE IF NOT EXISTS `"
);
createdb_stmt
.
append
(
form
->
s
->
db
.
str
,
form
->
s
->
db
.
length
);
createdb_stmt
.
append
(
"`"
);
trx
->
run_query
(
createdb_stmt
);
}
error_code
=
trx
->
run_query
(
create_table_stmt
);
...
...
@@ -489,8 +489,7 @@ int ha_xpand::write_row(const uchar *buf)
/* XXX: Xpand may needs to return HA_ERR_AUTOINC_ERANGE if we hit that
error. */
ulonglong
last_insert_id
=
0
;
if
((
error_code
=
trx
->
write_row
(
xpand_table_oid
,
packed_new_row
,
packed_size
,
if
((
error_code
=
trx
->
write_row
(
xpand_table_oid
,
packed_new_row
,
packed_size
,
&
last_insert_id
)))
goto
err
;
...
...
@@ -687,8 +686,7 @@ int ha_xpand::info(uint flag)
if
(
stats
.
records
==
0
)
stats
.
mean_rec_length
=
0
;
else
stats
.
mean_rec_length
=
(
ulong
)
(
stats
.
data_file_length
/
stats
.
records
);
stats
.
mean_rec_length
=
(
ulong
)
(
stats
.
data_file_length
/
stats
.
records
);
}
if
(
flag
&
HA_STATUS_CONST
)
...
...
@@ -780,8 +778,7 @@ int ha_xpand::index_read(uchar * buf, const uchar * key, uint key_len,
table
->
read_set
,
packed_key
,
packed_key_len
,
&
rowdata
,
&
rowdata_length
);
if
(
!
error_code
)
error_code
=
unpack_row_to_buf
(
rgi
,
table
,
buf
,
rowdata
,
table
->
read_set
,
error_code
=
unpack_row_to_buf
(
rgi
,
table
,
buf
,
rowdata
,
table
->
read_set
,
rowdata
+
rowdata_length
);
}
else
{
is_scan
=
true
;
...
...
@@ -790,7 +787,7 @@ int ha_xpand::index_read(uchar * buf, const uchar * key, uint key_len,
&
scan_fields
,
packed_key
,
packed_key_len
,
THDVAR
(
thd
,
row_buffer
),
&
scan_cur
);
if
(
!
error_code
)
error_code
=
rnd_next
(
buf
);
error_code
=
rnd_next
(
buf
);
}
if
(
rowdata
)
...
...
@@ -1056,7 +1053,7 @@ int ha_xpand::external_lock(THD *thd, int lock_type)
int
error_code
;
xpand_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
error_code
)
DBUG_RETURN
(
error_code
);
DBUG_RETURN
(
error_code
);
if
(
lock_type
==
F_WRLCK
)
xpd_lock_type
=
XPAND_EXCLUSIVE
;
...
...
@@ -1069,7 +1066,7 @@ int ha_xpand::external_lock(THD *thd, int lock_type)
if
(
!
trx
->
has_open_transaction
())
{
error_code
=
trx
->
begin_transaction_next
();
if
(
error_code
)
DBUG_RETURN
(
error_code
);
DBUG_RETURN
(
error_code
);
}
trans_register_ha
(
thd
,
FALSE
,
xpand_hton
);
...
...
@@ -1349,18 +1346,18 @@ static struct st_mysql_storage_engine xpand_storage_engine =
maria_declare_plugin
(
xpand
)
{
MYSQL_STORAGE_ENGINE_PLUGIN
,
/* Plugin Type */
&
xpand_storage_engine
,
/* Plugin Descriptor */
"XPAND"
,
/* Plugin Name */
"MariaDB"
,
/* Plugin Author */
"Xpand storage engine"
,
/* Plugin Description */
PLUGIN_LICENSE_GPL
,
/* Plugin Licence */
xpand_init
,
/* Plugin Entry Point */
xpand_deinit
,
/* Plugin Deinitializer */
0x0001
,
/* Hex Version Number (0.1) */
NULL
/* xpand_status_vars */
,
/* Status Variables */
xpand_system_variables
,
/* System Variables */
"0.1"
,
/* String Version */
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
/* Maturity Level */
MYSQL_STORAGE_ENGINE_PLUGIN
,
/* Plugin Type */
&
xpand_storage_engine
,
/* Plugin Descriptor */
"XPAND"
,
/* Plugin Name */
"MariaDB"
,
/* Plugin Author */
"Xpand storage engine"
,
/* Plugin Description */
PLUGIN_LICENSE_GPL
,
/* Plugin Licence */
xpand_init
,
/* Plugin Entry Point */
xpand_deinit
,
/* Plugin Deinitializer */
0x0001
,
/* Hex Version Number (0.1) */
NULL
/* xpand_status_vars */
,
/* Status Variables */
xpand_system_variables
,
/* System Variables */
"0.1"
,
/* String Version */
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
/* Maturity Level */
}
maria_declare_plugin_end
;
storage/xpand/ha_xpand_pushdown.cc
View file @
ff60d07c
...
...
@@ -30,7 +30,8 @@ extern uint xpand_row_buffer;
* metadata_size int or -1 in case of error
************************************************************/
int
get_field_types
(
THD
*
thd
,
TABLE
*
table__
,
SELECT_LEX
*
sl
,
uchar
*
fieldtype
,
uchar
*
field_metadata
,
uchar
*
null_bits
,
const
int
num_null_bytes
,
const
uint
fields_count
)
uchar
*
field_metadata
,
uchar
*
null_bits
,
const
int
num_null_bytes
,
const
uint
fields_count
)
{
int
field_metadata_size
=
0
;
int
metadata_index
=
0
;
...
...
@@ -85,7 +86,6 @@ int get_field_types(THD *thd, TABLE *table__, SELECT_LEX *sl, uchar *fieldtype,
return
field_metadata_size
;
}
/*@brief create_xpand_select_handler- Creates handler*/
/************************************************************
* DESCRIPTION:
...
...
@@ -138,14 +138,15 @@ create_xpand_select_handler(THD* thd, SELECT_LEX* select_lex)
&
null_bits
,
num_null_bytes
,
&
field_metadata
,
(
items_number
*
2
),
NULL
);
if
(
!
meta_memory
)
{
// The only way to say something here is to raise warning
// b/c we will fallback to other access methods: derived handler or rowstore.
goto
err
;
// The only way to say something here is to raise warning
// b/c we will fallback to other access methods: derived handler or rowstore.
goto
err
;
}
if
((
field_metadata_size
=
get_field_types
(
thd
,
NULL
,
select_lex
,
fieldtype
,
field_metadata
,
null_bits
,
num_null_bytes
,
items_number
))
<
0
)
{
goto
err
;
get_field_types
(
thd
,
NULL
,
select_lex
,
fieldtype
,
field_metadata
,
null_bits
,
num_null_bytes
,
items_number
))
<
0
)
{
goto
err
;
}
trx
=
get_trx
(
thd
,
&
error_code
);
...
...
@@ -199,20 +200,20 @@ ha_xpand_select_handler::ha_xpand_select_handler(
**********************************************************/
ha_xpand_select_handler
::~
ha_xpand_select_handler
()
{
int
error_code
;
xpand_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
!
trx
)
{
// TBD Log this
}
if
(
trx
&&
scan
)
trx
->
scan_end
(
scan
);
int
error_code
;
xpand_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
!
trx
)
{
// TBD Log this
}
if
(
trx
&&
scan
)
trx
->
scan_end
(
scan
);
// If the ::init_scan has been executed
if
(
table__
)
my_bitmap_free
(
&
scan_fields
);
// If the ::init_scan has been executed
if
(
table__
)
my_bitmap_free
(
&
scan_fields
);
if
(
rgi
)
remove_current_table_from_rpl_table_list
(
rgi
);
if
(
rgi
)
remove_current_table_from_rpl_table_list
(
rgi
);
}
/*@brief Initiate the query for select_handler */
...
...
@@ -342,23 +343,20 @@ ha_xpand_derived_handler::ha_xpand_derived_handler(
**********************************************************/
ha_xpand_derived_handler
::~
ha_xpand_derived_handler
()
{
int
error_code
;
xpand_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
!
trx
)
{
// TBD Log this.
}
if
(
trx
&&
scan
)
trx
->
scan_end
(
scan
);
int
error_code
;
xpand_connection
*
trx
=
get_trx
(
thd
,
&
error_code
);
if
(
!
trx
)
{
// TBD Log this.
}
if
(
trx
&&
scan
)
trx
->
scan_end
(
scan
);
// If the ::init_scan has been executed
if
(
table__
)
my_bitmap_free
(
&
scan_fields
);
// If the ::init_scan has been executed
if
(
table__
)
my_bitmap_free
(
&
scan_fields
);
if
(
rgi
)
remove_current_table_from_rpl_table_list
(
rgi
);
if
(
rgi
)
remove_current_table_from_rpl_table_list
(
rgi
);
}
/*@brief Initiate the query for derived_handler */
...
...
@@ -395,7 +393,8 @@ int ha_xpand_derived_handler::init_scan()
}
if
((
field_metadata_size
=
get_field_types
(
thd__
,
table
,
select
,
fieldtype
,
field_metadata
,
null_bits
,
num_null_bytes
,
items_number
))
<
0
)
{
get_field_types
(
thd__
,
table
,
select
,
fieldtype
,
field_metadata
,
null_bits
,
num_null_bytes
,
items_number
))
<
0
)
{
goto
err
;
}
...
...
storage/xpand/ha_xpand_pushdown.h
View file @
ff60d07c
...
...
@@ -16,20 +16,20 @@ Copyright (c) 2019, MariaDB Corporation.
class
ha_xpand_base_handler
{
// To simulate abstract class
protected:
ha_xpand_base_handler
()
:
thd__
(
0
),
table__
(
0
)
{}
~
ha_xpand_base_handler
()
{}
protected:
ha_xpand_base_handler
()
:
thd__
(
0
),
table__
(
0
)
{}
~
ha_xpand_base_handler
()
{}
// Copies of pushdown handlers attributes
// to use them in shared methods.
THD
*
thd__
;
TABLE
*
table__
;
// The bitmap used to sent
MY_BITMAP
scan_fields
;
// Structures to unpack RBR rows from XPD BE
rpl_group_info
*
rgi
;
// XPD BE scan operation reference
xpand_connection_cursor
*
scan
;
// Copies of pushdown handlers attributes
// to use them in shared methods.
THD
*
thd__
;
TABLE
*
table__
;
// The bitmap used to sent
MY_BITMAP
scan_fields
;
// Structures to unpack RBR rows from XPD BE
rpl_group_info
*
rgi
;
// XPD BE scan operation reference
xpand_connection_cursor
*
scan
;
};
/*@brief select_handler class*/
...
...
@@ -44,15 +44,15 @@ class ha_xpand_select_handler:
private
ha_xpand_base_handler
,
public
select_handler
{
public:
ha_xpand_select_handler
(
THD
*
thd_arg
,
SELECT_LEX
*
sel
,
xpand_connection_cursor
*
scan
);
~
ha_xpand_select_handler
();
public:
ha_xpand_select_handler
(
THD
*
thd_arg
,
SELECT_LEX
*
sel
,
xpand_connection_cursor
*
scan
);
~
ha_xpand_select_handler
();
int
init_scan
();
int
next_row
();
int
end_scan
();
void
print_error
(
int
,
unsigned
long
)
{}
int
init_scan
();
int
next_row
();
int
end_scan
();
void
print_error
(
int
,
unsigned
long
)
{}
};
/*@brief derived_handler class*/
...
...
@@ -67,18 +67,17 @@ class ha_xpand_derived_handler:
private
ha_xpand_base_handler
,
public
derived_handler
{
public:
ha_xpand_derived_handler
(
THD
*
thd_arg
,
SELECT_LEX
*
sel
,
xpand_connection_cursor
*
scan
);
~
ha_xpand_derived_handler
();
public:
ha_xpand_derived_handler
(
THD
*
thd_arg
,
SELECT_LEX
*
sel
,
xpand_connection_cursor
*
scan
);
~
ha_xpand_derived_handler
();
int
init_scan
();
int
next_row
();
int
end_scan
();
void
print_error
(
int
,
unsigned
long
)
{}
int
init_scan
();
int
next_row
();
int
end_scan
();
void
print_error
(
int
,
unsigned
long
)
{}
};
select_handler
*
create_xpand_select_handler
(
THD
*
thd
,
SELECT_LEX
*
select_lex
);
derived_handler
*
create_xpand_derived_handler
(
THD
*
thd
,
TABLE_LIST
*
derived
);
...
...
storage/xpand/xpand_connection.cc
View file @
ff60d07c
...
...
@@ -240,8 +240,7 @@ int xpand_connection::send_command()
if
(
com_error
)
{
int
error_code
=
mysql_errno
(
&
xpand_net
);
my_printf_error
(
error_code
,
"Xpand error: %s"
,
MYF
(
0
),
my_printf_error
(
error_code
,
"Xpand error: %s"
,
MYF
(
0
),
mysql_error
(
&
xpand_net
));
return
error_code
;
}
...
...
@@ -256,8 +255,7 @@ int xpand_connection::read_query_response()
if
(
comerr
)
{
error_code
=
mysql_errno
(
&
xpand_net
);
my_printf_error
(
error_code
,
"Xpand error: %s"
,
MYF
(
0
),
my_printf_error
(
error_code
,
"Xpand error: %s"
,
MYF
(
0
),
mysql_error
(
&
xpand_net
));
}
...
...
@@ -375,9 +373,8 @@ int xpand_connection::run_query(String &stmt)
return
error_code
;
}
int
xpand_connection
::
write_row
(
ulonglong
xpand_table_oid
,
uchar
*
packed_row
,
size_t
packed_size
,
ulonglong
*
last_insert_id
)
int
xpand_connection
::
write_row
(
ulonglong
xpand_table_oid
,
uchar
*
packed_row
,
size_t
packed_size
,
ulonglong
*
last_insert_id
)
{
int
error_code
;
command_length
=
0
;
...
...
@@ -405,11 +402,10 @@ int xpand_connection::write_row(ulonglong xpand_table_oid,
return
error_code
;
}
int
xpand_connection
::
key_update
(
ulonglong
xpand_table_oid
,
uchar
*
packed_key
,
size_t
packed_key_length
,
MY_BITMAP
*
update_set
,
uchar
*
packed_new_data
,
size_t
packed_new_length
)
int
xpand_connection
::
key_update
(
ulonglong
xpand_table_oid
,
uchar
*
packed_key
,
size_t
packed_key_length
,
MY_BITMAP
*
update_set
,
uchar
*
packed_new_data
,
size_t
packed_new_length
)
{
int
error_code
;
command_length
=
0
;
...
...
@@ -444,7 +440,7 @@ int xpand_connection::key_update(ulonglong xpand_table_oid,
}
int
xpand_connection
::
key_delete
(
ulonglong
xpand_table_oid
,
uchar
*
packed_key
,
size_t
packed_key_length
)
uchar
*
packed_key
,
size_t
packed_key_length
)
{
int
error_code
;
command_length
=
0
;
...
...
@@ -665,8 +661,8 @@ int xpand_connection::allocate_cursor(MYSQL *xpand_net, ulong buffer_size,
bool
stmt_completed
=
FALSE
;
int
error_code
=
(
*
scan
)
->
initialize
(
&
stmt_completed
);
if
(
error_code
)
{
delete
*
scan
;
*
scan
=
NULL
;
delete
*
scan
;
*
scan
=
NULL
;
}
if
(
stmt_completed
)
...
...
@@ -746,7 +742,8 @@ int xpand_connection::scan_query(String &stmt, uchar *fieldtype, uint fields,
if
((
error_code
=
add_command_operand_str
(
fieldtype
,
fields
)))
return
error_code
;
if
((
error_code
=
add_command_operand_str
(
field_metadata
,
field_metadata_size
)))
if
((
error_code
=
add_command_operand_str
(
field_metadata
,
field_metadata_size
)))
return
error_code
;
// This variable length string calls for an additional store w/o lcb lenth prefix.
...
...
@@ -1129,7 +1126,7 @@ int xpand_connection::add_command_operand_str(const uchar *str,
return
error_code
;
if
(
!
str_length
)
return
0
;
return
0
;
error_code
=
expand_command_buffer
(
str_length
);
if
(
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