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
1e0152b4
Commit
1e0152b4
authored
Feb 21, 2020
by
Will DeVries
Committed by
Sergei Petrunia
Mar 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add table synchronization for select and derived handlers.
parent
4252df83
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
6 deletions
+60
-6
storage/xpand/ha_xpand.cc
storage/xpand/ha_xpand.cc
+36
-0
storage/xpand/ha_xpand.h
storage/xpand/ha_xpand.h
+3
-0
storage/xpand/ha_xpand_pushdown.cc
storage/xpand/ha_xpand_pushdown.cc
+12
-4
storage/xpand/xpand_connection.cc
storage/xpand/xpand_connection.cc
+8
-1
storage/xpand/xpand_connection.h
storage/xpand/xpand_connection.h
+1
-1
No files found.
storage/xpand/ha_xpand.cc
View file @
1e0152b4
...
...
@@ -473,6 +473,37 @@ xpand_mark_table_for_discovery(TABLE *table)
xs
->
xpand_table_oid
=
0
;
}
void
xpand_mark_tables_for_discovery
(
LEX
*
lex
)
{
for
(
TABLE_LIST
*
tbl
=
lex
->
query_tables
;
tbl
;
tbl
=
tbl
->
next_global
)
if
(
tbl
->
table
&&
tbl
->
table
->
file
->
ht
==
xpand_hton
)
xpand_mark_table_for_discovery
(
tbl
->
table
);
}
ulonglong
*
xpand_extract_table_oids
(
THD
*
thd
,
LEX
*
lex
)
{
int
cnt
=
1
;
for
(
TABLE_LIST
*
tbl
=
lex
->
query_tables
;
tbl
;
tbl
=
tbl
->
next_global
)
if
(
tbl
->
table
&&
tbl
->
table
->
file
->
ht
==
xpand_hton
)
cnt
++
;
ulonglong
*
oids
=
(
ulonglong
*
)
thd_alloc
(
thd
,
cnt
*
sizeof
(
ulonglong
));
ulonglong
*
ptr
=
oids
;
for
(
TABLE_LIST
*
tbl
=
lex
->
query_tables
;
tbl
;
tbl
=
tbl
->
next_global
)
{
if
(
tbl
->
table
&&
tbl
->
table
->
file
->
ht
==
xpand_hton
)
{
ha_xpand
*
hndlr
=
static_cast
<
ha_xpand
*>
(
tbl
->
table
->
file
);
*
ptr
++
=
hndlr
->
get_table_oid
();
}
}
*
ptr
=
0
;
return
oids
;
}
int
ha_xpand
::
open
(
const
char
*
name
,
int
mode
,
uint
test_if_locked
)
{
THD
*
thd
=
ha_thd
();
...
...
@@ -1190,6 +1221,11 @@ int ha_xpand::info_push(uint info_type, void *info)
return
0
;
}
ulonglong
ha_xpand
::
get_table_oid
()
{
return
xpand_table_oid
;
}
/****************************************************************************
** Row encoding functions
****************************************************************************/
...
...
storage/xpand/ha_xpand.h
View file @
1e0152b4
...
...
@@ -29,6 +29,8 @@ void remove_current_table_from_rpl_table_list(rpl_group_info *rgi);
int
unpack_row_to_buf
(
rpl_group_info
*
rgi
,
TABLE
*
table
,
uchar
*
data
,
uchar
const
*
const
row_data
,
MY_BITMAP
const
*
cols
,
uchar
const
*
const
row_end
);
void
xpand_mark_tables_for_discovery
(
LEX
*
lex
);
ulonglong
*
xpand_extract_table_oids
(
THD
*
thd
,
LEX
*
lex
);
class
Xpand_share
:
public
Handler_share
{
...
...
@@ -131,6 +133,7 @@ class ha_xpand : public handler
void
cond_pop
();
int
info_push
(
uint
info_type
,
void
*
info
);
ulonglong
get_table_oid
();
private:
void
build_key_packed_row
(
uint
index
,
const
uchar
*
buf
,
uchar
*
packed_key
,
size_t
*
packed_key_len
);
...
...
storage/xpand/ha_xpand_pushdown.cc
View file @
1e0152b4
...
...
@@ -101,6 +101,7 @@ int get_field_types(THD *thd, TABLE *table__, SELECT_LEX *sl, uchar *fieldtype,
select_handler
*
create_xpand_select_handler
(
THD
*
thd
,
SELECT_LEX
*
select_lex
)
{
ulonglong
*
oids
=
NULL
;
ha_xpand_select_handler
*
sh
=
NULL
;
if
(
!
select_handler_setting
(
thd
))
{
return
sh
;
...
...
@@ -156,20 +157,23 @@ create_xpand_select_handler(THD* thd, SELECT_LEX* select_lex)
if
(
!
thd_test_options
(
thd
,
OPTION_NOT_AUTOCOMMIT
|
OPTION_BEGIN
))
trx
->
auto_commit_next
();
oids
=
xpand_extract_table_oids
(
thd
,
select_lex
->
parent_lex
);
if
((
error_code
=
trx
->
scan_query
(
query
,
fieldtype
,
items_number
,
null_bits
,
num_null_bytes
,
field_metadata
,
field_metadata_size
,
row_buffer_setting
(
thd
),
&
scan
)))
{
row_buffer_setting
(
thd
),
oids
,
&
scan
)))
{
goto
err
;
}
sh
=
new
ha_xpand_select_handler
(
thd
,
select_lex
,
scan
);
err:
// deallocate buffers
if
(
meta_memory
)
my_free
(
meta_memory
);
if
(
error_code
==
HA_ERR_TABLE_DEF_CHANGED
)
xpand_mark_tables_for_discovery
(
select_lex
->
parent_lex
);
return
sh
;
}
...
...
@@ -376,6 +380,7 @@ int ha_xpand_derived_handler::init_scan()
int
error_code
=
0
;
int
field_metadata_size
=
0
;
xpand_connection
*
trx
=
NULL
;
ulonglong
*
oids
=
NULL
;
// We presume this number is equal to types.elements in get_field_types
uint
items_number
=
select
->
get_item_list
()
->
elements
;
...
...
@@ -402,10 +407,11 @@ int ha_xpand_derived_handler::init_scan()
if
(
!
trx
)
goto
err
;
oids
=
xpand_extract_table_oids
(
thd__
,
select
->
parent_lex
);
if
((
error_code
=
trx
->
scan_query
(
query
,
fieldtype
,
items_number
,
null_bits
,
num_null_bytes
,
field_metadata
,
field_metadata_size
,
row_buffer_setting
(
thd
),
&
scan
)))
{
row_buffer_setting
(
thd
),
oids
,
&
scan
)))
{
goto
err
;
}
...
...
@@ -420,10 +426,12 @@ int ha_xpand_derived_handler::init_scan()
add_current_table_to_rpl_table_list
(
&
rgi
,
thd__
,
table__
);
err:
// deallocate buffers
if
(
meta_memory
)
my_free
(
meta_memory
);
if
(
error_code
==
HA_ERR_TABLE_DEF_CHANGED
)
xpand_mark_tables_for_discovery
(
select
->
parent_lex
);
return
error_code
;
}
...
...
storage/xpand/xpand_connection.cc
View file @
1e0152b4
...
...
@@ -281,7 +281,7 @@ int xpand_connection::send_command()
committed or rolled back.
*/
trans_state
=
XPAND_TRANS_STARTED
;
com_error
=
simple_command
(
&
xpand_net
,
(
enum_server_command
)
XPAND_SERVER_REQUEST
,
command_buffer
,
command_length
,
TRUE
);
...
...
@@ -777,6 +777,7 @@ int xpand_connection::scan_query(String &stmt, uchar *fieldtype, uint fields,
uchar
*
null_bits
,
uint
null_bits_size
,
uchar
*
field_metadata
,
uint
field_metadata_size
,
ushort
row_req
,
ulonglong
*
oids
,
xpand_connection_cursor
**
scan
)
{
int
error_code
;
...
...
@@ -785,6 +786,12 @@ int xpand_connection::scan_query(String &stmt, uchar *fieldtype, uint fields,
if
((
error_code
=
begin_command
(
XPAND_SCAN_QUERY
)))
return
error_code
;
do
{
if
((
error_code
=
add_command_operand_ulonglong
(
*
oids
)))
return
error_code
;
}
while
(
*
oids
++
);
if
((
error_code
=
add_command_operand_ushort
(
row_req
)))
return
error_code
;
...
...
storage/xpand/xpand_connection.h
View file @
1e0152b4
...
...
@@ -89,7 +89,7 @@ class xpand_connection
xpand_connection_cursor
**
scan
);
int
scan_query
(
String
&
stmt
,
uchar
*
fieldtype
,
uint
fields
,
uchar
*
null_bits
,
uint
null_bits_size
,
uchar
*
field_metadata
,
uint
field_metadata_size
,
ushort
row_req
,
uint
field_metadata_size
,
ushort
row_req
,
ulonglong
*
oids
,
xpand_connection_cursor
**
scan
);
int
update_query
(
String
&
stmt
,
LEX_CSTRING
&
dbname
,
ulonglong
*
affected_rows
);
int
scan_from_key
(
ulonglong
xpand_table_oid
,
uint
index
,
...
...
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