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
17810b75
Commit
17810b75
authored
Oct 13, 2023
by
Yuchen Pei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '10.10' into 10.11
parents
034848c6
3b38c2f3
Changes
69
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
69 changed files
with
1388 additions
and
776 deletions
+1388
-776
extra/mariabackup/xtrabackup.cc
extra/mariabackup/xtrabackup.cc
+6
-2
mysql-test/suite/mariabackup/data_directory.result
mysql-test/suite/mariabackup/data_directory.result
+6
-0
mysql-test/suite/mariabackup/data_directory.test
mysql-test/suite/mariabackup/data_directory.test
+15
-0
mysql-test/suite/parts/r/alter_table.result
mysql-test/suite/parts/r/alter_table.result
+14
-0
mysql-test/suite/parts/t/alter_table.test
mysql-test/suite/parts/t/alter_table.test
+18
-0
sql/handler.cc
sql/handler.cc
+1
-0
sql/sql_alter.cc
sql/sql_alter.cc
+8
-0
storage/innobase/fil/fil0fil.cc
storage/innobase/fil/fil0fil.cc
+3
-2
storage/innobase/include/log0log.h
storage/innobase/include/log0log.h
+18
-5
storage/innobase/include/log0recv.h
storage/innobase/include/log0recv.h
+3
-2
storage/innobase/log/log0log.cc
storage/innobase/log/log0log.cc
+52
-11
storage/innobase/log/log0recv.cc
storage/innobase/log/log0recv.cc
+23
-7
storage/innobase/srv/srv0start.cc
storage/innobase/srv/srv0start.cc
+9
-3
storage/spider/mysql-test/spider/bugfix/r/index.result
storage/spider/mysql-test/spider/bugfix/r/index.result
+0
-37
storage/spider/mysql-test/spider/bugfix/r/mdev_22979.result
storage/spider/mysql-test/spider/bugfix/r/mdev_22979.result
+5
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_26247.result
storage/spider/mysql-test/spider/bugfix/r/mdev_26247.result
+96
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_27233.result
storage/spider/mysql-test/spider/bugfix/r/mdev_27233.result
+11
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result
storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result
+1
-1
storage/spider/mysql-test/spider/bugfix/r/mdev_28218.result
storage/spider/mysql-test/spider/bugfix/r/mdev_28218.result
+9
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_28218_init_file.result
...er/mysql-test/spider/bugfix/r/mdev_28218_init_file.result
+5
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_28218_mixed.result
...spider/mysql-test/spider/bugfix/r/mdev_28218_mixed.result
+5
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_28998.result
storage/spider/mysql-test/spider/bugfix/r/mdev_28998.result
+26
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result
storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result
+26
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result
storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result
+4
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result
storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result
+25
-0
storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result
storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result
+28
-0
storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result
...der/mysql-test/spider/bugfix/r/plugin_load_add_all.result
+7
-0
storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_spider.result
.../mysql-test/spider/bugfix/r/plugin_load_add_spider.result
+7
-0
storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early.result
...er/mysql-test/spider/bugfix/r/udf_mysql_func_early.result
+43
-0
storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early_init_file.result
...est/spider/bugfix/r/udf_mysql_func_early_init_file.result
+1
-0
storage/spider/mysql-test/spider/bugfix/t/index.test
storage/spider/mysql-test/spider/bugfix/t/index.test
+8
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_22979.test
storage/spider/mysql-test/spider/bugfix/t/mdev_22979.test
+18
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_26247.cnf
storage/spider/mysql-test/spider/bugfix/t/mdev_26247.cnf
+3
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_26247.test
storage/spider/mysql-test/spider/bugfix/t/mdev_26247.test
+85
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.opt
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.opt
+1
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.sql
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.sql
+3
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.test
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.test
+7
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test
storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test
+2
-1
storage/spider/mysql-test/spider/bugfix/t/mdev_28218.test
storage/spider/mysql-test/spider/bugfix/t/mdev_28218.test
+10
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.opt
...pider/mysql-test/spider/bugfix/t/mdev_28218_init_file.opt
+1
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.sql
...pider/mysql-test/spider/bugfix/t/mdev_28218_init_file.sql
+2
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.test
...ider/mysql-test/spider/bugfix/t/mdev_28218_init_file.test
+7
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.opt
...ge/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.opt
+2
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.sql
...ge/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.sql
+1
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.test
...e/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.test
+8
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_28998.test
storage/spider/mysql-test/spider/bugfix/t/mdev_28998.test
+39
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test
storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test
+36
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test
storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test
+7
-4
storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test
storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test
+32
-0
storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test
storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test
+35
-0
storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.opt
...spider/mysql-test/spider/bugfix/t/plugin_load_add_all.opt
+1
-0
storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test
...pider/mysql-test/spider/bugfix/t/plugin_load_add_all.test
+7
-0
storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.opt
...der/mysql-test/spider/bugfix/t/plugin_load_add_spider.opt
+1
-0
storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.test
...er/mysql-test/spider/bugfix/t/plugin_load_add_spider.test
+7
-0
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.cnf
...pider/mysql-test/spider/bugfix/t/udf_mysql_func_early.cnf
+3
-0
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.opt
...pider/mysql-test/spider/bugfix/t/udf_mysql_func_early.opt
+1
-0
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.test
...ider/mysql-test/spider/bugfix/t/udf_mysql_func_early.test
+48
-0
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.cnf
...l-test/spider/bugfix/t/udf_mysql_func_early_init_file.cnf
+3
-0
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.opt
...l-test/spider/bugfix/t/udf_mysql_func_early_init_file.opt
+1
-0
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.sql
...l-test/spider/bugfix/t/udf_mysql_func_early_init_file.sql
+1
-0
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.test
...-test/spider/bugfix/t/udf_mysql_func_early_init_file.test
+4
-0
storage/spider/mysql-test/spider/include/deinit_spider.inc
storage/spider/mysql-test/spider/include/deinit_spider.inc
+0
-1
storage/spider/mysql-test/spider/include/init_spider.inc
storage/spider/mysql-test/spider/include/init_spider.inc
+2
-2
storage/spider/spd_group_by_handler.cc
storage/spider/spd_group_by_handler.cc
+3
-0
storage/spider/spd_include.h
storage/spider/spd_include.h
+0
-1
storage/spider/spd_init_query.h
storage/spider/spd_init_query.h
+456
-614
storage/spider/spd_param.cc
storage/spider/spd_param.cc
+12
-0
storage/spider/spd_param.h
storage/spider/spd_param.h
+1
-0
storage/spider/spd_table.cc
storage/spider/spd_table.cc
+55
-83
No files found.
extra/mariabackup/xtrabackup.cc
View file @
17810b75
...
...
@@ -4669,7 +4669,9 @@ static bool xtrabackup_backup_func()
goto
fail
;
}
log_sys
.
create
();
if
(
!
log_sys
.
create
())
{
goto
fail
;
}
/* get current checkpoint_lsn */
{
mysql_mutex_lock
(
&
recv_sys
.
mutex
);
...
...
@@ -6039,7 +6041,9 @@ static bool xtrabackup_prepare_func(char** argv)
}
recv_sys
.
create
();
log_sys
.
create
();
if
(
!
log_sys
.
create
())
{
goto
error
;
}
recv_sys
.
recovery_on
=
true
;
xb_fil_io_init
();
...
...
mysql-test/suite/mariabackup/data_directory.result
View file @
17810b75
...
...
@@ -11,3 +11,9 @@ SELECT * FROM t;
a
1
DROP TABLE t;
#
# MDEV-18200 MariaBackup full backup failed with InnoDB: Failing assertion: success
#
#
# End of 10.4 tests
#
mysql-test/suite/mariabackup/data_directory.test
View file @
17810b75
...
...
@@ -21,4 +21,19 @@ rmdir $table_data_dir;
SELECT
*
FROM
t
;
DROP
TABLE
t
;
rmdir
$targetdir
;
--
echo
#
--
echo
# MDEV-18200 MariaBackup full backup failed with InnoDB: Failing assertion: success
--
echo
#
let
$DATADIR
=
`select @@datadir`
;
chmod
0000
$DATADIR
/
ibdata1
;
--
disable_result_log
--
error
1
exec
$XTRABACKUP
--
defaults
-
file
=
$MYSQLTEST_VARDIR
/
my
.
cnf
--
backup
--
target
-
dir
=
$targetdir
;
--
enable_result_log
chmod
0755
$DATADIR
/
ibdata1
;
rmdir
$table_data_dir
;
rmdir
$targetdir
;
--
echo
#
--
echo
# End of 10.4 tests
--
echo
#
mysql-test/suite/parts/r/alter_table.result
View file @
17810b75
...
...
@@ -344,3 +344,17 @@ connection default;
drop database EXISTENT;
drop user alan;
drop tables t1, tp1, tp2, tp4;
#
# MDEV-31014 Database privileges are insufficient for CONVERT TABLE TO PARTITION
#
create database db;
create user u@localhost;
grant all on db.* to u@localhost;
connect con1,localhost,u,,db;
create table t1 (a int) partition by range(a) (p1 values less than (100), p2 values less than (1000));
alter table t1 convert partition p2 to table tp;
alter table t1 convert table tp to partition p2 values less than (1000);
disconnect con1;
connection default;
drop user u@localhost;
drop database db;
mysql-test/suite/parts/t/alter_table.test
View file @
17810b75
...
...
@@ -301,3 +301,21 @@ alter table t1 convert partition p1 to table tp1;
drop
database
EXISTENT
;
drop
user
alan
;
drop
tables
t1
,
tp1
,
tp2
,
tp4
;
--
echo
#
--
echo
# MDEV-31014 Database privileges are insufficient for CONVERT TABLE TO PARTITION
--
echo
#
create
database
db
;
create
user
u
@
localhost
;
grant
all
on
db
.*
to
u
@
localhost
;
--
connect
(
con1
,
localhost
,
u
,,
db
)
create
table
t1
(
a
int
)
partition
by
range
(
a
)
(
p1
values
less
than
(
100
),
p2
values
less
than
(
1000
));
alter
table
t1
convert
partition
p2
to
table
tp
;
alter
table
t1
convert
table
tp
to
partition
p2
values
less
than
(
1000
);
# Cleanup
--
disconnect
con1
--
connection
default
drop
user
u
@
localhost
;
drop
database
db
;
sql/handler.cc
View file @
17810b75
...
...
@@ -1804,6 +1804,7 @@ int ha_commit_trans(THD *thd, bool all)
(
void
)
trans_rollback_stmt
(
thd
);
goto
err
;
}
trt
.
table
->
file
->
extra
(
HA_EXTRA_RESET_STATE
);
// Here, the call will not commit inside InnoDB. It is only working
// around closing thd->transaction.stmt open by TR_table::open().
if
(
all
)
...
...
sql/sql_alter.cc
View file @
17810b75
...
...
@@ -493,6 +493,14 @@ bool Sql_cmd_alter_table::execute(THD *thd)
0
,
0
))
DBUG_RETURN
(
TRUE
);
/* purecov: inspected */
if
((
alter_info
.
partition_flags
&
ALTER_PARTITION_CONVERT_IN
))
{
TABLE_LIST
*
tl
=
first_table
->
next_local
;
tl
->
grant
.
privilege
=
first_table
->
grant
.
privilege
;
tl
->
grant
.
m_internal
=
first_table
->
grant
.
m_internal
;
}
/* If it is a merge table, check privileges for merge children. */
if
(
create_info
.
merge_list
)
{
...
...
storage/innobase/fil/fil0fil.cc
View file @
17810b75
...
...
@@ -334,6 +334,7 @@ fil_node_t* fil_space_t::add(const char* name, pfs_os_file_t handle,
return
node
;
}
__attribute__
((
warn_unused_result
,
nonnull
))
/** Open a tablespace file.
@param node data file
@return whether the file was successfully opened */
...
...
@@ -362,9 +363,9 @@ static bool fil_node_open_file_low(fil_node_t *node)
:
OS_FILE_OPEN
|
OS_FILE_ON_ERROR_NO_EXIT
,
OS_FILE_AIO
,
type
,
srv_read_only_mode
,
&
success
);
if
(
node
->
is_open
())
if
(
success
&&
node
->
is_open
())
{
ut_ad
(
success
);
#ifndef _WIN32
if
(
!
node
->
space
->
id
&&
!
srv_read_only_mode
&&
my_disable_locking
&&
os_file_lock
(
node
->
handle
,
node
->
name
))
...
...
storage/innobase/include/log0log.h
View file @
17810b75
...
...
@@ -356,6 +356,24 @@ typedef srw_lock log_rwlock_t;
/** @return end of resize_buf */
inline
const
byte
*
resize_buf_end
()
const
noexcept
{
return
resize_buf
+
resize_target
;
}
/** Initialise the redo log subsystem. */
void
create_low
();
/** Initialise the redo log subsystem.
@return whether the initialisation succeeded */
bool
create
()
{
create_low
();
return
true
;
}
/** Attach a log file.
@return whether the memory allocation succeeded */
bool
attach
(
log_file_t
file
,
os_offset_t
size
);
#else
/** Initialise the redo log subsystem.
@return whether the initialisation succeeded */
bool
create
();
/** Attach a log file. */
void
attach_low
(
log_file_t
file
,
os_offset_t
size
);
bool
attach
(
log_file_t
file
,
os_offset_t
size
)
{
attach_low
(
file
,
size
);
return
true
;
}
#endif
#if defined __linux__ || defined _WIN32
...
...
@@ -363,8 +381,6 @@ typedef srw_lock log_rwlock_t;
void
set_buffered
(
bool
buffered
);
#endif
void
attach
(
log_file_t
file
,
os_offset_t
size
);
void
close_file
();
/** Calculate the checkpoint safety margins. */
...
...
@@ -421,9 +437,6 @@ typedef srw_lock log_rwlock_t;
/** Make previous write_buf() durable and update flushed_to_disk_lsn. */
bool
flush
(
lsn_t
lsn
)
noexcept
;
/** Initialise the redo log subsystem. */
void
create
();
/** Shut down the redo log subsystem. */
void
close
();
...
...
storage/innobase/include/log0recv.h
View file @
17810b75
...
...
@@ -254,9 +254,10 @@ struct recv_sys_t
/** The contents of the doublewrite buffer */
recv_dblwr_t
dblwr
;
inline
void
read
(
os_offset_t
offset
,
span
<
byte
>
buf
);
__attribute__
((
warn_unused_result
))
inline
dberr_t
read
(
os_offset_t
offset
,
span
<
byte
>
buf
);
inline
size_t
files_size
();
void
close_files
()
{
files
.
clear
();
files
.
shrink_to_fit
();
}
void
close_files
()
;
/** Advance pages_it if it matches the iterator */
void
pages_it_invalidate
(
const
map
::
iterator
&
p
)
...
...
storage/innobase/log/log0log.cc
View file @
17810b75
...
...
@@ -95,15 +95,15 @@ void log_t::set_capacity()
log_sys
.
max_checkpoint_age
=
margin
;
}
/** Initialize the redo log subsystem. */
void
log_t
::
create
()
#ifdef HAVE_PMEM
void
log_t
::
create_low
()
#else
bool
log_t
::
create
()
#endif
{
ut_ad
(
this
==
&
log_sys
);
ut_ad
(
!
is_initialised
());
latch
.
SRW_LOCK_INIT
(
log_latch_key
);
init_lsn_lock
();
/* LSN 0 and 1 are reserved; @see buf_page_t::oldest_modification_ */
lsn
.
store
(
FIRST_LSN
,
std
::
memory_order_relaxed
);
flushed_to_disk_lsn
.
store
(
FIRST_LSN
,
std
::
memory_order_relaxed
);
...
...
@@ -111,9 +111,23 @@ void log_t::create()
#ifndef HAVE_PMEM
buf
=
static_cast
<
byte
*>
(
ut_malloc_dontdump
(
buf_size
,
PSI_INSTRUMENT_ME
));
TRASH_ALLOC
(
buf
,
buf_size
);
if
(
!
buf
)
{
alloc_fail:
sql_print_error
(
"InnoDB: Cannot allocate memory;"
" too large innodb_log_buffer_size?"
);
return
false
;
}
flush_buf
=
static_cast
<
byte
*>
(
ut_malloc_dontdump
(
buf_size
,
PSI_INSTRUMENT_ME
));
if
(
!
flush_buf
)
{
ut_free_dodump
(
buf
,
buf_size
);
buf
=
nullptr
;
goto
alloc_fail
;
}
TRASH_ALLOC
(
buf
,
buf_size
);
TRASH_ALLOC
(
flush_buf
,
buf_size
);
checkpoint_buf
=
static_cast
<
byte
*>
(
aligned_malloc
(
4096
,
4096
));
memset_aligned
<
4096
>
(
checkpoint_buf
,
0
,
4096
);
...
...
@@ -123,6 +137,9 @@ void log_t::create()
ut_ad
(
!
flush_buf
);
#endif
latch
.
SRW_LOCK_INIT
(
log_latch_key
);
init_lsn_lock
();
max_buf_free
=
buf_size
/
LOG_BUF_FLUSH_RATIO
-
LOG_BUF_FLUSH_MARGIN
;
set_check_flush_or_checkpoint
();
...
...
@@ -136,6 +153,9 @@ void log_t::create()
buf_free
=
0
;
ut_ad
(
is_initialised
());
#ifndef HAVE_PMEM
return
true
;
#endif
}
dberr_t
log_file_t
::
close
()
noexcept
...
...
@@ -149,6 +169,7 @@ dberr_t log_file_t::close() noexcept
return
DB_SUCCESS
;
}
__attribute__
((
warn_unused_result
))
dberr_t
log_file_t
::
read
(
os_offset_t
offset
,
span
<
byte
>
buf
)
noexcept
{
ut_ad
(
is_opened
());
...
...
@@ -201,7 +222,11 @@ static void *log_mmap(os_file_t file, os_offset_t size)
}
#endif
void
log_t
::
attach
(
log_file_t
file
,
os_offset_t
size
)
#ifdef HAVE_PMEM
bool
log_t
::
attach
(
log_file_t
file
,
os_offset_t
size
)
#else
void
log_t
::
attach_low
(
log_file_t
file
,
os_offset_t
size
)
#endif
{
log
=
file
;
ut_ad
(
!
size
||
size
>=
START_OFFSET
+
SIZE_OF_FILE_CHECKPOINT
);
...
...
@@ -218,18 +243,33 @@ void log_t::attach(log_file_t file, os_offset_t size)
log
.
close
();
mprotect
(
ptr
,
size_t
(
size
),
PROT_READ
);
buf
=
static_cast
<
byte
*>
(
ptr
);
#if defined __linux__ || defined _WIN32
#
if defined __linux__ || defined _WIN32
set_block_size
(
CPU_LEVEL1_DCACHE_LINESIZE
);
#endif
#
endif
log_maybe_unbuffered
=
true
;
log_buffered
=
false
;
return
;
return
true
;
}
}
buf
=
static_cast
<
byte
*>
(
ut_malloc_dontdump
(
buf_size
,
PSI_INSTRUMENT_ME
));
TRASH_ALLOC
(
buf
,
buf_size
);
if
(
!
buf
)
{
alloc_fail:
max_buf_free
=
0
;
sql_print_error
(
"InnoDB: Cannot allocate memory;"
" too large innodb_log_buffer_size?"
);
return
false
;
}
flush_buf
=
static_cast
<
byte
*>
(
ut_malloc_dontdump
(
buf_size
,
PSI_INSTRUMENT_ME
));
if
(
!
flush_buf
)
{
ut_free_dodump
(
buf
,
buf_size
);
buf
=
nullptr
;
goto
alloc_fail
;
}
TRASH_ALLOC
(
buf
,
buf_size
);
TRASH_ALLOC
(
flush_buf
,
buf_size
);
#endif
...
...
@@ -244,6 +284,7 @@ void log_t::attach(log_file_t file, os_offset_t size)
#ifdef HAVE_PMEM
checkpoint_buf
=
static_cast
<
byte
*>
(
aligned_malloc
(
block_size
,
block_size
));
memset_aligned
<
64
>
(
checkpoint_buf
,
0
,
block_size
);
return
true
;
#endif
}
...
...
storage/innobase/log/log0recv.cc
View file @
17810b75
...
...
@@ -1201,12 +1201,13 @@ inline void recv_sys_t::trim(const page_id_t page_id, lsn_t lsn)
DBUG_VOID_RETURN
;
}
inline
void
recv_sys_t
::
read
(
os_offset_t
total_offset
,
span
<
byte
>
buf
)
inline
dberr_t
recv_sys_t
::
read
(
os_offset_t
total_offset
,
span
<
byte
>
buf
)
{
size_t
file_idx
=
static_cast
<
size_t
>
(
total_offset
/
log_sys
.
file_size
);
os_offset_t
offset
=
total_offset
%
log_sys
.
file_size
;
dberr_t
err
=
recv_sys
.
files
[
file_idx
].
read
(
offset
,
buf
);
ut_a
(
err
==
DB_SUCCESS
);
return
file_idx
?
recv_sys
.
files
[
file_idx
].
read
(
offset
,
buf
)
:
log_sys
.
log
.
read
(
offset
,
buf
);
}
inline
size_t
recv_sys_t
::
files_size
()
...
...
@@ -1365,6 +1366,15 @@ static void fil_name_process(const char *name, ulint len, uint32_t space_id,
}
}
void
recv_sys_t
::
close_files
()
{
for
(
auto
&
file
:
files
)
if
(
file
.
is_opened
())
file
.
close
();
files
.
clear
();
files
.
shrink_to_fit
();
}
/** Clean up after recv_sys_t::create() */
void
recv_sys_t
::
close
()
{
...
...
@@ -1601,7 +1611,8 @@ ATTRIBUTE_COLD static dberr_t recv_log_recover_pre_10_2()
if
(
source_offset
<
(
log_sys
.
is_pmem
()
?
log_sys
.
file_size
:
4096
))
memcpy_aligned
<
512
>
(
buf
,
&
log_sys
.
buf
[
source_offset
&
~
511
],
512
);
else
recv_sys
.
read
(
source_offset
&
~
511
,
{
buf
,
512
});
if
(
dberr_t
err
=
recv_sys
.
read
(
source_offset
&
~
511
,
{
buf
,
512
}))
return
err
;
if
(
log_block_calc_checksum_format_0
(
buf
)
!=
mach_read_from_4
(
my_assume_aligned
<
4
>
(
buf
+
508
))
&&
...
...
@@ -1640,7 +1651,8 @@ static dberr_t recv_log_recover_10_5(lsn_t lsn_offset)
memcpy_aligned
<
512
>
(
buf
,
&
log_sys
.
buf
[
lsn_offset
&
~
511
],
512
);
else
{
recv_sys
.
read
(
lsn_offset
&
~
lsn_t
{
4095
},
{
buf
,
4096
});
if
(
dberr_t
err
=
recv_sys
.
read
(
lsn_offset
&
~
lsn_t
{
4095
},
{
buf
,
4096
}))
return
err
;
buf
+=
lsn_offset
&
0xe00
;
}
...
...
@@ -1691,13 +1703,17 @@ dberr_t recv_sys_t::find_checkpoint()
else
if
(
size
<
log_t
::
START_OFFSET
+
SIZE_OF_FILE_CHECKPOINT
)
{
too_small:
os_file_close
(
file
);
sql_print_error
(
"InnoDB: File %.*s is too small"
,
int
(
path
.
size
()),
path
.
data
());
err_exit:
os_file_close
(
file
);
return
DB_ERROR
;
}
else
if
(
!
log_sys
.
attach
(
file
,
size
))
goto
err_exit
;
else
file
=
OS_FILE_CLOSED
;
log_sys
.
attach
(
file
,
size
);
recv_sys
.
files
.
emplace_back
(
file
);
for
(
int
i
=
1
;
i
<
101
;
i
++
)
{
...
...
storage/innobase/srv/srv0start.cc
View file @
17810b75
...
...
@@ -216,14 +216,17 @@ static dberr_t create_log_file(bool create_new_db, lsn_t lsn)
ret
=
os_file_set_size
(
logfile0
.
c_str
(),
file
,
srv_log_file_size
);
if
(
!
ret
)
{
os_file_close_func
(
file
);
ib
::
error
()
<<
"Cannot set log file "
<<
logfile0
<<
" size to "
<<
ib
::
bytes_iec
{
srv_log_file_size
};
close_and_exit:
os_file_close_func
(
file
);
goto
err_exit
;
}
log_sys
.
set_latest_format
(
srv_encrypt_log
);
log_sys
.
attach
(
file
,
srv_log_file_size
);
if
(
!
log_sys
.
attach
(
file
,
srv_log_file_size
))
{
goto
close_and_exit
;
}
if
(
!
fil_system
.
sys_space
->
open
(
create_new_db
))
{
goto
err_exit
;
}
...
...
@@ -1290,7 +1293,10 @@ dberr_t srv_start(bool create_new_db)
}
#endif
/* UNIV_DEBUG */
log_sys
.
create
();
if
(
!
log_sys
.
create
())
{
return
srv_init_abort
(
DB_ERROR
);
}
recv_sys
.
create
();
lock_sys
.
create
(
srv_lock_table_size
);
...
...
storage/spider/mysql-test/spider/bugfix/r/index.result
View file @
17810b75
for master_1
connect master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK;
connection master_1;
CALL mtr.add_suppression("unknown variable");
SET SESSION sql_log_bin= 0;
INSTALL PLUGIN spider SONAME 'ha_spider';
CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
HOST 'localhost',
DATABASE 'auto_test_local',
USER 'root',
PASSWORD '',
SOCKET '$MASTER_1_MYSOCK'
);
SET spider_internal_sql_log_off= 0;
SET spider_direct_order_limit= 10000;
SET spider_init_sql_alloc_size= 1;
Warnings:
Warning 1287 '@@spider_init_sql_alloc_size' is deprecated and will be removed in a future release
for child2
for child3
create database auto_test_local;
...
...
@@ -70,25 +53,5 @@ a b
drop table ts, auto_test_local.t;
drop database auto_test_local;
for master_1
connection master_1;
DROP FUNCTION spider_flush_table_mon_cache;
DROP FUNCTION spider_copy_tables;
DROP FUNCTION spider_ping_table;
DROP FUNCTION spider_bg_direct_sql;
DROP FUNCTION spider_direct_sql;
UNINSTALL SONAME IF EXISTS "ha_spider";
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
DROP TABLE IF EXISTS mysql.spider_xa;
DROP TABLE IF EXISTS mysql.spider_xa_member;
DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
DROP TABLE IF EXISTS mysql.spider_tables;
DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
DROP TABLE IF EXISTS mysql.spider_link_failed_log;
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
DROP TABLE IF EXISTS mysql.spider_table_sts;
DROP TABLE IF EXISTS mysql.spider_table_crd;
DROP SERVER s_1;
disconnect master_1;
for child2
for child3
storage/spider/mysql-test/spider/bugfix/r/mdev_22979.result
0 → 100644
View file @
17810b75
MDEV-22979 "mysqld --bootstrap" / mysql_install_db hangs when Spider is installed
# Kill the server
# restart
Warnings:
Note 1305 SONAME ha_spider.so does not exist
storage/spider/mysql-test/spider/bugfix/r/mdev_26247.result
0 → 100644
View file @
17810b75
#
# MDEV-26247 Spider: Valid LEFT JOIN results in ERROR 1064
#
for master_1
for child2
child2_1
child2_2
child2_3
for child3
connection child2_1;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
CREATE TABLE t1 (
a11 int,
primary key (a11)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t2 (
a21 int,
a22 int,
primary key (a21, a22)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE t3 (
a31 int,
a32 int,
primary key (a31, a32)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES (1), (2), (3);
INSERT INTO t2 VALUES (1, 11), (2, 22), (3, 33);
INSERT INTO t3 VALUES (1, 111), (2, 222), (3, 333);
connection master_1;
set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
set spider_disable_group_by_handler=1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
CREATE TABLE t1 (
a11 int,
primary key (a11)
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='srv "s_2_1", table "t1"';
CREATE TABLE t2 (
a21 int,
a22 int,
primary key (a21, a22)
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='srv "s_2_1", table "t2"';
CREATE TABLE t3 (
a31 int,
a32 int,
primary key (a31, a32)
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='srv "s_2_1", table "t3"';
SELECT a22 FROM t1 LEFT JOIN t2 ON a11 = a21 WHERE a11 IN (1);
a22
11
SELECT a22 FROM t1 LEFT JOIN t2 ON a11 = a21 - a21 WHERE a11 IN (1);
a22
NULL
SELECT a22 FROM t2 RIGHT JOIN t1 ON a21 = a11 WHERE a11 IN (1);
a22
11
SELECT a22 FROM t2 RIGHT JOIN t1 ON a21 = a11 WHERE a11 IN (1,2);
a22
11
22
SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 RIGHT JOIN t3 on a21 = a31 WHERE a11 IN (1);
a22 a32
11 111
SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 - a21 RIGHT JOIN t3 on a21 = a31 - a31 WHERE a11 IN (1);
a22 a32
SELECT a22, a32 FROM t1 LEFT JOIN t2 ON a11 = a21 RIGHT JOIN t3 on a21 = a31 WHERE a11 IN (1,2);
a22 a32
11 111
22 222
SELECT a22 FROM t2 LEFT JOIN t1 ON a11 = a21 WHERE a11 IN (1);
a22
11
SELECT a22 FROM t2 LEFT JOIN t1 ON a11 = a21 - a21 WHERE a11 IN (1);
a22
SELECT a22 FROM t1 RIGHT JOIN t2 ON a21 = a11 WHERE a11 IN (1);
a22
11
SELECT a22 FROM t1 RIGHT JOIN t2 ON a21 = a11 WHERE a11 IN (1,2);
a22
11
22
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
for master_1
for child2
child2_1
child2_2
child2_3
for child3
#
# end of test mdev_26247
#
storage/spider/mysql-test/spider/bugfix/r/mdev_27233.result
0 → 100644
View file @
17810b75
#
# MDEV-27233 Server hangs when using --init-file which loads Spider and creates a Spider table
#
show create table t;
Table Create Table
t CREATE TABLE `t` (
`c` int(11) DEFAULT NULL
) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
Warnings:
Error 1429 Unable to connect to foreign data source: localhost
Error 1429 Unable to connect to foreign data source: localhost
storage/spider/mysql-test/spider/bugfix/r/mdev_27240.result
View file @
17810b75
...
...
@@ -9,7 +9,7 @@ ERROR 42S22: Unknown column 'a.z' in 'field list'
ALTER TABLE tbl_a CHANGE c c INT;
ERROR 42S22: Unknown column 'c' in 'tbl_a'
LOCK TABLE tbl_a READ;
ERROR HY000: Unable to connect to foreign data source: localhost
Got one of the listed errors
DROP DATABASE auto_test_local;
for master_1
for child2
...
...
storage/spider/mysql-test/spider/bugfix/r/mdev_28218.result
0 → 100644
View file @
17810b75
#
# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
#
INSTALL SONAME 'ha_spider.so';
DROP TABLE IF EXISTS mysql.spider_tables;
show create table mysql.spider_tables;
ERROR 42S02: Table 'mysql.spider_tables' doesn't exist
Warnings:
Note 1051 Unknown table 'mysql.spider_tables'
storage/spider/mysql-test/spider/bugfix/r/mdev_28218_init_file.result
0 → 100644
View file @
17810b75
#
# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
#
show create table mysql.spider_tables;
ERROR 42S02: Table 'mysql.spider_tables' doesn't exist
storage/spider/mysql-test/spider/bugfix/r/mdev_28218_mixed.result
0 → 100644
View file @
17810b75
#
# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
#
show create table mysql.spider_tables;
ERROR 42S02: Table 'mysql.spider_tables' doesn't exist
storage/spider/mysql-test/spider/bugfix/r/mdev_28998.result
0 → 100644
View file @
17810b75
#
# MDEV-28998 ASAN errors in spider_fields::free_conn_holder or spider_create_group_by_handler
#
for master_1
for child2
for child3
set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
set spider_disable_group_by_handler=1;
CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t1_SPIDER (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't1'";
CREATE TABLE t2 AS SELECT a FROM t1_SPIDER;
SELECT * FROM t2;
a
1
2
DROP TABLE t2, t1_SPIDER, t1;
drop server s;
set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
for master_1
for child2
for child3
#
# end of test mdev_28998
#
storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result
0 → 100644
View file @
17810b75
#
# MDEV-29163 Server crash with SIGSEGV or dynamic-stack-buffer-overflow in spider_db_mbase_util::append_table
#
for master_1
for child2
for child3
set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
set spider_disable_group_by_handler=1;
CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);
CREATE TABLE t3 (c INT, PRIMARY KEY(c));
CREATE TABLE t1_spider (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't1'";
CREATE TABLE t2_spider (b INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't2'";
CREATE TABLE t3_spider (c INT, PRIMARY KEY(c)) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't3'";
SELECT t1_spider.* FROM t1_spider LEFT JOIN t2_spider LEFT JOIN t3_spider ON b = c ON a = b;
a
DROP TABLE t1_spider, t2_spider, t3_spider, t1, t2, t3;
drop server s;
set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
for master_1
for child2
for child3
#
# end of test mdev_29163
#
storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result
View file @
17810b75
#
# MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so
#
# Kill the server
# restart
Warnings:
Note 1305 SONAME ha_spider.so does not exist
storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result
0 → 100644
View file @
17810b75
#
# MDEV-30392 Syntax error upon query with subquery from Spider table
#
for master_1
for child2
for child3
set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
set spider_disable_group_by_handler=1;
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 'srv', table 't1'";
SELECT a FROM t2 WHERE a IN ( SELECT a FROM t2 );
a
1
2
DROP TABLE t1, t2;
DROP SERVER srv;
set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
for master_1
for child2
for child3
#
# end of test mdev_30392
#
storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result
0 → 100644
View file @
17810b75
#
# MDEV-31645 Spider doesn't recognize semi JOIN
#
for master_1
for child2
for child3
set @old_spider_disable_group_by_handler=@@spider_disable_group_by_handler;
set spider_disable_group_by_handler=1;
CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a));
CREATE TABLE t2 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)) ENGINE=SPIDER COMMENT='srv "srv", WRAPPER "mysql", TABLE "t1"';
SET SESSION optimizer_switch='semijoin=off';
SELECT * FROM t2
WHERE A BETWEEN 0 AND 10 AND B IN(SELECT B FROM t2 WHERE A BETWEEN 11 AND 20);
a b
SET SESSION optimizer_switch='semijoin=on';
SELECT * FROM t2
WHERE A BETWEEN 0 AND 10 AND B IN(SELECT B FROM t2 WHERE A BETWEEN 11 AND 20);
a b
drop table t1, t2;
drop server srv;
set spider_disable_group_by_handler=@old_spider_disable_group_by_handler;
for master_1
for child2
for child3
#
# end of test mdev_31645
#
storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_all.result
0 → 100644
View file @
17810b75
#
# plugin-load-add=ha_spider
#
select * from mysql.plugin;
name dl
create table t (c int) Engine=SPIDER;
drop table t;
storage/spider/mysql-test/spider/bugfix/r/plugin_load_add_spider.result
0 → 100644
View file @
17810b75
#
# plugin-load-add=ha_spider
#
select * from mysql.plugin;
name dl
create table t (c int) Engine=SPIDER;
drop table t;
storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early.result
0 → 100644
View file @
17810b75
#
# Test that udf created by inserting into mysql_func works as expected
#
CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
HOST 'localhost',
DATABASE 'auto_test_local',
USER 'root',
PASSWORD '',
SOCKET '$MASTER_1_MYSOCK'
);
CREATE SERVER s_2_1 FOREIGN DATA WRAPPER mysql OPTIONS (
HOST 'localhost',
DATABASE 'auto_test_remote',
USER 'root',
PASSWORD '',
SOCKET '$CHILD2_1_MYSOCK'
);
connect master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK;
connect child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK;
connection child2_1;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
CREATE TABLE tbl_a (
a INT
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into tbl_a values (42);
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
CREATE TABLE tbl_a (
a INT
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
create temporary table results (a int);
SELECT SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"');
SPIDER_DIRECT_SQL('select * from tbl_a', 'results', 'srv "s_2_1", database "auto_test_remote"')
1
select * from results;
a
42
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
storage/spider/mysql-test/spider/bugfix/r/udf_mysql_func_early_init_file.result
0 → 120000
View file @
17810b75
udf_mysql_func_early.result
\ No newline at end of file
storage/spider/mysql-test/spider/bugfix/t/index.test
View file @
17810b75
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
create
database
auto_test_local
;
set
spider_same_server_link
=
on
;
...
...
@@ -42,4 +46,8 @@ select a, b from ts where a > 0 and b = 'g' order by a;
drop
table
ts
,
auto_test_local
.
t
;
drop
database
auto_test_local
;
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_deinit
.
inc
--
enable_query_log
--
enable_result_log
storage/spider/mysql-test/spider/bugfix/t/mdev_22979.test
0 → 100644
View file @
17810b75
--
echo
MDEV
-
22979
"mysqld --bootstrap"
/
mysql_install_db
hangs
when
Spider
is
installed
# This test is not the most faithful, as it does not have any
# dependency problems on the existence of the `mysql` database. To
# test MDEV-22979 faithfully, a mysql_install_db invocation with
# --plugin-load-add=ha_spider should be run. We cannot run it in mtr
# because we do not have access to --srcdir.
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
let
$PLUGIN_DIR
=
`select @@plugin_dir`
;
--
source
include
/
kill_mysqld
.
inc
--
write_file
$MYSQLTEST_VARDIR
/
tmp
/
mdev_22979
.
sql
drop
table
if
exists
foo
.
bar
;
EOF
--
exec
$MYSQLD_CMD
--
datadir
=
$MYSQLD_DATADIR
--
bootstrap
--
plugin
-
dir
=
$PLUGIN_DIR
--
plugin
-
load
-
add
=
ha_spider
<
$MYSQLTEST_VARDIR
/
tmp
/
mdev_22979
.
sql
--
source
include
/
start_mysqld
.
inc
--
disable_query_log
--
source
../../
include
/
clean_up_spider
.
inc
storage/spider/mysql-test/spider/bugfix/t/mdev_26247.cnf
0 → 100644
View file @
17810b75
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
storage/spider/mysql-test/spider/bugfix/t/mdev_26247.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-26247 Spider: Valid LEFT JOIN results in ERROR 1064
--
echo
#
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
--
connection
child2_1
CREATE
DATABASE
auto_test_remote
;
USE
auto_test_remote
;
eval
CREATE
TABLE
t1
(
a11
int
,
primary
key
(
a11
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
eval
CREATE
TABLE
t2
(
a21
int
,
a22
int
,
primary
key
(
a21
,
a22
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
eval
CREATE
TABLE
t3
(
a31
int
,
a32
int
,
primary
key
(
a31
,
a32
)
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
);
INSERT
INTO
t2
VALUES
(
1
,
11
),
(
2
,
22
),
(
3
,
33
);
INSERT
INTO
t3
VALUES
(
1
,
111
),
(
2
,
222
),
(
3
,
333
);
--
connection
master_1
#FIXME: this is a workaround.
set
@
old_spider_disable_group_by_handler
=@@
spider_disable_group_by_handler
;
set
spider_disable_group_by_handler
=
1
;
CREATE
DATABASE
auto_test_local
;
USE
auto_test_local
;
eval
CREATE
TABLE
t1
(
a11
int
,
primary
key
(
a11
)
)
$MASTER_1_ENGINE
$MASTER_1_CHARSET
COMMENT
=
'srv "s_2_1", table "t1"'
;
eval
CREATE
TABLE
t2
(
a21
int
,
a22
int
,
primary
key
(
a21
,
a22
)
)
$MASTER_1_ENGINE
$MASTER_1_CHARSET
COMMENT
=
'srv "s_2_1", table "t2"'
;
eval
CREATE
TABLE
t3
(
a31
int
,
a32
int
,
primary
key
(
a31
,
a32
)
)
$MASTER_1_ENGINE
$MASTER_1_CHARSET
COMMENT
=
'srv "s_2_1", table "t3"'
;
SELECT
a22
FROM
t1
LEFT
JOIN
t2
ON
a11
=
a21
WHERE
a11
IN
(
1
);
SELECT
a22
FROM
t1
LEFT
JOIN
t2
ON
a11
=
a21
-
a21
WHERE
a11
IN
(
1
);
SELECT
a22
FROM
t2
RIGHT
JOIN
t1
ON
a21
=
a11
WHERE
a11
IN
(
1
);
SELECT
a22
FROM
t2
RIGHT
JOIN
t1
ON
a21
=
a11
WHERE
a11
IN
(
1
,
2
);
SELECT
a22
,
a32
FROM
t1
LEFT
JOIN
t2
ON
a11
=
a21
RIGHT
JOIN
t3
on
a21
=
a31
WHERE
a11
IN
(
1
);
SELECT
a22
,
a32
FROM
t1
LEFT
JOIN
t2
ON
a11
=
a21
-
a21
RIGHT
JOIN
t3
on
a21
=
a31
-
a31
WHERE
a11
IN
(
1
);
SELECT
a22
,
a32
FROM
t1
LEFT
JOIN
t2
ON
a11
=
a21
RIGHT
JOIN
t3
on
a21
=
a31
WHERE
a11
IN
(
1
,
2
);
SELECT
a22
FROM
t2
LEFT
JOIN
t1
ON
a11
=
a21
WHERE
a11
IN
(
1
);
SELECT
a22
FROM
t2
LEFT
JOIN
t1
ON
a11
=
a21
-
a21
WHERE
a11
IN
(
1
);
SELECT
a22
FROM
t1
RIGHT
JOIN
t2
ON
a21
=
a11
WHERE
a11
IN
(
1
);
SELECT
a22
FROM
t1
RIGHT
JOIN
t2
ON
a21
=
a11
WHERE
a11
IN
(
1
,
2
);
--
connection
master_1
DROP
DATABASE
IF
EXISTS
auto_test_local
;
set
spider_disable_group_by_handler
=@
old_spider_disable_group_by_handler
;
--
connection
child2_1
DROP
DATABASE
IF
EXISTS
auto_test_remote
;
--
disable_query_log
--
disable_result_log
--
source
../
t
/
test_deinit
.
inc
--
enable_query_log
--
enable_result_log
--
echo
#
--
echo
# end of test mdev_26247
--
echo
#
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.opt
0 → 100644
View file @
17810b75
--init-file=$MYSQL_TEST_DIR/../storage/spider/mysql-test/spider/bugfix/t/mdev_27233.sql
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.sql
0 → 100644
View file @
17810b75
INSTALL
SONAME
'ha_spider.so'
;
USE
test
;
CREATE
TABLE
t
(
c
INT
)
ENGINE
=
SPIDER
;
storage/spider/mysql-test/spider/bugfix/t/mdev_27233.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-27233 Server hangs when using --init-file which loads Spider and creates a Spider table
--
echo
#
# ps protocol eats warnings
--
disable_ps_protocol
show
create
table
t
;
--
enable_ps_protocol
storage/spider/mysql-test/spider/bugfix/t/mdev_27240.test
View file @
17810b75
...
...
@@ -14,7 +14,8 @@ CREATE TABLE tbl_a (a INT KEY) ENGINE=SPIDER;
SELECT
a
.
z
FROM
tbl_a
AS
a
,
tbl_a
b
WHERE
a
.
z
=
b
.
z
;
--
error
ER_BAD_FIELD_ERROR
ALTER
TABLE
tbl_a
CHANGE
c
c
INT
;
--
error
ER_CONNECT_TO_FOREIGN_DATA_SOURCE
# FIXME: MDEV-32046
--
error
ER_CONNECT_TO_FOREIGN_DATA_SOURCE
,
ER_NET_READ_ERROR
LOCK
TABLE
tbl_a
READ
;
DROP
DATABASE
auto_test_local
;
...
...
storage/spider/mysql-test/spider/bugfix/t/mdev_28218.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
--
echo
#
INSTALL
SONAME
'ha_spider.so'
;
DROP
TABLE
IF
EXISTS
mysql
.
spider_tables
;
--
error
ER_NO_SUCH_TABLE
show
create
table
mysql
.
spider_tables
;
--
disable_query_log
--
source
../../
include
/
clean_up_spider
.
inc
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.opt
0 → 100644
View file @
17810b75
--init-file=$MYSQL_TEST_DIR/../storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.sql
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.sql
0 → 100644
View file @
17810b75
INSTALL
PLUGIN
spider
SONAME
'ha_spider.so'
;
DROP
TABLE
IF
EXISTS
mysql
.
spider_tables
;
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_init_file.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
--
echo
#
# This is a variant of the testcase in MDEV-28218, where we put the
# queries are in an init file
--
error
ER_NO_SUCH_TABLE
show
create
table
mysql
.
spider_tables
;
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.opt
0 → 100644
View file @
17810b75
--plugin-load-add=ha_spider
--init-file=$MYSQL_TEST_DIR/../storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.sql
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.sql
0 → 100644
View file @
17810b75
DROP
TABLE
IF
EXISTS
mysql
.
spider_tables
;
storage/spider/mysql-test/spider/bugfix/t/mdev_28218_mixed.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-28218 Spider: thread hang/deadlock as result of INSTALL PLUGIN and DROP TABLE
--
echo
#
# this is a variant of the testcase in MDEV-28218, where we load
# spider early with --plugin_load_add, and execute the drop table
# query in an init file
--
error
ER_NO_SUCH_TABLE
show
create
table
mysql
.
spider_tables
;
storage/spider/mysql-test/spider/bugfix/t/mdev_28998.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-28998 ASAN errors in spider_fields::free_conn_holder or spider_create_group_by_handler
--
echo
#
if
(
`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "%ASAN%"`
)
{
--
skip
test
needs
to
be
run
with
ASAN
}
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
# FIXME: this is a workaround.
set
@
old_spider_disable_group_by_handler
=@@
spider_disable_group_by_handler
;
set
spider_disable_group_by_handler
=
1
;
evalp
CREATE
SERVER
s
FOREIGN
DATA
WRAPPER
MYSQL
OPTIONS
(
SOCKET
"
$MASTER_1_MYSOCK
"
,
DATABASE
'test'
,
user
'root'
);
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
);
CREATE
TABLE
t1_SPIDER
(
a
INT
)
ENGINE
=
SPIDER
COMMENT
=
"wrapper 'mysql', srv 's', table 't1'"
;
CREATE
TABLE
t2
AS
SELECT
a
FROM
t1_SPIDER
;
SELECT
*
FROM
t2
;
# Cleanup
DROP
TABLE
t2
,
t1_SPIDER
,
t1
;
drop
server
s
;
set
spider_disable_group_by_handler
=@
old_spider_disable_group_by_handler
;
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_deinit
.
inc
--
enable_result_log
--
enable_query_log
--
echo
#
--
echo
# end of test mdev_28998
--
echo
#
storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-29163 Server crash with SIGSEGV or dynamic-stack-buffer-overflow in spider_db_mbase_util::append_table
--
echo
#
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
#FIXME: this is a workaround.
set
@
old_spider_disable_group_by_handler
=@@
spider_disable_group_by_handler
;
set
spider_disable_group_by_handler
=
1
;
evalp
CREATE
SERVER
s
FOREIGN
DATA
WRAPPER
MYSQL
OPTIONS
(
SOCKET
"
$MASTER_1_MYSOCK
"
,
DATABASE
'test'
,
user
'root'
);
CREATE
TABLE
t1
(
a
INT
);
CREATE
TABLE
t2
(
b
INT
);
CREATE
TABLE
t3
(
c
INT
,
PRIMARY
KEY
(
c
));
CREATE
TABLE
t1_spider
(
a
INT
)
ENGINE
=
SPIDER
COMMENT
=
"wrapper 'mysql', srv 's', table 't1'"
;
CREATE
TABLE
t2_spider
(
b
INT
)
ENGINE
=
SPIDER
COMMENT
=
"wrapper 'mysql', srv 's', table 't2'"
;
CREATE
TABLE
t3_spider
(
c
INT
,
PRIMARY
KEY
(
c
))
ENGINE
=
SPIDER
COMMENT
=
"wrapper 'mysql', srv 's', table 't3'"
;
SELECT
t1_spider
.*
FROM
t1_spider
LEFT
JOIN
t2_spider
LEFT
JOIN
t3_spider
ON
b
=
c
ON
a
=
b
;
# Cleanup
DROP
TABLE
t1_spider
,
t2_spider
,
t3_spider
,
t1
,
t2
,
t3
;
drop
server
s
;
set
spider_disable_group_by_handler
=@
old_spider_disable_group_by_handler
;
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_deinit
.
inc
--
enable_result_log
--
enable_query_log
--
echo
#
--
echo
# end of test mdev_29163
--
echo
#
storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test
View file @
17810b75
...
...
@@ -3,7 +3,10 @@
--
echo
# MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so
--
echo
#
let
$MYSQLD_DATADIR
=
$MYSQLTEST_VARDIR
/
mdev_30370
;
--
mkdir
$MYSQLD_DATADIR
--
exec
$MYSQLD_BOOTSTRAP_CMD
--
wsrep
-
recover
--
plugin
-
load
-
add
=
ha_spider
.
so
--
datadir
=
$MYSQLD_DATADIR
--
rmdir
$MYSQLD_DATADIR
let
$MYSQLD_DATADIR
=
`select @@datadir`
;
let
$PLUGIN_DIR
=
`select @@plugin_dir`
;
--
source
include
/
kill_mysqld
.
inc
--
exec
$MYSQLD_CMD
--
datadir
=
$MYSQLD_DATADIR
--
wsrep
-
recover
--
plugin
-
dir
=
$PLUGIN_DIR
--
plugin
-
load
-
add
=
ha_spider
--
source
include
/
start_mysqld
.
inc
--
disable_query_log
--
source
../../
include
/
clean_up_spider
.
inc
storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-30392 Syntax error upon query with subquery from Spider table
--
echo
#
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
set
@
old_spider_disable_group_by_handler
=@@
spider_disable_group_by_handler
;
set
spider_disable_group_by_handler
=
1
;
evalp
CREATE
SERVER
srv
FOREIGN
DATA
WRAPPER
MYSQL
OPTIONS
(
SOCKET
"
$MASTER_1_MYSOCK
"
,
DATABASE
'test'
,
user
'root'
);
CREATE
TABLE
t1
(
a
INT
);
INSERT
INTO
t1
VALUES
(
1
),(
2
);
CREATE
TABLE
t2
(
a
INT
)
ENGINE
=
SPIDER
COMMENT
=
"wrapper 'mysql', srv 'srv', table 't1'"
;
SELECT
a
FROM
t2
WHERE
a
IN
(
SELECT
a
FROM
t2
);
# Cleanup
DROP
TABLE
t1
,
t2
;
DROP
SERVER
srv
;
set
spider_disable_group_by_handler
=@
old_spider_disable_group_by_handler
;
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_deinit
.
inc
--
enable_result_log
--
enable_query_log
--
echo
#
--
echo
# end of test mdev_30392
--
echo
#
storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# MDEV-31645 Spider doesn't recognize semi JOIN
--
echo
#
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_init
.
inc
--
enable_result_log
--
enable_query_log
set
@
old_spider_disable_group_by_handler
=@@
spider_disable_group_by_handler
;
set
spider_disable_group_by_handler
=
1
;
evalp
CREATE
SERVER
srv
FOREIGN
DATA
WRAPPER
MYSQL
OPTIONS
(
SOCKET
"
$MASTER_1_MYSOCK
"
,
DATABASE
'test'
,
user
'root'
);
CREATE
TABLE
t1
(
a
bigint
(
20
)
NOT
NULL
,
b
bigint
(
20
)
DEFAULT
0
,
PRIMARY
KEY
(
a
));
CREATE
TABLE
t2
(
a
bigint
(
20
)
NOT
NULL
,
b
bigint
(
20
)
DEFAULT
0
,
PRIMARY
KEY
(
a
))
ENGINE
=
SPIDER
COMMENT
=
'srv "srv", WRAPPER "mysql", TABLE "t1"'
;
SET
SESSION
optimizer_switch
=
'semijoin=off'
;
SELECT
*
FROM
t2
WHERE
A
BETWEEN
0
AND
10
AND
B
IN
(
SELECT
B
FROM
t2
WHERE
A
BETWEEN
11
AND
20
);
SET
SESSION
optimizer_switch
=
'semijoin=on'
;
SELECT
*
FROM
t2
WHERE
A
BETWEEN
0
AND
10
AND
B
IN
(
SELECT
B
FROM
t2
WHERE
A
BETWEEN
11
AND
20
);
drop
table
t1
,
t2
;
drop
server
srv
;
set
spider_disable_group_by_handler
=@
old_spider_disable_group_by_handler
;
--
disable_query_log
--
disable_result_log
--
source
../../
t
/
test_deinit
.
inc
--
enable_result_log
--
enable_query_log
--
echo
#
--
echo
# end of test mdev_31645
--
echo
#
storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.opt
0 → 100644
View file @
17810b75
--plugin-load-add=ha_spider
storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_all.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# plugin-load-add=ha_spider
--
echo
#
# A simple test that tests plugin-load-add=ha_spider
select
*
from
mysql
.
plugin
;
create
table
t
(
c
int
)
Engine
=
SPIDER
;
drop
table
t
;
storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.opt
0 → 100644
View file @
17810b75
--plugin-load-add=SPIDER=ha_spider
storage/spider/mysql-test/spider/bugfix/t/plugin_load_add_spider.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# plugin-load-add=ha_spider
--
echo
#
# A simple test that tests plugin-load-add=SPIDER=ha_spider
select
*
from
mysql
.
plugin
;
create
table
t
(
c
int
)
Engine
=
SPIDER
;
drop
table
t
;
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.cnf
0 → 100644
View file @
17810b75
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.opt
0 → 100644
View file @
17810b75
--plugin-load-add=ha_spider
\ No newline at end of file
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early.test
0 → 100644
View file @
17810b75
--
echo
#
--
echo
# Test that udf created by inserting into mysql_func works as expected
--
echo
#
evalp
CREATE
SERVER
s_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
DATABASE
'auto_test_local'
,
USER
'root'
,
PASSWORD
''
,
SOCKET
'$MASTER_1_MYSOCK'
);
evalp
CREATE
SERVER
s_2_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
HOST
'localhost'
,
DATABASE
'auto_test_remote'
,
USER
'root'
,
PASSWORD
''
,
SOCKET
'$CHILD2_1_MYSOCK'
);
--
connect
(
master_1
,
localhost
,
root
,
,
,
$MASTER_1_MYPORT
,
$MASTER_1_MYSOCK
)
--
connect
(
child2_1
,
localhost
,
root
,
,
,
$CHILD2_1_MYPORT
,
$CHILD2_1_MYSOCK
)
--
connection
child2_1
CREATE
DATABASE
auto_test_remote
;
USE
auto_test_remote
;
eval
CREATE
TABLE
tbl_a
(
a
INT
)
$CHILD2_1_ENGINE
$CHILD2_1_CHARSET
;
insert
into
tbl_a
values
(
42
);
--
connection
master_1
CREATE
DATABASE
auto_test_local
;
USE
auto_test_local
;
eval
CREATE
TABLE
tbl_a
(
a
INT
)
$MASTER_1_ENGINE
$MASTER_1_CHARSET
COMMENT
=
'table "tbl_a", srv "s_2_1"'
;
create
temporary
table
results
(
a
int
);
--
disable_ps_protocol
SELECT
SPIDER_DIRECT_SQL
(
'select * from tbl_a'
,
'results'
,
'srv "s_2_1", database "auto_test_remote"'
);
--
enable_ps_protocol
select
*
from
results
;
--
connection
master_1
DROP
DATABASE
IF
EXISTS
auto_test_local
;
--
connection
child2_1
DROP
DATABASE
IF
EXISTS
auto_test_remote
;
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.cnf
0 → 100644
View file @
17810b75
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.opt
0 → 100644
View file @
17810b75
--init-file=$MYSQL_TEST_DIR/../storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.sql
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.sql
0 → 100644
View file @
17810b75
install
soname
"ha_spider.so"
;
storage/spider/mysql-test/spider/bugfix/t/udf_mysql_func_early_init_file.test
0 → 100644
View file @
17810b75
# Same as udf_mysql_func_early.test, except that we load spider in
# init_file, which is after udf_init() and before
# mysqld_server_started is on.
--
source
udf_mysql_func_early
.
test
storage/spider/mysql-test/spider/include/deinit_spider.inc
View file @
17810b75
...
...
@@ -20,7 +20,6 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
if
(
$HAS_REWRITE
)
{
DROP
FUNCTION
spider_flush_rewrite_cache
;
UNINSTALL
PLUGIN
spider_rewrite
;
DROP
TABLE
IF
EXISTS
mysql
.
spider_rewrite_tables
;
DROP
TABLE
IF
EXISTS
mysql
.
spider_rewrite_table_tables
;
DROP
TABLE
IF
EXISTS
mysql
.
spider_rewrite_table_partitions
;
...
...
storage/spider/mysql-test/spider/include/init_spider.inc
View file @
17810b75
...
...
@@ -2,7 +2,7 @@ let $VERSION_COMPILE_OS_WIN=
`SELECT IF(@@version_compile_os like 'Win%', 1, 0)`
;
if
(
$VERSION_COMPILE_OS_WIN
)
{
INSTALL
PLUGIN
spider
SONAME
'ha_spider'
;
INSTALL
SONAME
'ha_spider'
;
if
(
$MASTER_1_MYPORT
)
{
evalp
CREATE
SERVER
s_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
...
...
@@ -76,7 +76,7 @@ if ($VERSION_COMPILE_OS_WIN)
}
if
(
!
$VERSION_COMPILE_OS_WIN
)
{
INSTALL
PLUGIN
spider
SONAME
'ha_spider'
;
INSTALL
SONAME
'ha_spider'
;
if
(
$MASTER_1_MYSOCK
)
{
evalp
CREATE
SERVER
s_1
FOREIGN
DATA
WRAPPER
mysql
OPTIONS
(
...
...
storage/spider/spd_group_by_handler.cc
View file @
17810b75
...
...
@@ -1612,6 +1612,9 @@ group_by_handler *spider_create_group_by_handler(
long
tgt_link_status
;
DBUG_ENTER
(
"spider_create_group_by_handler"
);
if
(
spider_param_disable_group_by_handler
(
thd
))
DBUG_RETURN
(
NULL
);
switch
(
thd_sql_command
(
thd
))
{
case
SQLCOM_UPDATE
:
...
...
storage/spider/spd_include.h
View file @
17810b75
...
...
@@ -196,7 +196,6 @@ typedef struct st_spider_thread
volatile
bool
killed
;
volatile
bool
thd_wait
;
volatile
bool
first_free_wait
;
volatile
bool
init_command
;
volatile
int
error
;
pthread_t
thread
;
pthread_cond_t
cond
;
...
...
storage/spider/spd_init_query.h
View file @
17810b75
This diff is collapsed.
Click to expand it.
storage/spider/spd_param.cc
View file @
17810b75
...
...
@@ -2351,6 +2351,17 @@ static MYSQL_THDVAR_INT(
SPIDER_THDVAR_OVERRIDE_VALUE_FUNC
(
int
,
strict_group_by
)
static
MYSQL_THDVAR_BOOL
(
disable_group_by_handler
,
/* name */
PLUGIN_VAR_OPCMDARG
,
/* opt */
"Disables the group by handler"
,
/* comment */
NULL
,
/* check */
NULL
,
/* update */
FALSE
/* def */
);
SPIDER_THDVAR_VALUE_FUNC
(
bool
,
disable_group_by_handler
)
static
struct
st_mysql_storage_engine
spider_storage_engine
=
{
MYSQL_HANDLERTON_INTERFACE_VERSION
};
...
...
@@ -2465,6 +2476,7 @@ static struct st_mysql_sys_var* spider_system_variables[] = {
MYSQL_SYSVAR
(
wait_timeout
),
MYSQL_SYSVAR
(
sync_sql_mode
),
MYSQL_SYSVAR
(
strict_group_by
),
MYSQL_SYSVAR
(
disable_group_by_handler
),
NULL
};
...
...
storage/spider/spd_param.h
View file @
17810b75
...
...
@@ -366,3 +366,4 @@ int spider_param_strict_group_by(
THD
*
thd
,
int
strict_group_by
);
bool
spider_param_disable_group_by_handler
(
THD
*
thd
);
storage/spider/spd_table.cc
View file @
17810b75
...
...
@@ -117,9 +117,6 @@ const char **spd_mysqld_unix_port;
uint
*
spd_mysqld_port
;
bool
volatile
*
spd_abort_loop
;
Time_zone
*
spd_tz_system
;
static
int
*
spd_mysqld_server_started
;
static
pthread_mutex_t
*
spd_LOCK_server_started
;
static
pthread_cond_t
*
spd_COND_server_started
;
extern
long
spider_conn_mutex_id
;
handlerton
*
spider_hton_ptr
;
SPIDER_DBTON
spider_dbton
[
SPIDER_DBTON_SIZE
];
...
...
@@ -6124,28 +6121,6 @@ handler* spider_create_handler(
MEM_ROOT
*
mem_root
)
{
DBUG_ENTER
(
"spider_create_handler"
);
SPIDER_THREAD
*
thread
=
&
spider_table_sts_threads
[
0
];
if
(
unlikely
(
thread
->
init_command
))
{
THD
*
thd
=
current_thd
;
pthread_cond_t
*
cond
=
thd
->
mysys_var
->
current_cond
;
pthread_mutex_t
*
mutex
=
thd
->
mysys_var
->
current_mutex
;
/* wait for finishing init_command */
pthread_mutex_lock
(
&
thread
->
mutex
);
if
(
unlikely
(
thread
->
init_command
))
{
thd
->
mysys_var
->
current_cond
=
&
thread
->
sync_cond
;
thd
->
mysys_var
->
current_mutex
=
&
thread
->
mutex
;
pthread_cond_wait
(
&
thread
->
sync_cond
,
&
thread
->
mutex
);
}
pthread_mutex_unlock
(
&
thread
->
mutex
);
thd
->
mysys_var
->
current_cond
=
cond
;
thd
->
mysys_var
->
current_mutex
=
mutex
;
if
(
thd
->
killed
)
{
DBUG_RETURN
(
NULL
);
}
}
DBUG_RETURN
(
new
(
mem_root
)
ha_spider
(
hton
,
table
));
}
...
...
@@ -6399,6 +6374,50 @@ int spider_panic(
DBUG_RETURN
(
0
);
}
/*
Create or fix the system tables. See spd_init_query.h for the details.
*/
bool
spider_init_system_tables
()
{
DBUG_ENTER
(
"spider_init_system_tables"
);
MYSQL
*
mysql
=
mysql_init
(
NULL
);
if
(
!
mysql
)
{
DBUG_RETURN
(
TRUE
);
}
if
(
!
mysql_real_connect_local
(
mysql
))
{
mysql_close
(
mysql
);
DBUG_RETURN
(
TRUE
);
}
const
int
size
=
sizeof
(
spider_init_queries
)
/
sizeof
(
spider_init_queries
[
0
]);
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
const
LEX_STRING
*
query
=
&
spider_init_queries
[
i
];
if
(
mysql_real_query
(
mysql
,
query
->
str
,
query
->
length
))
{
fprintf
(
stderr
,
"[ERROR] SPIDER plugin initialization failed at '%s' by '%s'
\n
"
,
query
->
str
,
mysql_error
(
mysql
));
mysql_close
(
mysql
);
DBUG_RETURN
(
TRUE
);
}
if
(
MYSQL_RES
*
res
=
mysql_store_result
(
mysql
))
{
mysql_free_result
(
res
);
}
}
mysql_close
(
mysql
);
DBUG_RETURN
(
FALSE
);
}
int
spider_db_init
(
void
*
p
)
{
...
...
@@ -6407,6 +6426,11 @@ int spider_db_init(
uchar
addr
[
6
];
handlerton
*
spider_hton
=
(
handlerton
*
)
p
;
DBUG_ENTER
(
"spider_db_init"
);
const
LEX_CSTRING
aria_name
=
{
STRING_WITH_LEN
(
"Aria"
)};
if
(
!
plugin_is_ready
(
&
aria_name
,
MYSQL_STORAGE_ENGINE_PLUGIN
))
DBUG_RETURN
(
HA_ERR_RETRY_INIT
);
spider_hton_ptr
=
spider_hton
;
spider_hton
->
flags
=
HTON_TEMPORARY_NOT_SUPPORTED
;
...
...
@@ -6472,9 +6496,6 @@ int spider_db_init(
spd_mysqld_port
=
&
mysqld_port
;
spd_abort_loop
=
&
abort_loop
;
spd_tz_system
=
my_tz_SYSTEM
;
spd_mysqld_server_started
=
&
mysqld_server_started
;
spd_LOCK_server_started
=
&
LOCK_server_started
;
spd_COND_server_started
=
&
COND_server_started
;
#ifdef HAVE_PSI_INTERFACE
init_spider_psi_keys
();
...
...
@@ -6652,6 +6673,11 @@ int spider_db_init(
spider_udf_table_mon_list_hash
[
roop_count
].
array
.
size_of_element
);
}
if
(
spider_init_system_tables
())
{
goto
error_system_table_creation
;
}
if
(
!
(
spider_table_sts_threads
=
(
SPIDER_THREAD
*
)
spider_bulk_malloc
(
NULL
,
256
,
MYF
(
MY_WME
|
MY_ZEROFILL
),
&
spider_table_sts_threads
,
(
uint
)
(
sizeof
(
SPIDER_THREAD
)
*
...
...
@@ -6661,7 +6687,6 @@ int spider_db_init(
NullS
))
)
goto
error_alloc_mon_mutxes
;
spider_table_sts_threads
[
0
].
init_command
=
TRUE
;
for
(
roop_count
=
0
;
roop_count
<
(
int
)
spider_param_table_sts_thread_count
();
...
...
@@ -6737,6 +6762,7 @@ int spider_db_init(
error_init_udf_table_mon_cond:
for
(;
roop_count
>=
0
;
roop_count
--
)
pthread_cond_destroy
(
&
spider_udf_table_mon_conds
[
roop_count
]);
error_system_table_creation:
roop_count
=
spider_udf_table_mon_mutex_count
-
1
;
error_init_udf_table_mon_mutex:
for
(;
roop_count
>=
0
;
roop_count
--
)
...
...
@@ -8814,7 +8840,6 @@ void spider_free_sts_threads(
)
{
bool
thread_killed
;
DBUG_ENTER
(
"spider_free_sts_threads"
);
spider_thread
->
init_command
=
FALSE
;
pthread_mutex_lock
(
&
spider_thread
->
mutex
);
thread_killed
=
spider_thread
->
killed
;
spider_thread
->
killed
=
TRUE
;
...
...
@@ -8946,59 +8971,6 @@ void *spider_table_bg_sts_action(
trx
->
thd
=
thd
;
/* init end */
if
(
thread
->
init_command
)
{
uint
i
=
0
;
tmp_disable_binlog
(
thd
);
thd
->
security_ctx
->
skip_grants
();
thd
->
client_capabilities
|=
CLIENT_MULTI_RESULTS
;
if
(
!
(
*
spd_mysqld_server_started
)
&&
!
thd
->
killed
&&
!
thread
->
killed
)
{
pthread_mutex_lock
(
spd_LOCK_server_started
);
thd
->
mysys_var
->
current_cond
=
spd_COND_server_started
;
thd
->
mysys_var
->
current_mutex
=
spd_LOCK_server_started
;
if
(
!
(
*
spd_mysqld_server_started
)
&&
!
thd
->
killed
&&
!
thread
->
killed
&&
thread
->
init_command
)
{
do
{
struct
timespec
abstime
;
set_timespec_nsec
(
abstime
,
1000
);
error_num
=
pthread_cond_timedwait
(
spd_COND_server_started
,
spd_LOCK_server_started
,
&
abstime
);
}
while
(
(
error_num
==
ETIMEDOUT
||
error_num
==
ETIME
)
&&
!
(
*
spd_mysqld_server_started
)
&&
!
thd
->
killed
&&
!
thread
->
killed
&&
thread
->
init_command
);
}
pthread_mutex_unlock
(
spd_LOCK_server_started
);
thd
->
mysys_var
->
current_cond
=
&
thread
->
cond
;
thd
->
mysys_var
->
current_mutex
=
&
thread
->
mutex
;
}
bool
spd_wsrep_on
=
thd
->
variables
.
wsrep_on
;
thd
->
variables
.
wsrep_on
=
false
;
while
(
spider_init_queries
[
i
].
length
&&
!
thd
->
killed
&&
!
thread
->
killed
&&
thread
->
init_command
)
{
dispatch_command
(
COM_QUERY
,
thd
,
spider_init_queries
[
i
].
str
,
(
uint
)
spider_init_queries
[
i
].
length
);
if
(
unlikely
(
thd
->
is_error
()))
{
fprintf
(
stderr
,
"[ERROR] %s
\n
"
,
spider_stmt_da_message
(
thd
));
thd
->
clear_error
();
break
;
}
++
i
;
}
thd
->
variables
.
wsrep_on
=
spd_wsrep_on
;
thd
->
mysys_var
->
current_cond
=
&
thread
->
cond
;
thd
->
mysys_var
->
current_mutex
=
&
thread
->
mutex
;
thd
->
client_capabilities
-=
CLIENT_MULTI_RESULTS
;
reenable_binlog
(
thd
);
thread
->
init_command
=
FALSE
;
pthread_cond_broadcast
(
&
thread
->
sync_cond
);
}
if
(
thd
->
killed
)
{
thread
->
killed
=
TRUE
;
...
...
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