Spider Cluster Management
Direct SQL
Direct SQL is a way to map reduce execution on remote backend and store the result in a local table.
In sequential using the UDF function spider_direct_sql
or concurrently using spider_bg_direct_sql
.
MariaDB starting with 10.0.4
The Spider storage engine was introduced in MariaDB 10.0.4, Direct SQL is reported to not work in the first releases, it is expected to be fixed in MariaDB 10.0.7 or MariaDB 10.0.8, ask a SkySQL representative for available patch.
spider1 backend << EOF CREATE TEMPORARY TABLE res ( id int(10) unsigned NOT NULL, k int(10) unsigned NOT NULL DEFAULT '0', c char(120) NOT NULL DEFAULT '', pad char(60) NOT NULL DEFAULT '' ) ENGINE=MEMORY; SELECT spider_direct_sql( 'SELECT * FROM sbtest s WHERE s.id IN(10,12,13)', 'res', concat('host "', host, '", port "', port, '", user "', username, '", password "', password, '", database "', tgt_db_name, '"') ) a FROM mysql.spider_tables WHERE db_name = 'backend' and table_name like 'sbtest#P#pt%'; SELECT * FROM res; EOF
Direct Handler Socket
Inter Nodes Copy Table
The UDF function spider_copy_tables
is available for copy table data from source link ID to destination link ID list without stoping your service for copying
spider_copy_tables(Spider table name, source link ID, destination link ID list[, parameters])
If Spider table is partitioned, you must set "Spider table name" with part name like "table_name#P#part_name".
You can check table name with part name using following SQL:
select table_name from mysql.spider_tables;
-
Returns 1
if coping data is success. -
Returns 0
if coping data is failed.
Resharding
Debug Mode
Compile MariaDB in debug mode
./cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=Debug -DWITH_VALGRIND=ON
Run MariaDB the wollowing way to have a details command trace file
mysqld --debug=S:T:t:r:p:n:L:i:F:f:D:d,info,error,query,qcache,my,exit,general,where:O,/tmp/mysqld.trace
Or with Valgrind to get complet stack trace on a crash.
valgrind /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/inetbase/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/inetbase/mysql/lucifer.err --open-files-limit=65000 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306
Report the issue in the MariaDB JIRA or to the SkySQL support center