├── .gitignore ├── LICENSE ├── README.md └── src ├── CMakeLists.txt ├── Makefile.am ├── configure.in ├── ha_spider.cc ├── ha_spider.h ├── hs_client ├── allocator.hpp ├── auto_addrinfo.hpp ├── auto_file.hpp ├── auto_ptrcontainer.hpp ├── config.cpp ├── config.hpp ├── escape.cpp ├── escape.hpp ├── fatal.cpp ├── fatal.hpp ├── hs_compat.h ├── hstcpcli.cpp ├── hstcpcli.hpp ├── mutex.hpp ├── socket.cpp ├── socket.hpp ├── string_buffer.hpp ├── string_ref.hpp ├── string_util.cpp ├── string_util.hpp ├── thread.hpp └── util.hpp ├── mysql-test └── spider │ ├── bg │ ├── include │ │ ├── deinit_child2_1.inc │ │ ├── deinit_child2_2.inc │ │ ├── deinit_child2_3.inc │ │ ├── deinit_child3_1.inc │ │ ├── deinit_child3_2.inc │ │ ├── deinit_child3_3.inc │ │ ├── deinit_master_1.inc │ │ ├── deinit_slave1_1.inc │ │ ├── ha_deinit_child2_1.inc │ │ ├── ha_deinit_child2_2.inc │ │ ├── ha_deinit_child2_3.inc │ │ ├── ha_deinit_child3_1.inc │ │ ├── ha_deinit_child3_2.inc │ │ ├── ha_deinit_child3_3.inc │ │ ├── ha_deinit_master_1.inc │ │ ├── ha_init_child2_1.inc │ │ ├── ha_init_child2_2.inc │ │ ├── ha_init_child2_3.inc │ │ ├── ha_init_child3_1.inc │ │ ├── ha_init_child3_2.inc │ │ ├── ha_init_child3_3.inc │ │ ├── ha_init_master_1.inc │ │ ├── hs_deinit_child2_1.inc │ │ ├── hs_deinit_child2_2.inc │ │ ├── hs_deinit_child2_3.inc │ │ ├── hs_deinit_master_1.inc │ │ ├── hs_init_child2_1.inc │ │ ├── hs_init_child2_2.inc │ │ ├── hs_init_child2_3.inc │ │ ├── hs_init_master_1.inc │ │ ├── init_child2_1.inc │ │ ├── init_child2_2.inc │ │ ├── init_child2_3.inc │ │ ├── init_child3_1.inc │ │ ├── init_child3_2.inc │ │ ├── init_child3_3.inc │ │ ├── init_master_1.inc │ │ └── init_slave1_1.inc │ ├── my.cnf │ ├── r │ │ ├── basic_sql.result │ │ ├── basic_sql_part.result │ │ ├── direct_aggregate.result │ │ ├── direct_aggregate_part.result │ │ ├── direct_update.result │ │ ├── direct_update_part.result │ │ ├── function.result │ │ ├── ha.result │ │ ├── ha_part.result │ │ ├── spider3_fixes.result │ │ ├── spider3_fixes_part.result │ │ ├── spider_fixes.result │ │ ├── spider_fixes_part.result │ │ └── vp_fixes.result │ ├── suite.opt │ ├── suite.pm │ └── t │ │ ├── basic_sql.test │ │ ├── basic_sql_part.test │ │ ├── connect_child2_1.inc │ │ ├── connect_child2_2.inc │ │ ├── connect_child2_3.inc │ │ ├── connect_child3_1.inc │ │ ├── connect_child3_2.inc │ │ ├── connect_child3_3.inc │ │ ├── connect_master_1.inc │ │ ├── connect_slave1_1.inc │ │ ├── direct_aggregate.test │ │ ├── direct_aggregate_part.test │ │ ├── direct_update.test │ │ ├── direct_update_part.test │ │ ├── function.test │ │ ├── ha.test │ │ ├── ha_part.test │ │ ├── ha_test_deinit.inc │ │ ├── ha_test_init.inc │ │ ├── have_engine.inc │ │ ├── have_func.inc │ │ ├── have_partition.inc │ │ ├── have_trigger.inc │ │ ├── hs_test_deinit.inc │ │ ├── hs_test_init.inc │ │ ├── slave_test_deinit.inc │ │ ├── slave_test_init.inc │ │ ├── spider3_fixes.test │ │ ├── spider3_fixes_part.test │ │ ├── spider_fixes.test │ │ ├── spider_fixes_part.test │ │ ├── test_deinit.inc │ │ ├── test_init.inc │ │ └── vp_fixes.test │ ├── handler │ ├── include │ │ ├── deinit_child2_1.inc │ │ ├── deinit_child2_2.inc │ │ ├── deinit_child2_3.inc │ │ ├── deinit_child3_1.inc │ │ ├── deinit_child3_2.inc │ │ ├── deinit_child3_3.inc │ │ ├── deinit_master_1.inc │ │ ├── deinit_slave1_1.inc │ │ ├── ha_deinit_child2_1.inc │ │ ├── ha_deinit_child2_2.inc │ │ ├── ha_deinit_child2_3.inc │ │ ├── ha_deinit_child3_1.inc │ │ ├── ha_deinit_child3_2.inc │ │ ├── ha_deinit_child3_3.inc │ │ ├── ha_deinit_master_1.inc │ │ ├── ha_init_child2_1.inc │ │ ├── ha_init_child2_2.inc │ │ ├── ha_init_child2_3.inc │ │ ├── ha_init_child3_1.inc │ │ ├── ha_init_child3_2.inc │ │ ├── ha_init_child3_3.inc │ │ ├── ha_init_master_1.inc │ │ ├── hs_deinit_child2_1.inc │ │ ├── hs_deinit_child2_2.inc │ │ ├── hs_deinit_child2_3.inc │ │ ├── hs_deinit_master_1.inc │ │ ├── hs_init_child2_1.inc │ │ ├── hs_init_child2_2.inc │ │ ├── hs_init_child2_3.inc │ │ ├── hs_init_master_1.inc │ │ ├── init_child2_1.inc │ │ ├── init_child2_2.inc │ │ ├── init_child2_3.inc │ │ ├── init_child3_1.inc │ │ ├── init_child3_2.inc │ │ ├── init_child3_3.inc │ │ ├── init_master_1.inc │ │ └── init_slave1_1.inc │ ├── my.cnf │ ├── r │ │ ├── basic_sql.result │ │ ├── direct_aggregate.result │ │ ├── direct_update.result │ │ ├── function.result │ │ ├── ha.result │ │ ├── spider3_fixes.result │ │ ├── spider_fixes.result │ │ └── vp_fixes.result │ └── t │ │ ├── basic_sql.test │ │ ├── basic_sql_part.test │ │ ├── connect_child2_1.inc │ │ ├── connect_child2_2.inc │ │ ├── connect_child2_3.inc │ │ ├── connect_child3_1.inc │ │ ├── connect_child3_2.inc │ │ ├── connect_child3_3.inc │ │ ├── connect_master_1.inc │ │ ├── connect_slave1_1.inc │ │ ├── direct_aggregate.test │ │ ├── direct_aggregate_part.test │ │ ├── direct_update.test │ │ ├── direct_update_part.test │ │ ├── function.test │ │ ├── ha.test │ │ ├── ha_part.test │ │ ├── ha_test_deinit.inc │ │ ├── ha_test_init.inc │ │ ├── have_engine.inc │ │ ├── have_func.inc │ │ ├── have_partition.inc │ │ ├── have_trigger.inc │ │ ├── hs_test_deinit.inc │ │ ├── hs_test_init.inc │ │ ├── slave_test_deinit.inc │ │ ├── slave_test_init.inc │ │ ├── spider3_fixes.test │ │ ├── spider3_fixes_part.test │ │ ├── spider_fixes.test │ │ ├── spider_fixes_part.test │ │ ├── test_deinit.inc │ │ ├── test_init.inc │ │ └── vp_fixes.test │ ├── include │ ├── deinit_child2_1.inc │ ├── deinit_child2_2.inc │ ├── deinit_child2_3.inc │ ├── deinit_child3_1.inc │ ├── deinit_child3_2.inc │ ├── deinit_child3_3.inc │ ├── deinit_engine.inc │ ├── deinit_handlersocket.inc │ ├── deinit_innodb_plugin.inc │ ├── deinit_master_1.inc │ ├── deinit_slave1_1.inc │ ├── deinit_spider.inc │ ├── ha_deinit_child2_1.inc │ ├── ha_deinit_child2_2.inc │ ├── ha_deinit_child2_3.inc │ ├── ha_deinit_child3_1.inc │ ├── ha_deinit_child3_2.inc │ ├── ha_deinit_child3_3.inc │ ├── ha_deinit_master_1.inc │ ├── ha_init_child2_1.inc │ ├── ha_init_child2_2.inc │ ├── ha_init_child2_3.inc │ ├── ha_init_child3_1.inc │ ├── ha_init_child3_2.inc │ ├── ha_init_child3_3.inc │ ├── ha_init_master_1.inc │ ├── hs_deinit_child2_1.inc │ ├── hs_deinit_child2_2.inc │ ├── hs_deinit_child2_3.inc │ ├── hs_deinit_master_1.inc │ ├── hs_init_child2_1.inc │ ├── hs_init_child2_2.inc │ ├── hs_init_child2_3.inc │ ├── hs_init_master_1.inc │ ├── init_child2_1.inc │ ├── init_child2_2.inc │ ├── init_child2_3.inc │ ├── init_child3_1.inc │ ├── init_child3_2.inc │ ├── init_child3_3.inc │ ├── init_engine.inc │ ├── init_master_1.inc │ ├── init_slave1_1.inc │ └── init_spider.inc │ ├── my.cnf │ ├── oracle │ ├── include │ │ ├── deinit_child2_1.inc │ │ ├── deinit_child2_2.inc │ │ ├── deinit_child2_3.inc │ │ ├── deinit_child3_1.inc │ │ ├── deinit_child3_2.inc │ │ ├── deinit_child3_3.inc │ │ ├── deinit_master_1.inc │ │ ├── deinit_slave1_1.inc │ │ ├── ha_deinit_child2_1.inc │ │ ├── ha_deinit_child2_2.inc │ │ ├── ha_deinit_child2_3.inc │ │ ├── ha_deinit_child3_1.inc │ │ ├── ha_deinit_child3_2.inc │ │ ├── ha_deinit_child3_3.inc │ │ ├── ha_deinit_master_1.inc │ │ ├── ha_init_child2_1.inc │ │ ├── ha_init_child2_2.inc │ │ ├── ha_init_child2_3.inc │ │ ├── ha_init_child3_1.inc │ │ ├── ha_init_child3_2.inc │ │ ├── ha_init_child3_3.inc │ │ ├── ha_init_master_1.inc │ │ ├── hs_deinit_child2_1.inc │ │ ├── hs_deinit_child2_2.inc │ │ ├── hs_deinit_child2_3.inc │ │ ├── hs_deinit_master_1.inc │ │ ├── hs_init_child2_1.inc │ │ ├── hs_init_child2_2.inc │ │ ├── hs_init_child2_3.inc │ │ ├── hs_init_master_1.inc │ │ ├── init_child2_1.inc │ │ ├── init_child2_2.inc │ │ ├── init_child2_3.inc │ │ ├── init_child3_1.inc │ │ ├── init_child3_2.inc │ │ ├── init_child3_3.inc │ │ ├── init_master_1.inc │ │ ├── init_slave1_1.inc │ │ └── init_spider.inc │ ├── my.cnf │ ├── r │ │ ├── basic_sql.result │ │ ├── basic_sql_part.result │ │ ├── direct_aggregate.result │ │ ├── direct_aggregate_part.result │ │ ├── direct_update.result │ │ ├── direct_update_part.result │ │ ├── function.result │ │ ├── ha.result │ │ ├── ha_part.result │ │ ├── spider3_fixes.result │ │ ├── spider3_fixes_part.result │ │ ├── spider_fixes.result │ │ ├── spider_fixes_part.result │ │ └── vp_fixes.result │ └── t │ │ ├── basic_sql.test │ │ ├── basic_sql_part.test │ │ ├── connect_child2_1.inc │ │ ├── connect_child2_2.inc │ │ ├── connect_child2_3.inc │ │ ├── connect_child3_1.inc │ │ ├── connect_child3_2.inc │ │ ├── connect_child3_3.inc │ │ ├── connect_master_1.inc │ │ ├── connect_slave1_1.inc │ │ ├── direct_aggregate.test │ │ ├── direct_aggregate_part.test │ │ ├── direct_update.test │ │ ├── direct_update_part.test │ │ ├── function.test │ │ ├── ha.test │ │ ├── ha_part.test │ │ ├── ha_test_deinit.inc │ │ ├── ha_test_init.inc │ │ ├── have_engine.inc │ │ ├── have_func.inc │ │ ├── have_partition.inc │ │ ├── have_trigger.inc │ │ ├── hs_test_deinit.inc │ │ ├── hs_test_init.inc │ │ ├── slave_test_deinit.inc │ │ ├── slave_test_init.inc │ │ ├── spider3_fixes.test │ │ ├── spider3_fixes_part.test │ │ ├── spider_fixes.test │ │ ├── spider_fixes_part.test │ │ ├── test_deinit.inc │ │ ├── test_init.inc │ │ └── vp_fixes.test │ ├── oracle2 │ ├── include │ │ ├── deinit_child2_1.inc │ │ ├── deinit_child2_2.inc │ │ ├── deinit_child2_3.inc │ │ ├── deinit_child3_1.inc │ │ ├── deinit_child3_2.inc │ │ ├── deinit_child3_3.inc │ │ ├── deinit_master_1.inc │ │ ├── deinit_slave1_1.inc │ │ ├── ha_deinit_child2_1.inc │ │ ├── ha_deinit_child2_2.inc │ │ ├── ha_deinit_child2_3.inc │ │ ├── ha_deinit_child3_1.inc │ │ ├── ha_deinit_child3_2.inc │ │ ├── ha_deinit_child3_3.inc │ │ ├── ha_deinit_master_1.inc │ │ ├── ha_init_child2_1.inc │ │ ├── ha_init_child2_2.inc │ │ ├── ha_init_child2_3.inc │ │ ├── ha_init_child3_1.inc │ │ ├── ha_init_child3_2.inc │ │ ├── ha_init_child3_3.inc │ │ ├── ha_init_master_1.inc │ │ ├── hs_deinit_child2_1.inc │ │ ├── hs_deinit_child2_2.inc │ │ ├── hs_deinit_child2_3.inc │ │ ├── hs_deinit_master_1.inc │ │ ├── hs_init_child2_1.inc │ │ ├── hs_init_child2_2.inc │ │ ├── hs_init_child2_3.inc │ │ ├── hs_init_master_1.inc │ │ ├── init_child2_1.inc │ │ ├── init_child2_2.inc │ │ ├── init_child2_3.inc │ │ ├── init_child3_1.inc │ │ ├── init_child3_2.inc │ │ ├── init_child3_3.inc │ │ ├── init_master_1.inc │ │ ├── init_slave1_1.inc │ │ └── init_spider.inc │ ├── my.cnf │ ├── r │ │ ├── basic_sql.result │ │ ├── basic_sql_part.result │ │ ├── direct_aggregate.result │ │ ├── direct_aggregate_part.result │ │ ├── direct_update.result │ │ ├── direct_update_part.result │ │ ├── function.result │ │ ├── ha.result │ │ ├── ha_part.result │ │ ├── spider3_fixes.result │ │ ├── spider3_fixes_part.result │ │ ├── spider_fixes.result │ │ ├── spider_fixes_part.result │ │ └── vp_fixes.result │ └── t │ │ ├── basic_sql.test │ │ ├── basic_sql_part.test │ │ ├── connect_child2_1.inc │ │ ├── connect_child2_2.inc │ │ ├── connect_child2_3.inc │ │ ├── connect_child3_1.inc │ │ ├── connect_child3_2.inc │ │ ├── connect_child3_3.inc │ │ ├── connect_master_1.inc │ │ ├── connect_slave1_1.inc │ │ ├── direct_aggregate.test │ │ ├── direct_aggregate_part.test │ │ ├── direct_update.test │ │ ├── direct_update_part.test │ │ ├── function.test │ │ ├── ha.test │ │ ├── ha_part.test │ │ ├── ha_test_deinit.inc │ │ ├── ha_test_init.inc │ │ ├── have_engine.inc │ │ ├── have_func.inc │ │ ├── have_partition.inc │ │ ├── have_trigger.inc │ │ ├── hs_test_deinit.inc │ │ ├── hs_test_init.inc │ │ ├── slave_test_deinit.inc │ │ ├── slave_test_init.inc │ │ ├── spider3_fixes.test │ │ ├── spider3_fixes_part.test │ │ ├── spider_fixes.test │ │ ├── spider_fixes_part.test │ │ ├── test_deinit.inc │ │ ├── test_init.inc │ │ └── vp_fixes.test │ ├── r │ ├── basic_sql.result │ ├── basic_sql_part.result │ ├── direct_aggregate.result │ ├── direct_aggregate_part.result │ ├── direct_update.result │ ├── direct_update_part.result │ ├── function.result │ ├── ha.result │ ├── ha_part.result │ ├── spider3_fixes.result │ ├── spider3_fixes_part.result │ ├── spider_fixes.result │ ├── spider_fixes_part.result │ └── vp_fixes.result │ ├── suite.opt │ ├── suite.pm │ └── t │ ├── basic_sql.test │ ├── basic_sql_part.test │ ├── connect_child2_1.inc │ ├── connect_child2_2.inc │ ├── connect_child2_3.inc │ ├── connect_child3_1.inc │ ├── connect_child3_2.inc │ ├── connect_child3_3.inc │ ├── connect_master_1.inc │ ├── connect_slave1_1.inc │ ├── direct_aggregate.test │ ├── direct_aggregate_part.test │ ├── direct_update.test │ ├── direct_update_part.test │ ├── function.test │ ├── ha.test │ ├── ha_part.test │ ├── ha_test_deinit.inc │ ├── ha_test_init.inc │ ├── have_engine.inc │ ├── have_func.inc │ ├── have_partition.inc │ ├── have_plugin.inc │ ├── have_trigger.inc │ ├── hs_test_deinit.inc │ ├── hs_test_init.inc │ ├── slave_test_deinit.inc │ ├── slave_test_init.inc │ ├── spider3_fixes.test │ ├── spider3_fixes_part.test │ ├── spider_fixes.test │ ├── spider_fixes_part.test │ ├── test_deinit.inc │ ├── test_init.inc │ └── vp_fixes.test ├── plug.in ├── scripts └── install_spider.sql ├── spd_conn.cc ├── spd_conn.h ├── spd_copy_tables.cc ├── spd_copy_tables.h ├── spd_db_conn.cc ├── spd_db_conn.h ├── spd_db_handlersocket.cc ├── spd_db_handlersocket.h ├── spd_db_include.h ├── spd_db_mysql.cc ├── spd_db_mysql.h ├── spd_db_oracle.cc ├── spd_db_oracle.h ├── spd_direct_sql.cc ├── spd_direct_sql.h ├── spd_err.h ├── spd_i_s.cc ├── spd_include.h ├── spd_malloc.cc ├── spd_malloc.h ├── spd_param.cc ├── spd_param.h ├── spd_ping_table.cc ├── spd_ping_table.h ├── spd_sys_table.cc ├── spd_sys_table.h ├── spd_table.cc ├── spd_table.h ├── spd_trx.cc ├── spd_trx.h ├── spd_udf.cc ├── spd_udf.def └── spd_udf.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mysql-plugin-spider-engine 2 | spider engine migerated from mariadb 3 | 4 | 5 | ## usage 6 | 7 | first, compile the plugin and install in to plugin dir 8 | 9 | cp -r src /path/to/mysql-src/storage/spider 10 | cd /path/to/mysql-src 11 | cmake . -DBUILD_CONFIG=mysql_release -DCMAKE_INSTALL_PREFIX= 12 | cd storage/spider 13 | make 14 | make install 15 | 16 | CAUTION: mysql plugins MUST be built using the same version of the source code and the same build arguments. If mysqld is built as a debug version without cmake parameter -DBUILD_CONFIG, the parameter must not be added when compiling plugins. 17 | 18 | then install and initialize the plugin 19 | 20 | mysql ... < scripts/install_spider.sql 21 | 22 | for more documents, see https://mariadb.com/kb/en/mariadb/spider/ 23 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_HANDLERSOCKET") 2 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_HANDLERSOCKET") 3 | 4 | IF(HAVE_WVLA) 5 | SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-vla") 6 | SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-vla") 7 | ENDIF() 8 | 9 | SET(SPIDER_SOURCES 10 | spd_param.cc spd_sys_table.cc spd_trx.cc spd_db_conn.cc spd_conn.cc 11 | spd_table.cc spd_direct_sql.cc spd_udf.cc spd_ping_table.cc 12 | spd_copy_tables.cc spd_i_s.cc spd_malloc.cc ha_spider.cc spd_udf.def 13 | spd_db_mysql.cc spd_db_handlersocket.cc spd_db_oracle.cc 14 | hs_client/config.cpp hs_client/escape.cpp hs_client/fatal.cpp 15 | hs_client/hstcpcli.cpp hs_client/socket.cpp hs_client/string_util.cpp 16 | ) 17 | 18 | IF(DEFINED ENV{ORACLE_HOME}) 19 | SET(ORACLE_HOME $ENV{ORACLE_HOME}) 20 | FIND_PATH(ORACLE_INCLUDE_DIR oci.h PATHS ${ORACLE_HOME}/rdbms/public) 21 | SET(ORACLE_OCI_LIB_NAME clntsh) 22 | SET(ORACLE_LIB_DIR ${ORACLE_HOME}/lib) 23 | FIND_LIBRARY(ORACLE_OCI_LIBRARY NAMES ${ORACLE_OCI_LIB_NAME} PATHS ${ORACLE_LIB_DIR}) 24 | ENDIF() 25 | 26 | IF(EXISTS ${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake) 27 | SET(CMAKE_CXX_FLAGS_DEBUG 28 | "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi") 29 | SET(CMAKE_C_FLAGS_DEBUG 30 | "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR /Zi") 31 | SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /MAP /MAPINFO:EXPORTS") 32 | INCLUDE("${PROJECT_SOURCE_DIR}/storage/mysql_storage_engine.cmake") 33 | 34 | INCLUDE_DIRECTORIES( 35 | ${CMAKE_SOURCE_DIR}/include 36 | ${CMAKE_SOURCE_DIR}/sql 37 | ${CMAKE_SOURCE_DIR}/regex) 38 | 39 | MYSQL_STORAGE_ENGINE(SPIDER) 40 | ELSE() 41 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/spider/hs_client) 42 | 43 | INSTALL(FILES 44 | ${CMAKE_SOURCE_DIR}/storage/spider/scripts/install_spider.sql 45 | DESTINATION ${INSTALL_MYSQLSHAREDIR} COMPONENT Server 46 | ) 47 | SET(SPIDER_DEB_FILES "usr/lib/mysql/plugin/ha_spider.so usr/share/mysql/install_spider.sql" PARENT_SCOPE) 48 | MYSQL_ADD_PLUGIN(spider ${SPIDER_SOURCES} STORAGE_ENGINE MODULE_ONLY MODULE_OUTPUT_NAME "ha_spider") 49 | ENDIF() 50 | 51 | IF(ORACLE_INCLUDE_DIR AND ORACLE_OCI_LIBRARY) 52 | SET(SPIDER_WITH_ORACLE_OCI OFF CACHE BOOL "Spider is compiled with Oracle OCI library.") 53 | IF(SPIDER_WITH_ORACLE_OCI) 54 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_ORACLE_OCI -DLINUX -D_GNU_SOURCE -D_REENTRANT") 55 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_ORACLE_OCI -DLINUX -D_GNU_SOURCE -D_REENTRANT") 56 | INCLUDE_DIRECTORIES(${ORACLE_INCLUDE_DIR}) 57 | TARGET_LINK_LIBRARIES (spider ${ORACLE_OCI_LIBRARY}) 58 | ENDIF() 59 | ENDIF() 60 | -------------------------------------------------------------------------------- /src/configure.in: -------------------------------------------------------------------------------- 1 | AC_INIT([spider_engine], [1.0], [kentokushiba@gmail.com]) 2 | AC_CONFIG_HEADERS([config.h]) 3 | AM_INIT_AUTOMAKE 4 | 5 | AC_PROG_CC 6 | AC_PROG_CXX 7 | AC_PROG_LIBTOOL 8 | 9 | AC_TYPE_SIZE_T 10 | 11 | AC_DEFUN([MYSQL_PATH_TEST],[ 12 | AC_MSG_CHECKING([mysql source path]) 13 | AC_ARG_WITH([mysql], 14 | [AS_HELP_STRING([--with-mysql=PATH],[mysql source directory PATH])], 15 | [ 16 | if test \ 17 | -f $withval/include/mysql/plugin.h -a \ 18 | -f $withval/include/mysql.h -a \ 19 | -f $withval/include/errmsg.h -a \ 20 | \( -f $withval/sql/mysql_priv.h -o -f $withval/sql/sql_priv.h \) ; 21 | then 22 | SPD_MYSQL_INC="$withval/" 23 | AC_MSG_RESULT([yes]) 24 | plugin_spider_shared_target="" 25 | AC_SUBST(plugin_spider_shared_target) 26 | plugin_spider_static_target="" 27 | AC_SUBST(plugin_spider_static_target) 28 | PLUGIN_SPIDER_LTLIBRARIES_TARGET="ha_spider.la" 29 | AC_SUBST(PLUGIN_SPIDER_LTLIBRARIES_TARGET) 30 | PLUGIN_SPIDER_LIBRARIES_TARGET="libspider.a" 31 | AC_SUBST(PLUGIN_SPIDER_LIBRARIES_TARGET) 32 | LIBTOOL="$LIBTOOL --preserve-dup-deps" 33 | AC_SUBST(LIBTOOL) 34 | else 35 | AC_MSG_ERROR([Can't find header files. Please check --with-mysql=PATH option]) 36 | fi 37 | ], 38 | [ 39 | if test \ 40 | -f ../../include/mysql/plugin.h -a \ 41 | -f ../../include/mysql.h -a \ 42 | -f ../../include/errmsg.h -a \ 43 | \( -f ../../sql/mysql_priv.h -o ../../sql/sql_priv.h \) ; 44 | then 45 | SPD_MYSQL_INC="../../" 46 | AC_MSG_RESULT([no]) 47 | else 48 | AC_MSG_ERROR([Can't find header files. Please set --with-mysql=PATH option]) 49 | fi 50 | ] 51 | ) 52 | ]) 53 | 54 | MYSQL_PATH_TEST 55 | AC_SUBST(SPD_MYSQL_INC) 56 | 57 | AC_DEFUN([MYSQL_INCLUDE_PATH_TEST],[ 58 | AC_MSG_CHECKING([mysql include path]) 59 | AC_ARG_WITH([mysql-include], 60 | [AS_HELP_STRING([--with-mysql-include=PATH],[mysql include directory PATH])], 61 | [ 62 | if test \ 63 | -f $withval/mysql_version.h -a \ 64 | -f $withval/my_config.h ; 65 | then 66 | MYSQL_INCLUDE_PATH="-I $withval/" 67 | AC_MSG_RESULT([yes]) 68 | else 69 | AC_MSG_ERROR([Can't find "my_config.h". Please check --with-mysql-include=PATH option]) 70 | fi 71 | ], 72 | [ 73 | if test \ 74 | -f ../../include/mysql_version.h -a \ 75 | -f ../../include/my_config.h ; 76 | then 77 | MYSQL_INCLUDE_PATH="-I ../../include/" 78 | AC_MSG_RESULT([no]) 79 | else 80 | AC_MSG_ERROR([Can't find "my_config.h". Please set --with-mysql-include=PATH option]) 81 | fi 82 | ] 83 | ) 84 | ]) 85 | 86 | MYSQL_INCLUDE_PATH_TEST 87 | AC_SUBST(MYSQL_INCLUDE_PATH) 88 | 89 | CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti" 90 | 91 | 92 | AC_CHECK_FUNCS([memset strchr strncasecmp]) 93 | 94 | AC_CONFIG_FILES([Makefile]) 95 | AC_OUTPUT 96 | -------------------------------------------------------------------------------- /src/hs_client/allocator.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #ifndef DENA_ALLOCATOR_HPP 11 | #define DENA_ALLOCATOR_HPP 12 | 13 | #if 0 14 | extern "C" { 15 | #include 16 | }; 17 | #define DENA_MALLOC(x) tlsf_malloc(x) 18 | #define DENA_REALLOC(x, y) tlsf_realloc(x, y) 19 | #define DENA_FREE(x) tlsf_free(x) 20 | #define DENA_NEWCHAR(x) static_cast(tlsf_malloc(x)) 21 | #define DENA_DELETE(x) tlsf_free(x) 22 | #endif 23 | 24 | #if 1 25 | #define DENA_MALLOC(x) malloc(x) 26 | #define DENA_REALLOC(x, y) realloc(x, y) 27 | #define DENA_FREE(x) free(x) 28 | #define DENA_NEWCHAR(x) (new char[x]) 29 | #define DENA_DELETE(x) (delete [] x) 30 | #endif 31 | 32 | #if 1 33 | #define DENA_ALLOCA_ALLOCATE(typ, len) \ 34 | static_cast(alloca((len) * sizeof(typ))) 35 | #define DENA_ALLOCA_FREE(x) 36 | #else 37 | #define DENA_ALLOCA_ALLOCATE(typ, len) \ 38 | static_cast(malloc((len) * sizeof(typ))) 39 | #define DENA_ALLOCA_FREE(x) free(x) 40 | #endif 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /src/hs_client/auto_addrinfo.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * See COPYRIGHT.txt for details. 7 | */ 8 | 9 | #ifndef DENA_AUTO_ADDRINFO_HPP 10 | #define DENA_AUTO_ADDRINFO_HPP 11 | 12 | #ifndef __WIN__ 13 | #include 14 | #endif 15 | 16 | #include "util.hpp" 17 | 18 | namespace dena { 19 | 20 | struct auto_addrinfo : private noncopyable { 21 | auto_addrinfo() : addr(0) { } 22 | ~auto_addrinfo() { 23 | reset(); 24 | } 25 | void reset(addrinfo *a = 0) { 26 | if (addr != 0) { 27 | freeaddrinfo(addr); 28 | } 29 | addr = a; 30 | } 31 | const addrinfo *get() const { return addr; } 32 | int resolve(const char *node, const char *service, int flags = 0, 33 | int family = AF_UNSPEC, int socktype = SOCK_STREAM, int protocol = 0) { 34 | reset(); 35 | addrinfo hints; 36 | hints.ai_flags = flags; 37 | hints.ai_family = family; 38 | hints.ai_socktype = socktype; 39 | hints.ai_protocol = protocol; 40 | return getaddrinfo(node, service, &hints, &addr); 41 | } 42 | private: 43 | addrinfo *addr; 44 | }; 45 | 46 | }; 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /src/hs_client/auto_file.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * See COPYRIGHT.txt for details. 7 | */ 8 | 9 | #ifndef DENA_AUTO_FILE_HPP 10 | #define DENA_AUTO_FILE_HPP 11 | 12 | /* 13 | #ifndef __WIN__ 14 | #include 15 | #endif 16 | */ 17 | 18 | #include "util.hpp" 19 | 20 | namespace dena { 21 | 22 | struct auto_file : private noncopyable { 23 | auto_file() : fd(-1) { } 24 | ~auto_file() { 25 | reset(); 26 | } 27 | int get() const { return fd; } 28 | int close() { 29 | if (fd < 0) { 30 | return 0; 31 | } 32 | const int r = ::close(fd); 33 | fd = -1; 34 | return r; 35 | } 36 | void reset(int x = -1) { 37 | if (fd >= 0) { 38 | this->close(); 39 | } 40 | fd = x; 41 | } 42 | private: 43 | int fd; 44 | }; 45 | 46 | /* 47 | struct auto_dir : private noncopyable { 48 | auto_dir() : dp(0) { } 49 | ~auto_dir() { 50 | reset(); 51 | } 52 | DIR *get() const { return dp; } 53 | void reset(DIR *d = 0) { 54 | if (dp != 0) { 55 | closedir(dp); 56 | } 57 | dp = d; 58 | } 59 | private: 60 | DIR *dp; 61 | }; 62 | */ 63 | 64 | }; 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /src/hs_client/auto_ptrcontainer.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #ifndef DENA_AUTO_PTRCONTAINER_HPP 11 | #define DENA_AUTO_PTRCONTAINER_HPP 12 | 13 | namespace dena { 14 | 15 | /* 16 | template 17 | struct auto_ptrcontainer { 18 | typedef Tcnt container_type; 19 | typedef typename container_type::value_type value_type; 20 | typedef typename container_type::pointer pointer; 21 | typedef typename container_type::reference reference; 22 | typedef typename container_type::const_reference const_reference; 23 | typedef typename container_type::size_type size_type; 24 | typedef typename container_type::difference_type difference_type; 25 | typedef typename container_type::iterator iterator; 26 | typedef typename container_type::const_iterator const_iterator; 27 | typedef typename container_type::reverse_iterator reverse_iterator; 28 | typedef typename container_type::const_reverse_iterator 29 | const_reverse_iterator; 30 | iterator begin() { return cnt.begin(); } 31 | const_iterator begin() const { return cnt.begin(); } 32 | iterator end() { return cnt.end(); } 33 | const_iterator end() const { return cnt.end(); } 34 | reverse_iterator rbegin() { return cnt.rbegin(); } 35 | reverse_iterator rend() { return cnt.rend(); } 36 | const_reverse_iterator rbegin() const { return cnt.rbegin(); } 37 | const_reverse_iterator rend() const { return cnt.rend(); } 38 | size_type size() const { return cnt.size(); } 39 | size_type max_size() const { return cnt.max_size(); } 40 | bool empty() const { return cnt.empty(); } 41 | reference front() { return cnt.front(); } 42 | const_reference front() const { cnt.front(); } 43 | reference back() { return cnt.back(); } 44 | const_reference back() const { cnt.back(); } 45 | void swap(auto_ptrcontainer& x) { cnt.swap(x.cnt); } 46 | ~auto_ptrcontainer() { 47 | for (iterator i = begin(); i != end(); ++i) { 48 | delete *i; 49 | } 50 | } 51 | template void push_back_ptr(Tap& ap) { 52 | cnt.push_back(ap.get()); 53 | ap.release(); 54 | } 55 | void erase_ptr(iterator i) { 56 | delete *i; 57 | cnt.erase(i); 58 | } 59 | reference operator [](size_type n) { return cnt[n]; } 60 | const_reference operator [](size_type n) const { return cnt[n]; } 61 | void clear() { cnt.clear(); } 62 | private: 63 | Tcnt cnt; 64 | }; 65 | */ 66 | 67 | }; 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /src/hs_client/config.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #ifndef DENA_CONFIG_HPP 11 | #define DENA_CONFIG_HPP 12 | 13 | #include "mysql_version.h" 14 | #if MYSQL_VERSION_ID < 50500 15 | #include "mysql_priv.h" 16 | #include 17 | #else 18 | #include "sql_priv.h" 19 | #include "probes_mysql.h" 20 | #include "sql_class.h" 21 | #endif 22 | 23 | #define DENA_VERBOSE(lv, x) if (dena::verbose_level >= (lv)) { (x); } 24 | 25 | #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS 26 | #define INFO_KIND_HS_RET_FIELDS 1 27 | #define INFO_KIND_HS_APPEND_STRING_REF 3 28 | #define INFO_KIND_HS_CLEAR_STRING_REF 4 29 | #define INFO_KIND_HS_INCREMENT_BEGIN 5 30 | #define INFO_KIND_HS_INCREMENT_END 6 31 | #define INFO_KIND_HS_DECREMENT_BEGIN 7 32 | #define INFO_KIND_HS_DECREMENT_END 8 33 | #endif 34 | 35 | namespace dena { 36 | 37 | #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS 38 | struct uint32_info { 39 | size_t info_size; 40 | uint32 *info; 41 | }; 42 | #endif 43 | 44 | struct conf_param { 45 | String key; 46 | String val; 47 | }; 48 | 49 | uchar *conf_get_key( 50 | conf_param *share, 51 | size_t *length, 52 | my_bool not_used __attribute__ ((unused)) 53 | ); 54 | 55 | struct config { 56 | bool init; 57 | HASH conf_hash; 58 | config(); 59 | ~config(); 60 | conf_param *find(const String& key) const; 61 | conf_param *find(const char *key) const; 62 | String get_str(const String& key, const String& def = 63 | String("", &my_charset_bin)) const; 64 | String get_str(const char *key, const char *def = "") const; 65 | long long get_int(const String& key, long long def = 0) const; 66 | long long get_int(const char *key, long long def = 0) const; 67 | bool replace(const char *key, const char *val); 68 | bool replace(const char *key, long long val); 69 | bool compare(const char *key, const char *val); 70 | void list_all_params() const; 71 | config& operator =(const config& x); 72 | }; 73 | 74 | void parse_args(int argc, char **argv, config& conf); 75 | 76 | extern unsigned int verbose_level; 77 | 78 | }; 79 | 80 | #endif 81 | 82 | -------------------------------------------------------------------------------- /src/hs_client/escape.cpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010 DeNA Co.,Ltd.. All rights reserved. 6 | * See COPYRIGHT.txt for details. 7 | */ 8 | 9 | #include 10 | #include "mysql_version.h" 11 | #include "hs_compat.h" 12 | #include "escape.hpp" 13 | #include "string_buffer.hpp" 14 | #include "fatal.hpp" 15 | #include "string_util.hpp" 16 | 17 | #define DBG_OP(x) 18 | #define DBG_BUF(x) 19 | 20 | namespace dena { 21 | 22 | enum special_char_t { 23 | special_char_escape_prefix = 0x01, /* SOH */ 24 | special_char_noescape_min = 0x10, /* DLE */ 25 | special_char_escape_shift = 0x40, /* '@' */ 26 | }; 27 | 28 | void 29 | escape_string(char *& wp, const char *start, const char *finish) 30 | { 31 | while (start != finish) { 32 | const unsigned char c = *start; 33 | if (c >= special_char_noescape_min) { 34 | wp[0] = c; /* no need to escape */ 35 | } else { 36 | wp[0] = special_char_escape_prefix; 37 | ++wp; 38 | wp[0] = c + special_char_escape_shift; 39 | } 40 | ++start; 41 | ++wp; 42 | } 43 | } 44 | 45 | void 46 | escape_string(string_buffer& ar, const char *start, const char *finish) 47 | { 48 | const size_t buflen = (finish - start) * 2; 49 | char *const wp_begin = ar.make_space(buflen); 50 | char *wp = wp_begin; 51 | escape_string(wp, start, finish); 52 | ar.space_wrote(wp - wp_begin); 53 | } 54 | 55 | bool 56 | unescape_string(char *& wp, const char *start, const char *finish) 57 | { 58 | /* works even if wp == start */ 59 | while (start != finish) { 60 | const unsigned char c = *start; 61 | if (c != special_char_escape_prefix) { 62 | wp[0] = c; 63 | } else if (start + 1 != finish) { 64 | ++start; 65 | const unsigned char cn = *start; 66 | if (cn < special_char_escape_shift) { 67 | return false; 68 | } 69 | wp[0] = cn - special_char_escape_shift; 70 | } else { 71 | return false; 72 | } 73 | ++start; 74 | ++wp; 75 | } 76 | return true; 77 | } 78 | 79 | bool 80 | unescape_string(string_buffer& ar, const char *start, const char *finish) 81 | { 82 | const size_t buflen = finish - start; 83 | char *const wp_begin = ar.make_space(buflen); 84 | char *wp = wp_begin; 85 | const bool r = unescape_string(wp, start, finish); 86 | ar.space_wrote(wp - wp_begin); 87 | return r; 88 | } 89 | 90 | uint32 91 | read_ui32(char *& start, char *finish) 92 | { 93 | char *const n_begin = start; 94 | read_token(start, finish); 95 | char *const n_end = start; 96 | uint32 v = 0; 97 | for (char *p = n_begin; p != n_end; ++p) { 98 | const char ch = p[0]; 99 | if (ch >= '0' && ch <= '9') { 100 | v *= 10; 101 | v += (ch - '0'); 102 | } 103 | } 104 | return v; 105 | } 106 | 107 | void 108 | write_ui32(string_buffer& buf, uint32 v) 109 | { 110 | char *wp = buf.make_space(12); 111 | int len = snprintf(wp, 12, "%u", v); 112 | if (len > 0) { 113 | buf.space_wrote(len); 114 | } 115 | } 116 | 117 | void 118 | write_ui64(string_buffer& buf, uint64 v) 119 | { 120 | char *wp = buf.make_space(22); 121 | int len = snprintf(wp, 22, "%llu", static_cast(v)); 122 | if (len > 0) { 123 | buf.space_wrote(len); 124 | } 125 | } 126 | 127 | }; 128 | 129 | -------------------------------------------------------------------------------- /src/hs_client/escape.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010 DeNA Co.,Ltd.. All rights reserved. 6 | * See COPYRIGHT.txt for details. 7 | */ 8 | 9 | #include "string_buffer.hpp" 10 | #include "string_ref.hpp" 11 | #include "string_util.hpp" 12 | 13 | #ifndef DENA_ESCAPE_HPP 14 | #define DENA_ESCAPE_HPP 15 | 16 | namespace dena { 17 | 18 | void escape_string(char *& wp, const char *start, const char *finish); 19 | void escape_string(string_buffer& ar, const char *start, const char *finish); 20 | bool unescape_string(char *& wp, const char *start, const char *finish); 21 | /* unescaped_string() works even if wp == start */ 22 | bool unescape_string(string_buffer& ar, const char *start, const char *finish); 23 | 24 | uint32 read_ui32(char *& start, char *finish); 25 | void write_ui32(string_buffer& buf, uint32 v); 26 | void write_ui64(string_buffer& buf, uint64 v); 27 | 28 | inline bool 29 | is_null_expression(const char *start, const char *finish) 30 | { 31 | return (finish == start + 1 && start[0] == 0); 32 | } 33 | 34 | inline void 35 | read_token(char *& start, char *finish) 36 | { 37 | char *const p = memchr_char(start, '\t', finish - start); 38 | if (p == 0) { 39 | start = finish; 40 | } else { 41 | start = p; 42 | } 43 | } 44 | 45 | inline void 46 | skip_token_delim_fold(char *& start, char *finish) 47 | { 48 | while (start != finish && start[0] == '\t') { 49 | ++start; 50 | } 51 | } 52 | 53 | inline void 54 | skip_one(char *& start, char *finish) 55 | { 56 | if (start != finish) { 57 | ++start; 58 | } 59 | } 60 | 61 | }; 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /src/hs_client/fatal.cpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #include 11 | #include "mysql_version.h" 12 | #if MYSQL_VERSION_ID < 50500 13 | #include "mysql_priv.h" 14 | #include 15 | #else 16 | #include "sql_priv.h" 17 | #include "probes_mysql.h" 18 | #endif 19 | 20 | #include "fatal.hpp" 21 | 22 | namespace dena { 23 | 24 | /* 25 | const int opt_syslog = LOG_ERR | LOG_PID | LOG_CONS; 26 | */ 27 | 28 | void 29 | fatal_exit(const String& message) 30 | { 31 | fprintf(stderr, "FATAL_EXIT: %s\n", message.ptr()); 32 | /* 33 | syslog(opt_syslog, "FATAL_EXIT: %s", message.ptr()); 34 | */ 35 | _exit(1); 36 | } 37 | 38 | void 39 | fatal_exit(const char *message) 40 | { 41 | fprintf(stderr, "FATAL_EXIT: %s\n", message); 42 | /* 43 | syslog(opt_syslog, "FATAL_EXIT: %s", message); 44 | */ 45 | _exit(1); 46 | } 47 | 48 | void 49 | fatal_abort(const String& message) 50 | { 51 | fprintf(stderr, "FATAL_COREDUMP: %s\n", message.ptr()); 52 | /* 53 | syslog(opt_syslog, "FATAL_COREDUMP: %s", message.ptr()); 54 | */ 55 | abort(); 56 | } 57 | 58 | void 59 | fatal_abort(const char *message) 60 | { 61 | fprintf(stderr, "FATAL_COREDUMP: %s\n", message); 62 | /* 63 | syslog(opt_syslog, "FATAL_COREDUMP: %s", message); 64 | */ 65 | abort(); 66 | } 67 | 68 | }; 69 | 70 | -------------------------------------------------------------------------------- /src/hs_client/fatal.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #ifndef DENA_FATAL_HPP 11 | #define DENA_FATAL_HPP 12 | 13 | #include "mysql_version.h" 14 | #if MYSQL_VERSION_ID < 50500 15 | #include "mysql_priv.h" 16 | #include 17 | #else 18 | #include "sql_priv.h" 19 | #include "probes_mysql.h" 20 | #include "sql_class.h" 21 | #endif 22 | 23 | namespace dena { 24 | 25 | void fatal_exit(const String& message); 26 | void fatal_exit(const char *message); 27 | void fatal_abort(const String& message); 28 | void fatal_abort(const char *message); 29 | 30 | }; 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /src/hs_client/hs_compat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2013 Kentoku Shiba 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 15 | 16 | #ifndef HS_COMPAT_H 17 | #define HS_COMPAT_H 18 | 19 | #if defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100000 20 | #define SPD_INIT_DYNAMIC_ARRAY2(A, B, C, D, E, F) \ 21 | my_init_dynamic_array2(A, B, C, D, E, F) 22 | #define SPD_INIT_ALLOC_ROOT(A, B, C, D) \ 23 | init_alloc_root(A, B, C, D) 24 | #else 25 | #define SPD_INIT_DYNAMIC_ARRAY2(A, B, C, D, E, F) \ 26 | my_init_dynamic_array2(A, B, C, D, E) 27 | #define SPD_INIT_ALLOC_ROOT(A, B, C, D) \ 28 | init_alloc_root(A, B, C) 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/hs_client/hstcpcli.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #ifndef DENA_HSTCPCLI_HPP 11 | #define DENA_HSTCPCLI_HPP 12 | 13 | #define HANDLERSOCKET_MYSQL_UTIL 1 14 | 15 | #include "mysql_version.h" 16 | #if MYSQL_VERSION_ID < 50500 17 | #include "mysql_priv.h" 18 | #include 19 | #else 20 | #include "sql_priv.h" 21 | #include "probes_mysql.h" 22 | #endif 23 | 24 | #include "config.hpp" 25 | #include "socket.hpp" 26 | #include "string_ref.hpp" 27 | #include "string_buffer.hpp" 28 | 29 | namespace dena { 30 | 31 | struct hstcpcli_filter { 32 | string_ref filter_type; 33 | string_ref op; 34 | size_t ff_offset; 35 | string_ref val; 36 | hstcpcli_filter() : ff_offset(0) { } 37 | }; 38 | 39 | struct hstcpcli_i; 40 | typedef hstcpcli_i *hstcpcli_ptr; 41 | 42 | struct hstresult { 43 | hstresult(); 44 | virtual ~hstresult(); 45 | string_buffer readbuf; 46 | size_t response_end_offset; 47 | size_t num_flds; 48 | size_t cur_row_offset; 49 | DYNAMIC_ARRAY flds; 50 | }; 51 | 52 | struct hstcpcli_i { 53 | virtual ~hstcpcli_i() { } 54 | virtual void close() = 0; 55 | virtual int reconnect() = 0; 56 | virtual bool stable_point() = 0; 57 | virtual void request_buf_auth(const char *secret, const char *typ) = 0; 58 | virtual void request_buf_open_index(size_t pst_id, const char *dbn, 59 | const char *tbl, const char *idx, const char *retflds, 60 | const char *filflds = 0) = 0; 61 | virtual void request_buf_exec_generic(size_t pst_id, const string_ref& op, 62 | const string_ref *kvs, size_t kvslen, uint32 limit, uint32 skip, 63 | const string_ref& mod_op, const string_ref *mvs, size_t mvslen, 64 | const hstcpcli_filter *fils = 0, size_t filslen = 0, 65 | int invalues_keypart = -1, const string_ref *invalues = 0, 66 | size_t invalueslen = 0) = 0; // FIXME: too long 67 | virtual size_t request_buf_append(const char *start, const char *finish) = 0; 68 | virtual void request_reset() = 0; 69 | virtual int request_send() = 0; 70 | virtual int response_recv(size_t& num_flds_r) = 0; 71 | virtual int get_result(hstresult& result) = 0; 72 | virtual const string_ref *get_next_row() = 0; 73 | virtual const string_ref *get_next_row_from_result(hstresult& result) = 0; 74 | virtual void response_buf_remove() = 0; 75 | virtual int get_error_code() = 0; 76 | virtual String& get_error() = 0; 77 | virtual void clear_error() = 0; 78 | virtual int set_timeout(int send_timeout, int recv_timeout) = 0; 79 | virtual size_t get_num_req_bufd() = 0; 80 | virtual size_t get_num_req_sent() = 0; 81 | virtual size_t get_num_req_rcvd() = 0; 82 | virtual size_t get_response_end_offset() = 0; 83 | virtual const char *get_readbuf_begin() = 0; 84 | virtual const char *get_readbuf_end() = 0; 85 | virtual const char *get_writebuf_begin() = 0; 86 | virtual size_t get_writebuf_size() = 0; 87 | virtual void write_error_to_log(const char *func_name, const char *file_name, 88 | ulong line_no) = 0; 89 | static hstcpcli_ptr create(const socket_args& args); 90 | }; 91 | 92 | }; 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /src/hs_client/mutex.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * See COPYRIGHT.txt for details. 7 | */ 8 | 9 | #ifndef DENA_MUTEX_HPP 10 | #define DENA_MUTEX_HPP 11 | 12 | #include "fatal.hpp" 13 | #include "util.hpp" 14 | 15 | namespace dena { 16 | 17 | struct condition; 18 | 19 | struct mutex : private noncopyable { 20 | friend struct condition; 21 | mutex() { 22 | if (pthread_mutex_init(&mtx, 0) != 0) { 23 | fatal_abort("pthread_mutex_init"); 24 | } 25 | } 26 | ~mutex() { 27 | if (pthread_mutex_destroy(&mtx) != 0) { 28 | fatal_abort("pthread_mutex_destroy"); 29 | } 30 | } 31 | void lock() const { 32 | if (pthread_mutex_lock(&mtx) != 0) { 33 | fatal_abort("pthread_mutex_lock"); 34 | } 35 | } 36 | void unlock() const { 37 | if (pthread_mutex_unlock(&mtx) != 0) { 38 | fatal_abort("pthread_mutex_unlock"); 39 | } 40 | } 41 | private: 42 | mutable pthread_mutex_t mtx; 43 | }; 44 | 45 | }; 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /src/hs_client/socket.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #ifndef DENA_SOCKET_HPP 11 | #define DENA_SOCKET_HPP 12 | 13 | #include "mysql_version.h" 14 | #if MYSQL_VERSION_ID < 50500 15 | #include "mysql_priv.h" 16 | #include 17 | #else 18 | #include "sql_priv.h" 19 | #include "probes_mysql.h" 20 | #endif 21 | 22 | #include "auto_addrinfo.hpp" 23 | #include "auto_file.hpp" 24 | #include "config.hpp" 25 | 26 | namespace dena { 27 | 28 | struct socket_args { 29 | sockaddr_storage addr; 30 | socklen_t addrlen; 31 | int family; 32 | int socktype; 33 | int protocol; 34 | int timeout; 35 | int send_timeout; 36 | int recv_timeout; 37 | int listen_backlog; 38 | bool reuseaddr; 39 | bool nonblocking; 40 | bool use_epoll; 41 | int sndbuf; 42 | int rcvbuf; 43 | socket_args() : addr(), addrlen(0), family(AF_INET), socktype(SOCK_STREAM), 44 | protocol(0), timeout(600), send_timeout(600), recv_timeout(600), 45 | listen_backlog(256), reuseaddr(true), nonblocking(false), use_epoll(false), 46 | sndbuf(0), rcvbuf(0) { } 47 | void set(const config& conf); 48 | void set_unix_domain(const char *path); 49 | int resolve(const char *node, const char *service); 50 | }; 51 | 52 | void ignore_sigpipe(); 53 | int socket_set_timeout(auto_file& fd, const socket_args& args, String& err_r); 54 | int socket_bind(auto_file& fd, const socket_args& args, String& err_r); 55 | int socket_connect(auto_file& fd, const socket_args& args, String& err_r); 56 | int socket_accept(int listen_fd, auto_file& fd, const socket_args& args, 57 | sockaddr_storage& addr_r, socklen_t& addrlen_r, String& err_r); 58 | 59 | }; 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /src/hs_client/string_util.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #ifndef DENA_STRING_UTIL_HPP 11 | #define DENA_STRING_UTIL_HPP 12 | 13 | #include "string_buffer.hpp" 14 | #include "string_ref.hpp" 15 | 16 | namespace dena { 17 | 18 | inline const char * 19 | memchr_char(const char *s, int c, size_t n) 20 | { 21 | return static_cast(memchr(s, c, n)); 22 | } 23 | 24 | inline char * 25 | memchr_char(char *s, int c, size_t n) 26 | { 27 | return static_cast(memchr(s, c, n)); 28 | } 29 | 30 | string_wref get_token(char *& wp, char *wp_end, char delim); 31 | uint32 atoi_uint32_nocheck(const char *start, const char *finish); 32 | /* 33 | String *to_stdstring(uint32 v); 34 | */ 35 | void append_uint32(string_buffer& buf, uint32 v); 36 | long long atoll_nocheck(const char *start, const char *finish); 37 | 38 | int errno_string(const char *s, int en, String& err_r); 39 | 40 | size_t split(char delim, const string_ref& buf, string_ref *parts, 41 | size_t parts_len); 42 | size_t split(char delim, const string_wref& buf, string_wref *parts, 43 | size_t parts_len); 44 | size_t split(char delim, const string_ref& buf, 45 | DYNAMIC_ARRAY& parts_r); 46 | size_t split(char delim, const string_wref& buf, 47 | DYNAMIC_ARRAY& parts_r); 48 | }; 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /src/hs_client/thread.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved. 6 | * Copyright (C) 2011 Kentoku SHIBA 7 | * See COPYRIGHT.txt for details. 8 | */ 9 | 10 | #ifndef DENA_THREAD_HPP 11 | #define DENA_THREAD_HPP 12 | 13 | #include "fatal.hpp" 14 | 15 | namespace dena { 16 | 17 | /* 18 | template 19 | struct thread : private noncopyable { 20 | template thread(const Ta& arg, size_t stack_sz = 256 * 1024) 21 | : obj(arg), thr(0), need_join(false), stack_size(stack_sz) { } 22 | template thread(const Ta0& a0, 23 | volatile Ta1& a1, size_t stack_sz = 256 * 1024) 24 | : obj(a0, a1), thr(0), need_join(false), stack_size(stack_sz) { } 25 | ~thread() { 26 | join(); 27 | } 28 | void start() { 29 | if (!start_nothrow()) { 30 | fatal_abort("thread::start"); 31 | } 32 | } 33 | bool start_nothrow() { 34 | if (need_join) { 35 | return need_join; 36 | } 37 | void *const arg = this; 38 | pthread_attr_t attr; 39 | if (pthread_attr_init(&attr) != 0) { 40 | fatal_abort("pthread_attr_init"); 41 | } 42 | if (pthread_attr_setstacksize(&attr, stack_size) != 0) { 43 | fatal_abort("pthread_attr_setstacksize"); 44 | } 45 | const int r = pthread_create(&thr, &attr, thread_main, arg); 46 | if (pthread_attr_destroy(&attr) != 0) { 47 | fatal_abort("pthread_attr_destroy"); 48 | } 49 | if (r != 0) { 50 | return need_join; 51 | } 52 | need_join = true; 53 | return need_join; 54 | } 55 | void join() { 56 | if (!need_join) { 57 | return; 58 | } 59 | int e = 0; 60 | if ((e = pthread_join(thr, 0)) != 0) { 61 | fatal_abort("pthread_join"); 62 | } 63 | need_join = false; 64 | } 65 | T& operator *() { return obj; } 66 | T *operator ->() { return &obj; } 67 | private: 68 | static void *thread_main(void *arg) { 69 | thread *p = static_cast(arg); 70 | p->obj(); 71 | return 0; 72 | } 73 | private: 74 | T obj; 75 | pthread_t thr; 76 | bool need_join; 77 | size_t stack_size; 78 | }; 79 | */ 80 | 81 | }; 82 | 83 | #endif 84 | 85 | -------------------------------------------------------------------------------- /src/hs_client/util.hpp: -------------------------------------------------------------------------------- 1 | 2 | // vim:sw=2:ai 3 | 4 | /* 5 | * Copyright (C) 2010 DeNA Co.,Ltd.. All rights reserved. 6 | * See COPYRIGHT.txt for details. 7 | */ 8 | 9 | #ifndef DENA_UTIL_HPP 10 | #define DENA_UTIL_HPP 11 | 12 | namespace dena { 13 | 14 | /* boost::noncopyable */ 15 | struct noncopyable { 16 | noncopyable() { } 17 | private: 18 | noncopyable(const noncopyable&); 19 | noncopyable& operator =(const noncopyable&); 20 | }; 21 | 22 | }; 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/deinit_child3_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/deinit_child3_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/deinit_child3_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/deinit_child3_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/deinit_child3_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/deinit_child3_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/deinit_master_1.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/deinit_slave1_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/deinit_slave1_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/ha_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/ha_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/ha_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_deinit_child3_1.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_deinit_child3_2.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_deinit_child3_3.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/ha_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HA_AS_DROP_TABLES= 2 | $CHILD2_1_DROP_TABLES; 3 | let $CHILD2_1_HA_AS_CREATE_TABLES= 4 | $CHILD2_1_CREATE_TABLES; 5 | let $CHILD2_1_HA_AS_DROP_TABLES2= 6 | $CHILD2_1_DROP_TABLES2; 7 | let $CHILD2_1_HA_AS_CREATE_TABLES2= 8 | $CHILD2_1_CREATE_TABLES2; 9 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HA_DROP_TABLES= 2 | $CHILD2_2_DROP_TABLES; 3 | let $CHILD2_2_HA_CREATE_TABLES= 4 | $CHILD2_2_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/ha_init_child2_3.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_3_HA_DROP_TABLES= 2 | $CHILD2_3_DROP_TABLES; 3 | let $CHILD2_3_HA_CREATE_TABLES= 4 | $CHILD2_3_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/hs_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/hs_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/hs_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/hs_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/hs_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/hs_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/hs_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/hs_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/hs_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HS_DROP_TABLES= 2 | DROP TABLE IF EXISTS hs_r; 3 | let $CHILD2_1_HS_CREATE_TABLES= 4 | CREATE TABLE hs_r ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | d INT DEFAULT 11, 9 | PRIMARY KEY(a) 10 | ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; 11 | let $CHILD2_1_HS_SELECT_TABLES= 12 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a; 13 | let $CHILD2_1_HS_DROP_TABLES2= 14 | DROP TABLE IF EXISTS hs_r2; 15 | let $CHILD2_1_HS_CREATE_TABLES2= 16 | CREATE TABLE hs_r2 ( 17 | a INT DEFAULT 10, 18 | b CHAR(1) DEFAULT 'c', 19 | c DATETIME DEFAULT '1999-10-10 10:10:10', 20 | d INT DEFAULT 11, 21 | PRIMARY KEY(a) 22 | ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; 23 | let $CHILD2_1_HS_SELECT_TABLES2= 24 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a; 25 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/hs_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HS_DROP_TABLES= 2 | DROP TABLE IF EXISTS hs_r3; 3 | let $CHILD2_2_HS_CREATE_TABLES= 4 | CREATE TABLE hs_r3 ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | d INT DEFAULT 11, 9 | PRIMARY KEY(a) 10 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 11 | let $CHILD2_2_HS_SELECT_TABLES= 12 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a; 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/hs_init_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/hs_init_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/hs_init_master_1.inc: -------------------------------------------------------------------------------- 1 | let $MASTER_1_HS_COMMENT_TMP= 2 | COMMENT=''; 3 | let $MASTER_1_HS_COMMENT_2_1= 4 | COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT", hwr "0"'; 5 | let $MASTER_1_HS_COMMENT_P_2_1= 6 | COMMENT='uhr "1", uhw "1", hwr "0"' 7 | PARTITION BY RANGE(a) ( 8 | PARTITION pt1 VALUES LESS THAN (4) 9 | COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', 10 | PARTITION pt2 VALUES LESS THAN MAXVALUE 11 | COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' 12 | ); 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_DROP_TABLES= 2 | DROP TABLE IF EXISTS ta_r3; 3 | let $CHILD2_2_CREATE_TABLES= 4 | CREATE TABLE ta_r3 ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | PRIMARY KEY(a) 9 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 10 | let $CHILD2_2_DROP_TABLES5= 11 | DROP TABLE IF EXISTS ta_r_int; 12 | let $CHILD2_2_CREATE_TABLES5= 13 | CREATE TABLE ta_r_int ( 14 | a INT AUTO_INCREMENT, 15 | b INT DEFAULT 10, 16 | c INT DEFAULT 11, 17 | PRIMARY KEY(a), 18 | KEY idx1(b), 19 | KEY idx2(c) 20 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 21 | let $CHILD2_2_SELECT_TABLES= 22 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; 23 | let $CHILD2_2_DROP_FT_TABLES= 24 | DROP TABLE IF EXISTS ft_r3; 25 | let $CHILD2_2_CREATE_FT_TABLES= 26 | CREATE TABLE ft_r3 ( 27 | a INT DEFAULT 0, 28 | b TEXT, 29 | c TEXT, 30 | d TEXT, 31 | PRIMARY KEY(a), 32 | FULLTEXT INDEX ft_idx1(b), 33 | FULLTEXT INDEX ft_idx2(c) 34 | ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET; 35 | let $CHILD2_2_SELECT_FT_TABLES= 36 | SELECT a, b, c, d FROM ft_r3 ORDER BY a; 37 | let $CHILD2_2_DROP_GM_TABLES= 38 | DROP TABLE IF EXISTS gm_r3; 39 | let $CHILD2_2_CREATE_GM_TABLES= 40 | CREATE TABLE gm_r3 ( 41 | a INT DEFAULT 0, 42 | b GEOMETRY NOT NULL, 43 | c GEOMETRY NOT NULL, 44 | PRIMARY KEY(a), 45 | SPATIAL INDEX sp_idx1(b), 46 | SPATIAL INDEX sp_idx2(c) 47 | ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET; 48 | let $CHILD2_2_SELECT_GM_TABLES= 49 | SELECT a, b, c FROM gm_r3 ORDER BY a; 50 | let $CHILD2_2_DROP_LOCK_TABLES1= 51 | DROP TABLE IF EXISTS t1_2; 52 | let $CHILD2_2_CREATE_LOCK_TABLES1= 53 | CREATE TABLE t1_2 ( 54 | id int(11) NOT NULL, 55 | PRIMARY KEY (id) 56 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 57 | let $CHILD2_2_DROP_LOCK_TABLES2= 58 | DROP TABLE IF EXISTS t2_1; 59 | let $CHILD2_2_CREATE_LOCK_TABLES2= 60 | CREATE TABLE t2_1 ( 61 | id int(11) NOT NULL, 62 | PRIMARY KEY (id) 63 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 64 | let $CHILD2_2_DROP_INCREMENT_TABLES1= 65 | DROP TABLE IF EXISTS t1_2; 66 | let $CHILD2_2_CREATE_INCREMENT_TABLES1= 67 | CREATE TABLE t1_2 ( 68 | id int(11) NOT NULL AUTO_INCREMENT, 69 | PRIMARY KEY (id) 70 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 71 | let $CHILD2_2_SELECT_INCREMENT_TABLES1= 72 | SELECT id FROM t1_2 ORDER BY id; 73 | let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= 74 | SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; 75 | let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= 76 | SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; 77 | let $CHILD2_2_AUTO_INCREMENT_OFFSET1= 78 | SET GLOBAL AUTO_INCREMENT_OFFSET = 1; 79 | let $CHILD2_2_AUTO_INCREMENT_OFFSET2= 80 | SET GLOBAL AUTO_INCREMENT_OFFSET = 3; 81 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/init_child2_3.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_3_DROP_TABLES= 2 | DROP TABLE IF EXISTS ta_r4; 3 | let $CHILD2_3_CREATE_TABLES= 4 | CREATE TABLE ta_r4 ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | PRIMARY KEY(a) 9 | ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET; 10 | let $CHILD2_3_SELECT_TABLES= 11 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; 12 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/init_child3_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/init_child3_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/init_child3_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/init_child3_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/init_child3_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/bg/include/init_child3_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/include/init_slave1_1.inc: -------------------------------------------------------------------------------- 1 | let $SLAVE1_1_COMMENT_INCREMENT1_1= 2 | COMMENT ''; 3 | let $SLAVE1_1_COMMENT_INCREMENT1_P_1= 4 | COMMENT '' 5 | PARTITION BY LIST(MOD(id, 2)) ( 6 | PARTITION pt1 VALUES IN (0) 7 | COMMENT='', 8 | PARTITION pt2 VALUES IN (1) 9 | COMMENT='' 10 | ); 11 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/r/direct_aggregate.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table select test 28 | DROP TABLE IF EXISTS ta_l; 29 | CREATE TABLE ta_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 35 | INSERT INTO ta_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | 42 | direct_aggregating test 43 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 44 | Variable_name Value 45 | Spider_direct_aggregate 0 46 | SELECT COUNT(*) FROM ta_l; 47 | COUNT(*) 48 | 5 49 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 50 | Variable_name Value 51 | Spider_direct_aggregate 0 52 | SELECT MAX(a) FROM ta_l; 53 | MAX(a) 54 | 5 55 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 56 | Variable_name Value 57 | Spider_direct_aggregate 0 58 | SELECT MIN(a) FROM ta_l; 59 | MIN(a) 60 | 1 61 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 62 | Variable_name Value 63 | Spider_direct_aggregate 0 64 | SELECT MAX(a) FROM ta_l WHERE a < 5; 65 | MAX(a) 66 | 4 67 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 68 | Variable_name Value 69 | Spider_direct_aggregate 0 70 | SELECT MIN(a) FROM ta_l WHERE a > 1; 71 | MIN(a) 72 | 2 73 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 74 | Variable_name Value 75 | Spider_direct_aggregate 0 76 | 77 | deinit 78 | DROP DATABASE IF EXISTS auto_test_local; 79 | DROP DATABASE IF EXISTS auto_test_remote; 80 | DROP DATABASE IF EXISTS auto_test_remote2; 81 | for master_1 82 | for child2 83 | child2_1 84 | child2_2 85 | child2_3 86 | for child3 87 | child3_1 88 | child3_2 89 | child3_3 90 | 91 | end of test 92 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/r/direct_aggregate_part.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | with partition test 28 | CREATE TABLE ta_l2 ( 29 | a INT, 30 | b CHAR(1), 31 | c DATETIME, 32 | PRIMARY KEY(a) 33 | ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 34 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 35 | Variable_name Value 36 | Spider_direct_aggregate 0 37 | SELECT COUNT(*) FROM ta_l2; 38 | COUNT(*) 39 | 5 40 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 41 | Variable_name Value 42 | Spider_direct_aggregate 0 43 | SELECT MAX(a) FROM ta_l2; 44 | MAX(a) 45 | 5 46 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 47 | Variable_name Value 48 | Spider_direct_aggregate 0 49 | SELECT MIN(a) FROM ta_l2; 50 | MIN(a) 51 | 1 52 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 53 | Variable_name Value 54 | Spider_direct_aggregate 0 55 | SELECT MAX(a) FROM ta_l2 WHERE a < 5; 56 | MAX(a) 57 | 4 58 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 59 | Variable_name Value 60 | Spider_direct_aggregate 0 61 | SELECT MIN(a) FROM ta_l2 WHERE a > 1; 62 | MIN(a) 63 | 2 64 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 65 | Variable_name Value 66 | Spider_direct_aggregate 0 67 | 68 | deinit 69 | DROP DATABASE IF EXISTS auto_test_local; 70 | DROP DATABASE IF EXISTS auto_test_remote; 71 | DROP DATABASE IF EXISTS auto_test_remote2; 72 | for master_1 73 | for child2 74 | child2_1 75 | child2_2 76 | child2_3 77 | for child3 78 | child3_1 79 | child3_2 80 | child3_3 81 | 82 | end of test 83 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/r/vp_fixes.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table and insert 28 | DROP TABLE IF EXISTS tb_l; 29 | CREATE TABLE tb_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE2 MASTER_1_CHARSET2 35 | INSERT INTO tb_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | DROP TABLE IF EXISTS ta_l; 42 | CREATE TABLE ta_l ( 43 | PRIMARY KEY(a) 44 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 45 | INSERT INTO ta_l SELECT a, b, c FROM tb_l; 46 | 47 | 0.9 48 | create different primary key table 49 | CREATE TABLE ta_l_int ( 50 | a INT DEFAULT 10, 51 | b INT AUTO_INCREMENT, 52 | c INT DEFAULT 11, 53 | PRIMARY KEY(b) 54 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 55 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 56 | create un-correspond primary key table 57 | DROP TABLE IF EXISTS ta_l_int; 58 | CREATE TABLE ta_l_int ( 59 | a INT DEFAULT 10, 60 | b INT DEFAULT 12, 61 | c INT DEFAULT 11, 62 | PRIMARY KEY(c) 63 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 64 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 65 | 66 | deinit 67 | DROP DATABASE IF EXISTS auto_test_local; 68 | DROP DATABASE IF EXISTS auto_test_remote; 69 | DROP DATABASE IF EXISTS auto_test_remote2; 70 | for master_1 71 | for child2 72 | child2_1 73 | child2_2 74 | child2_3 75 | for child3 76 | child3_1 77 | child3_2 78 | child3_3 79 | 80 | end of test 81 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/suite.opt: -------------------------------------------------------------------------------- 1 | --loose-innodb --loose-skip-performance-schema 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/suite.pm: -------------------------------------------------------------------------------- 1 | package My::Suite::Spider; 2 | 3 | @ISA = qw(My::Suite); 4 | 5 | return "No Spider engine" unless $ENV{HA_SPIDER_SO}; 6 | return "Not run for embedded server" if $::opt_embedded_server; 7 | 8 | bless { }; 9 | 10 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/connect_child2_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/connect_child2_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/connect_child2_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/connect_child3_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/connect_child3_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/connect_child3_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/connect_master_1.inc: -------------------------------------------------------------------------------- 1 | --connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/connect_slave1_1.inc: -------------------------------------------------------------------------------- 1 | --connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/ha_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_deinit_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_deinit_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_deinit_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_deinit_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/ha_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_init_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_init_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_init_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_init_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/have_engine.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM information_schema.engines WHERE 2 | (support = 'YES' OR support = 'DEFAULT') AND 3 | engine = '$TEST_ENGINE_TYPE'`) 4 | { 5 | SELECT engine, support FROM information_schema.engines; 6 | --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/have_func.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`) 2 | { 3 | SELECT name FROM mysql.func; 4 | --let $SKIP_REASON= "Need $TEST_FUNC_NAME function" 5 | } 6 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/have_partition.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_PARTITION= 0; 2 | if (`SELECT count(*) FROM information_schema.plugins WHERE 3 | plugin_status = 'ACTIVE' AND 4 | plugin_name = 'partition'`) 5 | { 6 | let $HAVE_PARTITION= 1; 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/have_trigger.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables 2 | WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`; 3 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/hs_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_deinit_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/hs_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_init_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/slave_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --connection slave1_1 4 | STOP SLAVE; 5 | --source ../include/deinit_slave1_1.inc 6 | --disconnect slave1_1 7 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/slave_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --source connect_slave1_1.inc 4 | --connection slave1_1 5 | SET SESSION sql_log_bin= 0; 6 | --let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id` 7 | --let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE 8 | --source have_partition.inc 9 | --source have_trigger.inc 10 | --source ../include/init_slave1_1.inc 11 | --source have_engine.inc 12 | --let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` 13 | if (!$SLAVE1_1_SLAVE_STATUS) 14 | { 15 | eval CHANGE MASTER TO 16 | MASTER_HOST = '127.0.0.1', 17 | MASTER_USER = 'root', 18 | MASTER_PASSWORD = '', 19 | MASTER_PORT = $MASTER_1_MYPORT 20 | ; 21 | } 22 | START SLAVE; 23 | --connection master_1 24 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 25 | --connection slave1_1 26 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 27 | if ($USE_CHILD_GROUP2) 28 | { 29 | --connection child2_1 30 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 31 | --connection child2_2 32 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 33 | --connection child2_3 34 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 35 | } 36 | if ($USE_CHILD_GROUP3) 37 | { 38 | --connection child3_1 39 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 40 | --connection child3_2 41 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 42 | --connection child3_3 43 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 44 | } 45 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/deinit_master_1.inc 5 | --disconnect master_1 6 | --echo for child2 7 | if ($USE_CHILD_GROUP2) 8 | { 9 | --echo child2_1 10 | --connection child2_1 11 | --source ../include/deinit_child2_1.inc 12 | --disconnect child2_1 13 | --echo child2_2 14 | --connection child2_2 15 | --source ../include/deinit_child2_2.inc 16 | --disconnect child2_2 17 | --echo child2_3 18 | --connection child2_3 19 | --source ../include/deinit_child2_3.inc 20 | --disconnect child2_3 21 | } 22 | --echo for child3 23 | if ($USE_CHILD_GROUP3) 24 | { 25 | --echo child3_1 26 | --connection child3_1 27 | --source ../include/deinit_child3_1.inc 28 | --disconnect child3_1 29 | --echo child3_2 30 | --connection child3_2 31 | --source ../include/deinit_child3_2.inc 32 | --disconnect child3_2 33 | --echo child3_3 34 | --connection child3_3 35 | --source ../include/deinit_child3_3.inc 36 | --disconnect child3_3 37 | } 38 | -------------------------------------------------------------------------------- /src/mysql-test/spider/bg/t/test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --source connect_master_1.inc 4 | --connection master_1 5 | CALL mtr.add_suppression("unknown variable"); 6 | SET SESSION sql_log_bin= 0; 7 | --let $MASTER_1_SERVER_ID=`SELECT @@global.server_id` 8 | --let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE 9 | --source have_partition.inc 10 | --source have_trigger.inc 11 | --source ../include/init_master_1.inc 12 | --source have_engine.inc 13 | --echo for child2 14 | if ($USE_CHILD_GROUP2) 15 | { 16 | --echo child2_1 17 | --source connect_child2_1.inc 18 | --connection child2_1 19 | CALL mtr.add_suppression("unknown variable *"); 20 | SET SESSION sql_log_bin= 0; 21 | --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id` 22 | --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE 23 | --source ../include/init_child2_1.inc 24 | --source have_engine.inc 25 | --echo child2_2 26 | --source connect_child2_2.inc 27 | --connection child2_2 28 | CALL mtr.add_suppression("unknown variable *"); 29 | SET SESSION sql_log_bin= 0; 30 | --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id` 31 | --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE 32 | --source ../include/init_child2_2.inc 33 | --source have_engine.inc 34 | --echo child2_3 35 | --source connect_child2_3.inc 36 | --connection child2_3 37 | CALL mtr.add_suppression("unknown variable *"); 38 | SET SESSION sql_log_bin= 0; 39 | --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id` 40 | --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE 41 | --source ../include/init_child2_3.inc 42 | --source have_engine.inc 43 | } 44 | --echo for child3 45 | if ($USE_CHILD_GROUP3) 46 | { 47 | --echo child3_1 48 | --source connect_child3_1.inc 49 | --connection child3_1 50 | CALL mtr.add_suppression("unknown variable *"); 51 | SET SESSION sql_log_bin= 0; 52 | --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id` 53 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 54 | --source ../include/init_child3_1.inc 55 | --source have_engine.inc 56 | --echo child3_2 57 | --source connect_child3_2.inc 58 | --connection child3_2 59 | CALL mtr.add_suppression("unknown variable *"); 60 | SET SESSION sql_log_bin= 0; 61 | --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id` 62 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 63 | --source ../include/init_child3_2.inc 64 | --source have_engine.inc 65 | --echo child3_3 66 | --source connect_child3_3.inc 67 | --connection child3_3 68 | CALL mtr.add_suppression("unknown variable *"); 69 | SET SESSION sql_log_bin= 0; 70 | --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id` 71 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 72 | --source ../include/init_child3_3.inc 73 | --source have_engine.inc 74 | } 75 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/deinit_child3_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/deinit_child3_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/deinit_child3_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/deinit_child3_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/deinit_child3_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/deinit_child3_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/deinit_master_1.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/deinit_slave1_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/deinit_slave1_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/ha_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/ha_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/ha_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_deinit_child3_1.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_deinit_child3_2.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_deinit_child3_3.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/ha_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HA_AS_DROP_TABLES= 2 | $CHILD2_1_DROP_TABLES; 3 | let $CHILD2_1_HA_AS_CREATE_TABLES= 4 | $CHILD2_1_CREATE_TABLES; 5 | let $CHILD2_1_HA_AS_DROP_TABLES2= 6 | $CHILD2_1_DROP_TABLES2; 7 | let $CHILD2_1_HA_AS_CREATE_TABLES2= 8 | $CHILD2_1_CREATE_TABLES2; 9 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HA_DROP_TABLES= 2 | $CHILD2_2_DROP_TABLES; 3 | let $CHILD2_2_HA_CREATE_TABLES= 4 | $CHILD2_2_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/ha_init_child2_3.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_3_HA_DROP_TABLES= 2 | $CHILD2_3_DROP_TABLES; 3 | let $CHILD2_3_HA_CREATE_TABLES= 4 | $CHILD2_3_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/hs_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/hs_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/hs_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/hs_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/hs_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/hs_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/hs_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/hs_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/hs_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HS_DROP_TABLES= 2 | DROP TABLE IF EXISTS hs_r; 3 | let $CHILD2_1_HS_CREATE_TABLES= 4 | CREATE TABLE hs_r ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | d INT DEFAULT 11, 9 | PRIMARY KEY(a) 10 | ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; 11 | let $CHILD2_1_HS_SELECT_TABLES= 12 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a; 13 | let $CHILD2_1_HS_DROP_TABLES2= 14 | DROP TABLE IF EXISTS hs_r2; 15 | let $CHILD2_1_HS_CREATE_TABLES2= 16 | CREATE TABLE hs_r2 ( 17 | a INT DEFAULT 10, 18 | b CHAR(1) DEFAULT 'c', 19 | c DATETIME DEFAULT '1999-10-10 10:10:10', 20 | d INT DEFAULT 11, 21 | PRIMARY KEY(a) 22 | ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; 23 | let $CHILD2_1_HS_SELECT_TABLES2= 24 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a; 25 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/hs_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HS_DROP_TABLES= 2 | DROP TABLE IF EXISTS hs_r3; 3 | let $CHILD2_2_HS_CREATE_TABLES= 4 | CREATE TABLE hs_r3 ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | d INT DEFAULT 11, 9 | PRIMARY KEY(a) 10 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 11 | let $CHILD2_2_HS_SELECT_TABLES= 12 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a; 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/hs_init_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/hs_init_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/hs_init_master_1.inc: -------------------------------------------------------------------------------- 1 | let $MASTER_1_HS_COMMENT_TMP= 2 | COMMENT=''; 3 | let $MASTER_1_HS_COMMENT_2_1= 4 | COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; 5 | let $MASTER_1_HS_COMMENT_P_2_1= 6 | COMMENT='uhr "1", uhw "1"' 7 | PARTITION BY RANGE(a) ( 8 | PARTITION pt1 VALUES LESS THAN (4) 9 | COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', 10 | PARTITION pt2 VALUES LESS THAN MAXVALUE 11 | COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' 12 | ); 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_DROP_TABLES= 2 | DROP TABLE IF EXISTS ta_r3; 3 | let $CHILD2_2_CREATE_TABLES= 4 | CREATE TABLE ta_r3 ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | PRIMARY KEY(a) 9 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 10 | let $CHILD2_2_DROP_TABLES5= 11 | DROP TABLE IF EXISTS ta_r_int; 12 | let $CHILD2_2_CREATE_TABLES5= 13 | CREATE TABLE ta_r_int ( 14 | a INT AUTO_INCREMENT, 15 | b INT DEFAULT 10, 16 | c INT DEFAULT 11, 17 | PRIMARY KEY(a), 18 | KEY idx1(b), 19 | KEY idx2(c) 20 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 21 | let $CHILD2_2_SELECT_TABLES= 22 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; 23 | let $CHILD2_2_DROP_FT_TABLES= 24 | DROP TABLE IF EXISTS ft_r3; 25 | let $CHILD2_2_CREATE_FT_TABLES= 26 | CREATE TABLE ft_r3 ( 27 | a INT DEFAULT 0, 28 | b TEXT, 29 | c TEXT, 30 | d TEXT, 31 | PRIMARY KEY(a), 32 | FULLTEXT INDEX ft_idx1(b), 33 | FULLTEXT INDEX ft_idx2(c) 34 | ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET; 35 | let $CHILD2_2_SELECT_FT_TABLES= 36 | SELECT a, b, c, d FROM ft_r3 ORDER BY a; 37 | let $CHILD2_2_DROP_GM_TABLES= 38 | DROP TABLE IF EXISTS gm_r3; 39 | let $CHILD2_2_CREATE_GM_TABLES= 40 | CREATE TABLE gm_r3 ( 41 | a INT DEFAULT 0, 42 | b GEOMETRY NOT NULL, 43 | c GEOMETRY NOT NULL, 44 | PRIMARY KEY(a), 45 | SPATIAL INDEX sp_idx1(b), 46 | SPATIAL INDEX sp_idx2(c) 47 | ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET; 48 | let $CHILD2_2_SELECT_GM_TABLES= 49 | SELECT a, b, c FROM gm_r3 ORDER BY a; 50 | let $CHILD2_2_DROP_LOCK_TABLES1= 51 | DROP TABLE IF EXISTS t1_2; 52 | let $CHILD2_2_CREATE_LOCK_TABLES1= 53 | CREATE TABLE t1_2 ( 54 | id int(11) NOT NULL, 55 | PRIMARY KEY (id) 56 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 57 | let $CHILD2_2_DROP_LOCK_TABLES2= 58 | DROP TABLE IF EXISTS t2_1; 59 | let $CHILD2_2_CREATE_LOCK_TABLES2= 60 | CREATE TABLE t2_1 ( 61 | id int(11) NOT NULL, 62 | PRIMARY KEY (id) 63 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 64 | let $CHILD2_2_DROP_INCREMENT_TABLES1= 65 | DROP TABLE IF EXISTS t1_2; 66 | let $CHILD2_2_CREATE_INCREMENT_TABLES1= 67 | CREATE TABLE t1_2 ( 68 | id int(11) NOT NULL AUTO_INCREMENT, 69 | PRIMARY KEY (id) 70 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 71 | let $CHILD2_2_SELECT_INCREMENT_TABLES1= 72 | SELECT id FROM t1_2 ORDER BY id; 73 | let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= 74 | SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; 75 | let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= 76 | SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; 77 | let $CHILD2_2_AUTO_INCREMENT_OFFSET1= 78 | SET GLOBAL AUTO_INCREMENT_OFFSET = 1; 79 | let $CHILD2_2_AUTO_INCREMENT_OFFSET2= 80 | SET GLOBAL AUTO_INCREMENT_OFFSET = 3; 81 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/init_child2_3.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_3_DROP_TABLES= 2 | DROP TABLE IF EXISTS ta_r4; 3 | let $CHILD2_3_CREATE_TABLES= 4 | CREATE TABLE ta_r4 ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | PRIMARY KEY(a) 9 | ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET; 10 | let $CHILD2_3_SELECT_TABLES= 11 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; 12 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/init_child3_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/init_child3_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/init_child3_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/init_child3_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/init_child3_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/handler/include/init_child3_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/include/init_slave1_1.inc: -------------------------------------------------------------------------------- 1 | let $SLAVE1_1_COMMENT_INCREMENT1_1= 2 | COMMENT ''; 3 | let $SLAVE1_1_COMMENT_INCREMENT1_P_1= 4 | COMMENT '' 5 | PARTITION BY LIST(MOD(id, 2)) ( 6 | PARTITION pt1 VALUES IN (0) 7 | COMMENT='', 8 | PARTITION pt2 VALUES IN (1) 9 | COMMENT='' 10 | ); 11 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/r/direct_aggregate.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table select test 28 | DROP TABLE IF EXISTS ta_l; 29 | CREATE TABLE ta_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 35 | INSERT INTO ta_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | 42 | direct_aggregating test 43 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 44 | Variable_name Value 45 | Spider_direct_aggregate 0 46 | SELECT COUNT(*) FROM ta_l; 47 | COUNT(*) 48 | 5 49 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 50 | Variable_name Value 51 | Spider_direct_aggregate 1 52 | SELECT MAX(a) FROM ta_l; 53 | MAX(a) 54 | 5 55 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 56 | Variable_name Value 57 | Spider_direct_aggregate 2 58 | SELECT MIN(a) FROM ta_l; 59 | MIN(a) 60 | 1 61 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 62 | Variable_name Value 63 | Spider_direct_aggregate 3 64 | SELECT MAX(a) FROM ta_l WHERE a < 5; 65 | MAX(a) 66 | 4 67 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 68 | Variable_name Value 69 | Spider_direct_aggregate 4 70 | SELECT MIN(a) FROM ta_l WHERE a > 1; 71 | MIN(a) 72 | 2 73 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 74 | Variable_name Value 75 | Spider_direct_aggregate 5 76 | 77 | handler with partition test 78 | CREATE TABLE ta_l2 ( 79 | a INT, 80 | b CHAR(1), 81 | c DATETIME, 82 | PRIMARY KEY(a) 83 | ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 84 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 85 | Variable_name Value 86 | Spider_direct_aggregate 5 87 | SELECT COUNT(*) FROM ta_l2; 88 | COUNT(*) 89 | 5 90 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 91 | Variable_name Value 92 | Spider_direct_aggregate 7 93 | SELECT MAX(a) FROM ta_l2; 94 | MAX(a) 95 | 5 96 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 97 | Variable_name Value 98 | Spider_direct_aggregate 9 99 | SELECT MIN(a) FROM ta_l2; 100 | MIN(a) 101 | 1 102 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 103 | Variable_name Value 104 | Spider_direct_aggregate 11 105 | SELECT MAX(a) FROM ta_l2 WHERE a < 5; 106 | MAX(a) 107 | 4 108 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 109 | Variable_name Value 110 | Spider_direct_aggregate 13 111 | SELECT MIN(a) FROM ta_l2 WHERE a > 1; 112 | MIN(a) 113 | 2 114 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 115 | Variable_name Value 116 | Spider_direct_aggregate 15 117 | 118 | deinit 119 | DROP DATABASE IF EXISTS auto_test_local; 120 | DROP DATABASE IF EXISTS auto_test_remote; 121 | DROP DATABASE IF EXISTS auto_test_remote2; 122 | for master_1 123 | for child2 124 | child2_1 125 | child2_2 126 | child2_3 127 | for child3 128 | child3_1 129 | child3_2 130 | child3_3 131 | 132 | end of test 133 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/r/vp_fixes.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table and insert 28 | DROP TABLE IF EXISTS tb_l; 29 | CREATE TABLE tb_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE2 MASTER_1_CHARSET2 35 | INSERT INTO tb_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | DROP TABLE IF EXISTS ta_l; 42 | CREATE TABLE ta_l ( 43 | PRIMARY KEY(a) 44 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 45 | INSERT INTO ta_l SELECT a, b, c FROM tb_l; 46 | 47 | 0.9 48 | create different primary key table 49 | CREATE TABLE ta_l_int ( 50 | a INT DEFAULT 10, 51 | b INT AUTO_INCREMENT, 52 | c INT DEFAULT 11, 53 | PRIMARY KEY(b) 54 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 55 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 56 | create un-correspond primary key table 57 | DROP TABLE IF EXISTS ta_l_int; 58 | CREATE TABLE ta_l_int ( 59 | a INT DEFAULT 10, 60 | b INT DEFAULT 12, 61 | c INT DEFAULT 11, 62 | PRIMARY KEY(c) 63 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 64 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 65 | 66 | deinit 67 | DROP DATABASE IF EXISTS auto_test_local; 68 | DROP DATABASE IF EXISTS auto_test_remote; 69 | DROP DATABASE IF EXISTS auto_test_remote2; 70 | for master_1 71 | for child2 72 | child2_1 73 | child2_2 74 | child2_3 75 | for child3 76 | child3_1 77 | child3_2 78 | child3_3 79 | 80 | end of test 81 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/connect_child2_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/connect_child2_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/connect_child2_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/connect_child3_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/connect_child3_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/connect_child3_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/connect_master_1.inc: -------------------------------------------------------------------------------- 1 | --connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/connect_slave1_1.inc: -------------------------------------------------------------------------------- 1 | --connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/ha_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_deinit_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_deinit_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_deinit_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_deinit_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/ha_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_init_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_init_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_init_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_init_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/have_engine.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM information_schema.engines WHERE 2 | (support = 'YES' OR support = 'DEFAULT') AND 3 | engine = '$TEST_ENGINE_TYPE'`) 4 | { 5 | SELECT engine, support FROM information_schema.engines; 6 | --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/have_func.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`) 2 | { 3 | SELECT name FROM mysql.func; 4 | --let $SKIP_REASON= "Need $TEST_FUNC_NAME function" 5 | } 6 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/have_partition.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_PARTITION= 0; 2 | if (`SELECT count(*) FROM information_schema.plugins WHERE 3 | plugin_status = 'ACTIVE' AND 4 | plugin_name = 'partition'`) 5 | { 6 | let $HAVE_PARTITION= 1; 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/have_trigger.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables 2 | WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`; 3 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/hs_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_deinit_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/hs_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_init_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/slave_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --connection slave1_1 4 | STOP SLAVE; 5 | --source ../include/deinit_slave1_1.inc 6 | --disconnect slave1_1 7 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/slave_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --source connect_slave1_1.inc 4 | --connection slave1_1 5 | SET SESSION sql_log_bin= 0; 6 | --let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id` 7 | --let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE 8 | --source have_partition.inc 9 | --source have_trigger.inc 10 | --source ../include/init_slave1_1.inc 11 | --source have_engine.inc 12 | --let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` 13 | if (!$SLAVE1_1_SLAVE_STATUS) 14 | { 15 | eval CHANGE MASTER TO 16 | MASTER_HOST = '127.0.0.1', 17 | MASTER_USER = 'root', 18 | MASTER_PASSWORD = '', 19 | MASTER_PORT = $MASTER_1_MYPORT 20 | ; 21 | } 22 | START SLAVE; 23 | --connection master_1 24 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 25 | --connection slave1_1 26 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 27 | if ($USE_CHILD_GROUP2) 28 | { 29 | --connection child2_1 30 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 31 | --connection child2_2 32 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 33 | --connection child2_3 34 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 35 | } 36 | if ($USE_CHILD_GROUP3) 37 | { 38 | --connection child3_1 39 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 40 | --connection child3_2 41 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 42 | --connection child3_3 43 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 44 | } 45 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/deinit_master_1.inc 5 | --disconnect master_1 6 | --echo for child2 7 | if ($USE_CHILD_GROUP2) 8 | { 9 | --echo child2_1 10 | --connection child2_1 11 | --source ../include/deinit_child2_1.inc 12 | --disconnect child2_1 13 | --echo child2_2 14 | --connection child2_2 15 | --source ../include/deinit_child2_2.inc 16 | --disconnect child2_2 17 | --echo child2_3 18 | --connection child2_3 19 | --source ../include/deinit_child2_3.inc 20 | --disconnect child2_3 21 | } 22 | --echo for child3 23 | if ($USE_CHILD_GROUP3) 24 | { 25 | --echo child3_1 26 | --connection child3_1 27 | --source ../include/deinit_child3_1.inc 28 | --disconnect child3_1 29 | --echo child3_2 30 | --connection child3_2 31 | --source ../include/deinit_child3_2.inc 32 | --disconnect child3_2 33 | --echo child3_3 34 | --connection child3_3 35 | --source ../include/deinit_child3_3.inc 36 | --disconnect child3_3 37 | } 38 | -------------------------------------------------------------------------------- /src/mysql-test/spider/handler/t/test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --source connect_master_1.inc 4 | --connection master_1 5 | CALL mtr.add_suppression("unknown variable"); 6 | SET SESSION sql_log_bin= 0; 7 | --let $MASTER_1_SERVER_ID=`SELECT @@global.server_id` 8 | --let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE 9 | --source have_partition.inc 10 | --source have_trigger.inc 11 | --source ../include/init_master_1.inc 12 | --source have_engine.inc 13 | --echo for child2 14 | if ($USE_CHILD_GROUP2) 15 | { 16 | --echo child2_1 17 | --source connect_child2_1.inc 18 | --connection child2_1 19 | CALL mtr.add_suppression("unknown variable *"); 20 | SET SESSION sql_log_bin= 0; 21 | --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id` 22 | --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE 23 | --source ../include/init_child2_1.inc 24 | --source have_engine.inc 25 | --echo child2_2 26 | --source connect_child2_2.inc 27 | --connection child2_2 28 | CALL mtr.add_suppression("unknown variable *"); 29 | SET SESSION sql_log_bin= 0; 30 | --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id` 31 | --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE 32 | --source ../include/init_child2_2.inc 33 | --source have_engine.inc 34 | --echo child2_3 35 | --source connect_child2_3.inc 36 | --connection child2_3 37 | CALL mtr.add_suppression("unknown variable *"); 38 | SET SESSION sql_log_bin= 0; 39 | --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id` 40 | --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE 41 | --source ../include/init_child2_3.inc 42 | --source have_engine.inc 43 | } 44 | --echo for child3 45 | if ($USE_CHILD_GROUP3) 46 | { 47 | --echo child3_1 48 | --source connect_child3_1.inc 49 | --connection child3_1 50 | CALL mtr.add_suppression("unknown variable *"); 51 | SET SESSION sql_log_bin= 0; 52 | --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id` 53 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 54 | --source ../include/init_child3_1.inc 55 | --source have_engine.inc 56 | --echo child3_2 57 | --source connect_child3_2.inc 58 | --connection child3_2 59 | CALL mtr.add_suppression("unknown variable *"); 60 | SET SESSION sql_log_bin= 0; 61 | --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id` 62 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 63 | --source ../include/init_child3_2.inc 64 | --source have_engine.inc 65 | --echo child3_3 66 | --source connect_child3_3.inc 67 | --connection child3_3 68 | CALL mtr.add_suppression("unknown variable *"); 69 | SET SESSION sql_log_bin= 0; 70 | --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id` 71 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 72 | --source ../include/init_child3_3.inc 73 | --source have_engine.inc 74 | } 75 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_child2_1.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD2_1_ENGINE 3 | --source ../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_child2_2.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD2_2_ENGINE 3 | --source ../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_child2_3.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD2_3_ENGINE 3 | --source ../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_child3_1.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE 3 | --source ../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_child3_2.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE 3 | --source ../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_child3_3.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE 3 | --source ../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_engine.inc: -------------------------------------------------------------------------------- 1 | if ($INIT_TEST_ENGINE) 2 | { 3 | --echo Deinit $TEST_ENGINE_TYPE engine 4 | } 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_handlersocket.inc: -------------------------------------------------------------------------------- 1 | UNINSTALL PLUGIN handlersocket; 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_innodb_plugin.inc: -------------------------------------------------------------------------------- 1 | UNINSTALL PLUGIN InnoDB; 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_master_1.inc: -------------------------------------------------------------------------------- 1 | --source ../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_slave1_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/deinit_slave1_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/deinit_spider.inc: -------------------------------------------------------------------------------- 1 | DROP FUNCTION spider_direct_sql; 2 | DROP FUNCTION spider_bg_direct_sql; 3 | DROP FUNCTION spider_ping_table; 4 | DROP FUNCTION spider_copy_tables; 5 | DROP FUNCTION spider_flush_table_mon_cache; 6 | UNINSTALL PLUGIN spider; 7 | DROP TABLE IF EXISTS mysql.spider_xa; 8 | DROP TABLE IF EXISTS mysql.spider_xa_member; 9 | DROP TABLE IF EXISTS mysql.spider_tables; 10 | DROP TABLE IF EXISTS mysql.spider_link_mon_servers; 11 | DROP TABLE IF EXISTS mysql.spider_link_failed_log; 12 | DROP SERVER s_2_1; 13 | DROP SERVER s_2_2; 14 | DROP SERVER s_2_3; 15 | DROP SERVER s_3_1; 16 | DROP SERVER s_3_2; 17 | DROP SERVER s_3_3; 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/ha_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/ha_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/ha_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_deinit_child3_1.inc: -------------------------------------------------------------------------------- 1 | --source ../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_deinit_child3_2.inc: -------------------------------------------------------------------------------- 1 | --source ../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_deinit_child3_3.inc: -------------------------------------------------------------------------------- 1 | --source ../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/ha_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HA_AS_DROP_TABLES= 2 | $CHILD2_1_DROP_TABLES; 3 | let $CHILD2_1_HA_AS_CREATE_TABLES= 4 | $CHILD2_1_CREATE_TABLES; 5 | let $CHILD2_1_HA_AS_DROP_TABLES2= 6 | $CHILD2_1_DROP_TABLES2; 7 | let $CHILD2_1_HA_AS_CREATE_TABLES2= 8 | $CHILD2_1_CREATE_TABLES2; 9 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HA_DROP_TABLES= 2 | $CHILD2_2_DROP_TABLES; 3 | let $CHILD2_2_HA_CREATE_TABLES= 4 | $CHILD2_2_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/ha_init_child2_3.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_3_HA_DROP_TABLES= 2 | $CHILD2_3_DROP_TABLES; 3 | let $CHILD2_3_HA_CREATE_TABLES= 4 | $CHILD2_3_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/hs_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/hs_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/hs_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/hs_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/hs_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/hs_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/hs_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/hs_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/hs_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HS_DROP_TABLES= 2 | DROP TABLE IF EXISTS hs_r; 3 | let $CHILD2_1_HS_CREATE_TABLES= 4 | CREATE TABLE hs_r ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | d INT DEFAULT 11, 9 | PRIMARY KEY(a) 10 | ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; 11 | let $CHILD2_1_HS_SELECT_TABLES= 12 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r ORDER BY a; 13 | let $CHILD2_1_HS_DROP_TABLES2= 14 | DROP TABLE IF EXISTS hs_r2; 15 | let $CHILD2_1_HS_CREATE_TABLES2= 16 | CREATE TABLE hs_r2 ( 17 | a INT DEFAULT 10, 18 | b CHAR(1) DEFAULT 'c', 19 | c DATETIME DEFAULT '1999-10-10 10:10:10', 20 | d INT DEFAULT 11, 21 | PRIMARY KEY(a) 22 | ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; 23 | let $CHILD2_1_HS_SELECT_TABLES2= 24 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r2 ORDER BY a; 25 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/hs_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HS_DROP_TABLES= 2 | DROP TABLE IF EXISTS hs_r3; 3 | let $CHILD2_2_HS_CREATE_TABLES= 4 | CREATE TABLE hs_r3 ( 5 | a INT DEFAULT 10, 6 | b CHAR(1) DEFAULT 'c', 7 | c DATETIME DEFAULT '1999-10-10 10:10:10', 8 | d INT DEFAULT 11, 9 | PRIMARY KEY(a) 10 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 11 | let $CHILD2_2_HS_SELECT_TABLES= 12 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s'), d FROM hs_r3 ORDER BY a; 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/hs_init_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/include/hs_init_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/include/hs_init_master_1.inc: -------------------------------------------------------------------------------- 1 | let $MASTER_1_HS_COMMENT_TMP= 2 | COMMENT=''; 3 | let $MASTER_1_HS_COMMENT_2_1= 4 | COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; 5 | let $MASTER_1_HS_COMMENT_P_2_1= 6 | COMMENT='uhr "1", uhw "1"' 7 | PARTITION BY RANGE(a) ( 8 | PARTITION pt1 VALUES LESS THAN (4) 9 | COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', 10 | PARTITION pt2 VALUES LESS THAN MAXVALUE 11 | COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' 12 | ); 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/init_child2_2.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE 2 | --source ../include/init_engine.inc 3 | --let $INIT_CHILD2_2_ENGINE= $INIT_TEST_ENGINE 4 | let $CHILD2_2_DROP_TABLES= 5 | DROP TABLE IF EXISTS ta_r3; 6 | let $CHILD2_2_CREATE_TABLES= 7 | CREATE TABLE ta_r3 ( 8 | a INT DEFAULT 10, 9 | b CHAR(1) DEFAULT 'c', 10 | c DATETIME DEFAULT '1999-10-10 10:10:10', 11 | PRIMARY KEY(a) 12 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 13 | let $CHILD2_2_DROP_TABLES5= 14 | DROP TABLE IF EXISTS ta_r_int; 15 | let $CHILD2_2_CREATE_TABLES5= 16 | CREATE TABLE ta_r_int ( 17 | a INT AUTO_INCREMENT, 18 | b INT DEFAULT 10, 19 | c INT DEFAULT 11, 20 | PRIMARY KEY(a), 21 | KEY idx1(b), 22 | KEY idx2(c) 23 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 24 | let $CHILD2_2_SELECT_TABLES= 25 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; 26 | let $CHILD2_2_DROP_FT_TABLES= 27 | DROP TABLE IF EXISTS ft_r3; 28 | let $CHILD2_2_CREATE_FT_TABLES= 29 | CREATE TABLE ft_r3 ( 30 | a INT DEFAULT 0, 31 | b TEXT, 32 | c TEXT, 33 | d TEXT, 34 | PRIMARY KEY(a), 35 | FULLTEXT INDEX ft_idx1(b), 36 | FULLTEXT INDEX ft_idx2(c) 37 | ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET; 38 | let $CHILD2_2_SELECT_FT_TABLES= 39 | SELECT a, b, c, d FROM ft_r3 ORDER BY a; 40 | let $CHILD2_2_DROP_GM_TABLES= 41 | DROP TABLE IF EXISTS gm_r3; 42 | let $CHILD2_2_CREATE_GM_TABLES= 43 | CREATE TABLE gm_r3 ( 44 | a INT DEFAULT 0, 45 | b GEOMETRY NOT NULL, 46 | c GEOMETRY NOT NULL, 47 | PRIMARY KEY(a), 48 | SPATIAL INDEX sp_idx1(b), 49 | SPATIAL INDEX sp_idx2(c) 50 | ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET; 51 | let $CHILD2_2_SELECT_GM_TABLES= 52 | SELECT a, b, c FROM gm_r3 ORDER BY a; 53 | let $CHILD2_2_DROP_LOCK_TABLES1= 54 | DROP TABLE IF EXISTS t1_2; 55 | let $CHILD2_2_CREATE_LOCK_TABLES1= 56 | CREATE TABLE t1_2 ( 57 | id int(11) NOT NULL, 58 | PRIMARY KEY (id) 59 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 60 | let $CHILD2_2_DROP_LOCK_TABLES2= 61 | DROP TABLE IF EXISTS t2_1; 62 | let $CHILD2_2_CREATE_LOCK_TABLES2= 63 | CREATE TABLE t2_1 ( 64 | id int(11) NOT NULL, 65 | PRIMARY KEY (id) 66 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 67 | let $CHILD2_2_DROP_INCREMENT_TABLES1= 68 | DROP TABLE IF EXISTS t1_2; 69 | let $CHILD2_2_CREATE_INCREMENT_TABLES1= 70 | CREATE TABLE t1_2 ( 71 | id int(11) NOT NULL AUTO_INCREMENT, 72 | PRIMARY KEY (id) 73 | ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; 74 | let $CHILD2_2_SELECT_INCREMENT_TABLES1= 75 | SELECT id FROM t1_2 ORDER BY id; 76 | let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= 77 | SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; 78 | let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= 79 | SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; 80 | let $CHILD2_2_AUTO_INCREMENT_OFFSET1= 81 | SET GLOBAL AUTO_INCREMENT_OFFSET = 1; 82 | let $CHILD2_2_AUTO_INCREMENT_OFFSET2= 83 | SET GLOBAL AUTO_INCREMENT_OFFSET = 3; 84 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/init_child2_3.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE 2 | --source ../include/init_engine.inc 3 | --let $INIT_CHILD2_3_ENGINE= $INIT_TEST_ENGINE 4 | let $CHILD2_3_DROP_TABLES= 5 | DROP TABLE IF EXISTS ta_r4; 6 | let $CHILD2_3_CREATE_TABLES= 7 | CREATE TABLE ta_r4 ( 8 | a INT DEFAULT 10, 9 | b CHAR(1) DEFAULT 'c', 10 | c DATETIME DEFAULT '1999-10-10 10:10:10', 11 | PRIMARY KEY(a) 12 | ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET; 13 | let $CHILD2_3_SELECT_TABLES= 14 | SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; 15 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/init_child3_1.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 2 | --source ../include/init_engine.inc 3 | --let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/init_child3_2.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 2 | --source ../include/init_engine.inc 3 | --let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/init_child3_3.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 2 | --source ../include/init_engine.inc 3 | --let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/init_engine.inc: -------------------------------------------------------------------------------- 1 | let $INIT_TEST_ENGINE=0; 2 | if (!`SELECT count(*) FROM information_schema.engines WHERE 3 | (support = 'YES' OR support = 'DEFAULT') AND 4 | engine = '$TEST_ENGINE_TYPE'`) 5 | { 6 | if (!$SKIP_REASON) 7 | { 8 | --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/mysql-test/spider/include/init_slave1_1.inc: -------------------------------------------------------------------------------- 1 | let $SLAVE1_1_COMMENT_INCREMENT1_1= 2 | COMMENT ''; 3 | let $SLAVE1_1_COMMENT_INCREMENT1_P_1= 4 | COMMENT '' 5 | PARTITION BY LIST(MOD(id, 2)) ( 6 | PARTITION pt1 VALUES IN (0) 7 | COMMENT='', 8 | PARTITION pt2 VALUES IN (1) 9 | COMMENT='' 10 | ); 11 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/deinit_child3_1.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE 3 | --source ../../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/deinit_child3_2.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE 3 | --source ../../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/deinit_child3_3.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE 3 | --source ../../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/deinit_master_1.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/deinit_slave1_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/deinit_slave1_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/ha_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/ha_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/ha_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_deinit_child3_1.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_deinit_child3_2.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_deinit_child3_3.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/ha_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HA_AS_DROP_TABLES= 2 | $CHILD2_1_DROP_TABLES; 3 | let $CHILD2_1_HA_AS_CREATE_TABLES= 4 | $CHILD2_1_CREATE_TABLES; 5 | let $CHILD2_1_HA_AS_DROP_TABLES2= 6 | $CHILD2_1_DROP_TABLES2; 7 | let $CHILD2_1_HA_AS_CREATE_TABLES2= 8 | $CHILD2_1_CREATE_TABLES2; 9 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HA_DROP_TABLES= 2 | $CHILD2_2_DROP_TABLES; 3 | let $CHILD2_2_HA_CREATE_TABLES= 4 | $CHILD2_2_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/ha_init_child2_3.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_3_HA_DROP_TABLES= 2 | $CHILD2_3_DROP_TABLES; 3 | let $CHILD2_3_HA_CREATE_TABLES= 4 | $CHILD2_3_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/hs_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/hs_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/hs_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/hs_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/hs_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/hs_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HS_DROP_TABLES= 2 | SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); 3 | let $CHILD2_1_HS_CREATE_TABLES= 4 | SELECT spider_direct_sql('CREATE TABLE "hs_r" ( 5 | "a" INT DEFAULT 10, 6 | "b" CHAR(1) DEFAULT \'c\', 7 | "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), 8 | "d" INT DEFAULT 11, 9 | CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a") 10 | )', '', 'srv "s_2_1"'); 11 | let $CHILD2_1_HS_SELECT_TABLES= 12 | SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"'); 13 | let $CHILD2_1_HS_DROP_TABLES2= 14 | SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); 15 | let $CHILD2_1_HS_CREATE_TABLES2= 16 | SELECT spider_direct_sql('CREATE TABLE "hs_r2" ( 17 | "a" INT DEFAULT 10, 18 | "b" CHAR(1) DEFAULT \'c\', 19 | "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), 20 | "d" INT DEFAULT 11, 21 | CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a") 22 | )', '', 'srv "s_2_1"'); 23 | let $CHILD2_1_HS_SELECT_TABLES2= 24 | SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"'); 25 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/hs_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HS_DROP_TABLES= 2 | SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); 3 | let $CHILD2_2_HS_CREATE_TABLES= 4 | SELECT spider_direct_sql('CREATE TABLE "hs_r3" ( 5 | "a" INT DEFAULT 10, 6 | "b" CHAR(1) DEFAULT \'c\', 7 | "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), 8 | "d" INT DEFAULT 11, 9 | CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a") 10 | )', '', 'srv "s_2_2"'); 11 | let $CHILD2_2_HS_SELECT_TABLES= 12 | SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"'); 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/hs_init_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle/include/hs_init_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/hs_init_master_1.inc: -------------------------------------------------------------------------------- 1 | let $MASTER_1_HS_COMMENT_TMP= 2 | COMMENT=''; 3 | let $MASTER_1_HS_COMMENT_2_1= 4 | COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; 5 | let $MASTER_1_HS_COMMENT_P_2_1= 6 | COMMENT='uhr "1", uhw "1"' 7 | PARTITION BY RANGE(a) ( 8 | PARTITION pt1 VALUES LESS THAN (4) 9 | COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', 10 | PARTITION pt2 VALUES LESS THAN MAXVALUE 11 | COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' 12 | ); 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/init_child2_3.inc: -------------------------------------------------------------------------------- 1 | --connection master_1 2 | SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"'); 3 | SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"'); 4 | SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"'); 5 | let $CHILD2_3_DROP_TABLES= 6 | SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"'); 7 | let $CHILD2_3_CREATE_TABLES= 8 | SELECT spider_direct_sql('CREATE TABLE "ta_r4" ( 9 | "a" INT DEFAULT 10, 10 | "b" CHAR(1) DEFAULT \'c\', 11 | "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), 12 | CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a") 13 | )', '', 'srv "s_2_3"'); 14 | let $CHILD2_3_SELECT_TABLES= 15 | SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"'); 16 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/init_child3_1.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 2 | --source ../../include/init_engine.inc 3 | --let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/init_child3_2.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 2 | --source ../../include/init_engine.inc 3 | --let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/init_child3_3.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 2 | --source ../../include/init_engine.inc 3 | --let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/init_slave1_1.inc: -------------------------------------------------------------------------------- 1 | let $SLAVE1_1_COMMENT_INCREMENT1_1= 2 | COMMENT ''; 3 | let $SLAVE1_1_COMMENT_INCREMENT1_P_1= 4 | COMMENT '' 5 | PARTITION BY LIST(MOD(id, 2)) ( 6 | PARTITION pt1 VALUES IN (0) 7 | COMMENT='', 8 | PARTITION pt2 VALUES IN (1) 9 | COMMENT='' 10 | ); 11 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/include/init_spider.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/init_spider.inc 2 | let $VERSION_COMPILE_OS_WIN= 3 | `SELECT IF(@@version_compile_os like 'Win%', 1, 0)`; 4 | if ($VERSION_COMPILE_OS_WIN) 5 | { 6 | eval DROP SERVER s_2_1; 7 | eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS ( 8 | HOST '$ORACLE_HOST', 9 | DATABASE '$ORACLE_DATABASE', 10 | USER '$ORACLE_USER', 11 | PASSWORD '$ORACLE_PASSWORD', 12 | PORT $ORACLE_PORT 13 | ); 14 | eval DROP SERVER s_2_2; 15 | eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS ( 16 | HOST '$ORACLE_HOST', 17 | DATABASE '$ORACLE_DATABASE', 18 | USER '$ORACLE_USER', 19 | PASSWORD '$ORACLE_PASSWORD', 20 | PORT $ORACLE_PORT 21 | ); 22 | eval DROP SERVER s_2_3; 23 | eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS ( 24 | HOST '$ORACLE_HOST', 25 | DATABASE '$ORACLE_DATABASE', 26 | USER '$ORACLE_USER', 27 | PASSWORD '$ORACLE_PASSWORD', 28 | PORT $ORACLE_PORT 29 | ); 30 | eval DROP SERVER s_3_1; 31 | eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( 32 | HOST 'localhost', 33 | DATABASE 'auto_test_local', 34 | USER 'root', 35 | PASSWORD '', 36 | PORT $CHILD3_1_MYPORT 37 | ); 38 | eval DROP SERVER s_3_2; 39 | eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( 40 | HOST 'localhost', 41 | DATABASE 'auto_test_local', 42 | USER 'root', 43 | PASSWORD '', 44 | PORT $CHILD3_2_MYPORT 45 | ); 46 | eval DROP SERVER s_3_3; 47 | eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( 48 | HOST 'localhost', 49 | DATABASE 'auto_test_local', 50 | USER 'root', 51 | PASSWORD '', 52 | PORT $CHILD2_3_MYPORT 53 | ); 54 | } 55 | if (!$VERSION_COMPILE_OS_WIN) 56 | { 57 | eval DROP SERVER s_2_1; 58 | eval CREATE SERVER s_2_1 FOREIGN DATA WRAPPER oracle OPTIONS ( 59 | HOST '$ORACLE_HOST', 60 | DATABASE '$ORACLE_DATABASE', 61 | USER '$ORACLE_USER', 62 | PASSWORD '$ORACLE_PASSWORD', 63 | PORT $ORACLE_PORT 64 | ); 65 | eval DROP SERVER s_2_2; 66 | eval CREATE SERVER s_2_2 FOREIGN DATA WRAPPER oracle OPTIONS ( 67 | HOST '$ORACLE_HOST', 68 | DATABASE '$ORACLE_DATABASE', 69 | USER '$ORACLE_USER', 70 | PASSWORD '$ORACLE_PASSWORD', 71 | PORT $ORACLE_PORT 72 | ); 73 | eval DROP SERVER s_2_3; 74 | eval CREATE SERVER s_2_3 FOREIGN DATA WRAPPER oracle OPTIONS ( 75 | HOST '$ORACLE_HOST', 76 | DATABASE '$ORACLE_DATABASE', 77 | USER '$ORACLE_USER', 78 | PASSWORD '$ORACLE_PASSWORD', 79 | PORT $ORACLE_PORT 80 | ); 81 | eval DROP SERVER s_3_1; 82 | eval CREATE SERVER s_3_1 FOREIGN DATA WRAPPER mysql OPTIONS ( 83 | HOST 'localhost', 84 | DATABASE 'auto_test_local', 85 | USER 'root', 86 | PASSWORD '', 87 | SOCKET '$CHILD3_1_MYSOCK' 88 | ); 89 | eval DROP SERVER s_3_2; 90 | eval CREATE SERVER s_3_2 FOREIGN DATA WRAPPER mysql OPTIONS ( 91 | HOST 'localhost', 92 | DATABASE 'auto_test_local', 93 | USER 'root', 94 | PASSWORD '', 95 | SOCKET '$CHILD3_2_MYSOCK' 96 | ); 97 | eval DROP SERVER s_3_3; 98 | eval CREATE SERVER s_3_3 FOREIGN DATA WRAPPER mysql OPTIONS ( 99 | HOST 'localhost', 100 | DATABASE 'auto_test_local', 101 | USER 'root', 102 | PASSWORD '', 103 | SOCKET '$CHILD3_3_MYSOCK' 104 | ); 105 | } 106 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/r/direct_aggregate.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table select test 28 | DROP TABLE IF EXISTS ta_l; 29 | CREATE TABLE ta_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 35 | INSERT INTO ta_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | 42 | direct_aggregating test 43 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 44 | Variable_name Value 45 | Spider_direct_aggregate 0 46 | SELECT COUNT(*) FROM ta_l; 47 | COUNT(*) 48 | 5 49 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 50 | Variable_name Value 51 | Spider_direct_aggregate 1 52 | SELECT MAX(a) FROM ta_l; 53 | MAX(a) 54 | 5 55 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 56 | Variable_name Value 57 | Spider_direct_aggregate 1 58 | SELECT MIN(a) FROM ta_l; 59 | MIN(a) 60 | 1 61 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 62 | Variable_name Value 63 | Spider_direct_aggregate 1 64 | SELECT MAX(a) FROM ta_l WHERE a < 5; 65 | MAX(a) 66 | 4 67 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 68 | Variable_name Value 69 | Spider_direct_aggregate 1 70 | SELECT MIN(a) FROM ta_l WHERE a > 1; 71 | MIN(a) 72 | 2 73 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 74 | Variable_name Value 75 | Spider_direct_aggregate 1 76 | 77 | deinit 78 | DROP DATABASE IF EXISTS auto_test_local; 79 | DROP DATABASE IF EXISTS auto_test_remote; 80 | DROP DATABASE IF EXISTS auto_test_remote2; 81 | for master_1 82 | for child2 83 | child2_1 84 | child2_2 85 | child2_3 86 | for child3 87 | child3_1 88 | child3_2 89 | child3_3 90 | 91 | end of test 92 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/r/direct_aggregate_part.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | with partition test 28 | CREATE TABLE ta_l2 ( 29 | a INT, 30 | b CHAR(1), 31 | c DATETIME, 32 | PRIMARY KEY(a) 33 | ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 34 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 35 | Variable_name Value 36 | Spider_direct_aggregate 0 37 | SELECT COUNT(*) FROM ta_l2; 38 | COUNT(*) 39 | 5 40 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 41 | Variable_name Value 42 | Spider_direct_aggregate 2 43 | SELECT MAX(a) FROM ta_l2; 44 | MAX(a) 45 | 5 46 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 47 | Variable_name Value 48 | Spider_direct_aggregate 2 49 | SELECT MIN(a) FROM ta_l2; 50 | MIN(a) 51 | 1 52 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 53 | Variable_name Value 54 | Spider_direct_aggregate 2 55 | SELECT MAX(a) FROM ta_l2 WHERE a < 5; 56 | MAX(a) 57 | 4 58 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 59 | Variable_name Value 60 | Spider_direct_aggregate 2 61 | SELECT MIN(a) FROM ta_l2 WHERE a > 1; 62 | MIN(a) 63 | 2 64 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 65 | Variable_name Value 66 | Spider_direct_aggregate 2 67 | 68 | deinit 69 | DROP DATABASE IF EXISTS auto_test_local; 70 | DROP DATABASE IF EXISTS auto_test_remote; 71 | DROP DATABASE IF EXISTS auto_test_remote2; 72 | for master_1 73 | for child2 74 | child2_1 75 | child2_2 76 | child2_3 77 | for child3 78 | child3_1 79 | child3_2 80 | child3_3 81 | 82 | end of test 83 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/r/vp_fixes.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table and insert 28 | DROP TABLE IF EXISTS tb_l; 29 | CREATE TABLE tb_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE2 MASTER_1_CHARSET2 35 | INSERT INTO tb_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | DROP TABLE IF EXISTS ta_l; 42 | CREATE TABLE ta_l ( 43 | PRIMARY KEY(a) 44 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 45 | INSERT INTO ta_l SELECT a, b, c FROM tb_l; 46 | 47 | 0.9 48 | create different primary key table 49 | CREATE TABLE ta_l_int ( 50 | a INT DEFAULT 10, 51 | b INT AUTO_INCREMENT, 52 | c INT DEFAULT 11, 53 | PRIMARY KEY(b) 54 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 55 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 56 | create un-correspond primary key table 57 | DROP TABLE IF EXISTS ta_l_int; 58 | CREATE TABLE ta_l_int ( 59 | a INT DEFAULT 10, 60 | b INT DEFAULT 12, 61 | c INT DEFAULT 11, 62 | PRIMARY KEY(c) 63 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 64 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 65 | 66 | deinit 67 | DROP DATABASE IF EXISTS auto_test_local; 68 | DROP DATABASE IF EXISTS auto_test_remote; 69 | DROP DATABASE IF EXISTS auto_test_remote2; 70 | for master_1 71 | for child2 72 | child2_1 73 | child2_2 74 | child2_3 75 | for child3 76 | child3_1 77 | child3_2 78 | child3_3 79 | 80 | end of test 81 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/connect_child2_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/connect_child2_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/connect_child2_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/connect_child3_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/connect_child3_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/connect_child3_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/connect_master_1.inc: -------------------------------------------------------------------------------- 1 | --connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/connect_slave1_1.inc: -------------------------------------------------------------------------------- 1 | --connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/ha_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_deinit_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_deinit_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_deinit_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_deinit_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/ha_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_init_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_init_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_init_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_init_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/have_engine.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM information_schema.engines WHERE 2 | (support = 'YES' OR support = 'DEFAULT') AND 3 | engine = '$TEST_ENGINE_TYPE'`) 4 | { 5 | SELECT engine, support FROM information_schema.engines; 6 | --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/have_func.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`) 2 | { 3 | SELECT name FROM mysql.func; 4 | --let $SKIP_REASON= "Need $TEST_FUNC_NAME function" 5 | } 6 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/have_partition.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_PARTITION= 0; 2 | if (`SELECT count(*) FROM information_schema.plugins WHERE 3 | plugin_status = 'ACTIVE' AND 4 | plugin_name = 'partition'`) 5 | { 6 | let $HAVE_PARTITION= 1; 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/have_trigger.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables 2 | WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`; 3 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/hs_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_deinit_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/hs_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_init_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/slave_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --connection slave1_1 4 | STOP SLAVE; 5 | --source ../include/deinit_slave1_1.inc 6 | --disconnect slave1_1 7 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/slave_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --source connect_slave1_1.inc 4 | --connection slave1_1 5 | SET SESSION sql_log_bin= 0; 6 | --let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id` 7 | --let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE 8 | --source have_partition.inc 9 | --source have_trigger.inc 10 | --source ../include/init_slave1_1.inc 11 | --source have_engine.inc 12 | --let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` 13 | if (!$SLAVE1_1_SLAVE_STATUS) 14 | { 15 | eval CHANGE MASTER TO 16 | MASTER_HOST = '127.0.0.1', 17 | MASTER_USER = 'root', 18 | MASTER_PASSWORD = '', 19 | MASTER_PORT = $MASTER_1_MYPORT 20 | ; 21 | } 22 | START SLAVE; 23 | --connection master_1 24 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 25 | --connection slave1_1 26 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 27 | if ($USE_CHILD_GROUP2) 28 | { 29 | --connection child2_1 30 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 31 | --connection child2_2 32 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 33 | --connection child2_3 34 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 35 | } 36 | if ($USE_CHILD_GROUP3) 37 | { 38 | --connection child3_1 39 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 40 | --connection child3_2 41 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 42 | --connection child3_3 43 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 44 | } 45 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/deinit_master_1.inc 5 | --disconnect master_1 6 | --echo for child2 7 | if ($USE_CHILD_GROUP2) 8 | { 9 | --echo child2_1 10 | --connection child2_1 11 | --source ../include/deinit_child2_1.inc 12 | --disconnect child2_1 13 | --echo child2_2 14 | --connection child2_2 15 | --source ../include/deinit_child2_2.inc 16 | --disconnect child2_2 17 | --echo child2_3 18 | --connection child2_3 19 | --source ../include/deinit_child2_3.inc 20 | --disconnect child2_3 21 | } 22 | --echo for child3 23 | if ($USE_CHILD_GROUP3) 24 | { 25 | --echo child3_1 26 | --connection child3_1 27 | --source ../include/deinit_child3_1.inc 28 | --disconnect child3_1 29 | --echo child3_2 30 | --connection child3_2 31 | --source ../include/deinit_child3_2.inc 32 | --disconnect child3_2 33 | --echo child3_3 34 | --connection child3_3 35 | --source ../include/deinit_child3_3.inc 36 | --disconnect child3_3 37 | } 38 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle/t/test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --source connect_master_1.inc 4 | --connection master_1 5 | CALL mtr.add_suppression("unknown variable"); 6 | SET SESSION sql_log_bin= 0; 7 | --let $MASTER_1_SERVER_ID=`SELECT @@global.server_id` 8 | --let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE 9 | --source have_partition.inc 10 | --source have_trigger.inc 11 | --source ../include/init_master_1.inc 12 | --source have_engine.inc 13 | --echo for child2 14 | if ($USE_CHILD_GROUP2) 15 | { 16 | --echo child2_1 17 | --source connect_child2_1.inc 18 | --connection child2_1 19 | CALL mtr.add_suppression("unknown variable *"); 20 | SET SESSION sql_log_bin= 0; 21 | --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id` 22 | --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE 23 | --source ../include/init_child2_1.inc 24 | --source have_engine.inc 25 | --echo child2_2 26 | --source connect_child2_2.inc 27 | --connection child2_2 28 | CALL mtr.add_suppression("unknown variable *"); 29 | SET SESSION sql_log_bin= 0; 30 | --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id` 31 | --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE 32 | --source ../include/init_child2_2.inc 33 | --source have_engine.inc 34 | --echo child2_3 35 | --source connect_child2_3.inc 36 | --connection child2_3 37 | CALL mtr.add_suppression("unknown variable *"); 38 | SET SESSION sql_log_bin= 0; 39 | --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id` 40 | --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE 41 | --source ../include/init_child2_3.inc 42 | --source have_engine.inc 43 | } 44 | --echo for child3 45 | if ($USE_CHILD_GROUP3) 46 | { 47 | --echo child3_1 48 | --source connect_child3_1.inc 49 | --connection child3_1 50 | CALL mtr.add_suppression("unknown variable *"); 51 | SET SESSION sql_log_bin= 0; 52 | --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id` 53 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 54 | --source ../include/init_child3_1.inc 55 | --source have_engine.inc 56 | --echo child3_2 57 | --source connect_child3_2.inc 58 | --connection child3_2 59 | CALL mtr.add_suppression("unknown variable *"); 60 | SET SESSION sql_log_bin= 0; 61 | --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id` 62 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 63 | --source ../include/init_child3_2.inc 64 | --source have_engine.inc 65 | --echo child3_3 66 | --source connect_child3_3.inc 67 | --connection child3_3 68 | CALL mtr.add_suppression("unknown variable *"); 69 | SET SESSION sql_log_bin= 0; 70 | --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id` 71 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 72 | --source ../include/init_child3_3.inc 73 | --source have_engine.inc 74 | } 75 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/deinit_child3_1.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_1_ENGINE 3 | --source ../../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/deinit_child3_2.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_2_ENGINE 3 | --source ../../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/deinit_child3_3.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 2 | --let $INIT_TEST_ENGINE= $INIT_CHILD3_3_ENGINE 3 | --source ../../include/deinit_engine.inc 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/deinit_master_1.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/deinit_slave1_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/deinit_slave1_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/ha_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/ha_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/ha_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_deinit_child3_1.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_deinit_child3_2.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_deinit_child3_3.inc: -------------------------------------------------------------------------------- 1 | --source ../../include/deinit_spider.inc 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/ha_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HA_AS_DROP_TABLES= 2 | $CHILD2_1_DROP_TABLES; 3 | let $CHILD2_1_HA_AS_CREATE_TABLES= 4 | $CHILD2_1_CREATE_TABLES; 5 | let $CHILD2_1_HA_AS_DROP_TABLES2= 6 | $CHILD2_1_DROP_TABLES2; 7 | let $CHILD2_1_HA_AS_CREATE_TABLES2= 8 | $CHILD2_1_CREATE_TABLES2; 9 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HA_DROP_TABLES= 2 | $CHILD2_2_DROP_TABLES; 3 | let $CHILD2_2_HA_CREATE_TABLES= 4 | $CHILD2_2_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/ha_init_child2_3.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_3_HA_DROP_TABLES= 2 | $CHILD2_3_DROP_TABLES; 3 | let $CHILD2_3_HA_CREATE_TABLES= 4 | $CHILD2_3_CREATE_TABLES; 5 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/hs_deinit_child2_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/hs_deinit_child2_2.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/hs_deinit_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/hs_deinit_master_1.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/hs_init_child2_1.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_1_HS_DROP_TABLES= 2 | SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); 3 | let $CHILD2_1_HS_CREATE_TABLES= 4 | SELECT spider_direct_sql('CREATE TABLE "hs_r" ( 5 | "a" INT DEFAULT 10, 6 | "b" CHAR(1) DEFAULT \'c\', 7 | "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), 8 | "d" INT DEFAULT 11, 9 | CONSTRAINT "pk_s_2_1_hs_r" PRIMARY KEY("a") 10 | )', '', 'srv "s_2_1"'); 11 | let $CHILD2_1_HS_SELECT_TABLES= 12 | SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r" ORDER BY "a"', '', 'srv "s_2_1"'); 13 | let $CHILD2_1_HS_DROP_TABLES2= 14 | SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r2"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_1"'); 15 | let $CHILD2_1_HS_CREATE_TABLES2= 16 | SELECT spider_direct_sql('CREATE TABLE "hs_r2" ( 17 | "a" INT DEFAULT 10, 18 | "b" CHAR(1) DEFAULT \'c\', 19 | "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), 20 | "d" INT DEFAULT 11, 21 | CONSTRAINT "pk_s_2_1_hs_r2" PRIMARY KEY("a") 22 | )', '', 'srv "s_2_1"'); 23 | let $CHILD2_1_HS_SELECT_TABLES2= 24 | SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r2" ORDER BY "a"', '', 'srv "s_2_1"'); 25 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/hs_init_child2_2.inc: -------------------------------------------------------------------------------- 1 | let $CHILD2_2_HS_DROP_TABLES= 2 | SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "hs_r3"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_2"'); 3 | let $CHILD2_2_HS_CREATE_TABLES= 4 | SELECT spider_direct_sql('CREATE TABLE "hs_r3" ( 5 | "a" INT DEFAULT 10, 6 | "b" CHAR(1) DEFAULT \'c\', 7 | "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), 8 | "d" INT DEFAULT 11, 9 | CONSTRAINT "pk_s_2_2_hs_r3" PRIMARY KEY("a") 10 | )', '', 'srv "s_2_2"'); 11 | let $CHILD2_2_HS_SELECT_TABLES= 12 | SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\'), "d" FROM "hs_r3" ORDER BY "a"', '', 'srv "s_2_2"'); 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/hs_init_child2_3.inc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiezhenye/mysql-plugin-spider-engine/773025ead36664bf157fc25019b853a6a894c0fb/src/mysql-test/spider/oracle2/include/hs_init_child2_3.inc -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/hs_init_master_1.inc: -------------------------------------------------------------------------------- 1 | let $MASTER_1_HS_COMMENT_TMP= 2 | COMMENT=''; 3 | let $MASTER_1_HS_COMMENT_2_1= 4 | COMMENT='srv "s_2_1", table "hs_r", uhr "1", uhw "1", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"'; 5 | let $MASTER_1_HS_COMMENT_P_2_1= 6 | COMMENT='uhr "1", uhw "1"' 7 | PARTITION BY RANGE(a) ( 8 | PARTITION pt1 VALUES LESS THAN (4) 9 | COMMENT='srv "s_2_1", table "hs_r2", hrp "$CHILD2_1_HSRPORT", hwp "$CHILD2_1_HSWPORT"', 10 | PARTITION pt2 VALUES LESS THAN MAXVALUE 11 | COMMENT='srv "s_2_2", table "hs_r3", hrp "$CHILD2_2_HSRPORT", hwp "$CHILD2_2_HSWPORT"' 12 | ); 13 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/init_child2_3.inc: -------------------------------------------------------------------------------- 1 | --connection master_1 2 | SELECT spider_direct_sql('ALTER SESSION SET NLS_DATE_FORMAT=\'YYYY-MM-DD HH24:MI:SS\'', '', 'srv "s_2_3"'); 3 | SELECT spider_direct_sql('ALTER SESSION SET NLS_TIME_FORMAT=\'HH24:MI:SSXFF\'', '', 'srv "s_2_3"'); 4 | SELECT spider_direct_sql('ALTER SESSION SET NLS_TIMESTAMP_FORMAT=\'YYYY-MM-DD HH24:MI:SSXFF\'', '', 'srv "s_2_3"'); 5 | let $CHILD2_3_DROP_TABLES= 6 | SELECT spider_direct_sql('begin execute immediate \'DROP TABLE "ta_r4"\'$STR_SEMICOLON exception when others then null$STR_SEMICOLON end$STR_SEMICOLON', '', 'srv "s_2_3"'); 7 | let $CHILD2_3_CREATE_TABLES= 8 | SELECT spider_direct_sql('CREATE TABLE "ta_r4" ( 9 | "a" INT DEFAULT 10, 10 | "b" CHAR(1) DEFAULT \'c\', 11 | "c" DATE DEFAULT TO_DATE(\'1999-10-10 10:10:10\', \'YYYY-MM-DD HH24:MI:SS\'), 12 | CONSTRAINT "pk_s_2_3_ta_r4" PRIMARY KEY("a") 13 | )', '', 'srv "s_2_3"'); 14 | let $CHILD2_3_SELECT_TABLES= 15 | SELECT spider_direct_sql('SELECT "a", "b", TO_CHAR("c", \'YYYY-MM-DD HH24:MI:SS\') FROM "ta_r4" ORDER BY "a"', '', 'srv "s_2_3"'); 16 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/init_child3_1.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 2 | --source ../../include/init_engine.inc 3 | --let $INIT_CHILD3_1_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/init_child3_2.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 2 | --source ../../include/init_engine.inc 3 | --let $INIT_CHILD3_2_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/init_child3_3.inc: -------------------------------------------------------------------------------- 1 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 2 | --source ../../include/init_engine.inc 3 | --let $INIT_CHILD3_3_ENGINE= $INIT_TEST_ENGINE 4 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/include/init_slave1_1.inc: -------------------------------------------------------------------------------- 1 | let $SLAVE1_1_COMMENT_INCREMENT1_1= 2 | COMMENT ''; 3 | let $SLAVE1_1_COMMENT_INCREMENT1_P_1= 4 | COMMENT '' 5 | PARTITION BY LIST(MOD(id, 2)) ( 6 | PARTITION pt1 VALUES IN (0) 7 | COMMENT='', 8 | PARTITION pt2 VALUES IN (1) 9 | COMMENT='' 10 | ); 11 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/r/direct_aggregate.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table select test 28 | DROP TABLE IF EXISTS ta_l; 29 | CREATE TABLE ta_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 35 | INSERT INTO ta_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | 42 | direct_aggregating test 43 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 44 | Variable_name Value 45 | Spider_direct_aggregate 0 46 | SELECT COUNT(*) FROM ta_l; 47 | COUNT(*) 48 | 5 49 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 50 | Variable_name Value 51 | Spider_direct_aggregate 1 52 | SELECT MAX(a) FROM ta_l; 53 | MAX(a) 54 | 5 55 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 56 | Variable_name Value 57 | Spider_direct_aggregate 1 58 | SELECT MIN(a) FROM ta_l; 59 | MIN(a) 60 | 1 61 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 62 | Variable_name Value 63 | Spider_direct_aggregate 1 64 | SELECT MAX(a) FROM ta_l WHERE a < 5; 65 | MAX(a) 66 | 4 67 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 68 | Variable_name Value 69 | Spider_direct_aggregate 1 70 | SELECT MIN(a) FROM ta_l WHERE a > 1; 71 | MIN(a) 72 | 2 73 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 74 | Variable_name Value 75 | Spider_direct_aggregate 1 76 | 77 | deinit 78 | DROP DATABASE IF EXISTS auto_test_local; 79 | DROP DATABASE IF EXISTS auto_test_remote; 80 | DROP DATABASE IF EXISTS auto_test_remote2; 81 | for master_1 82 | for child2 83 | child2_1 84 | child2_2 85 | child2_3 86 | for child3 87 | child3_1 88 | child3_2 89 | child3_3 90 | 91 | end of test 92 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/r/direct_aggregate_part.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | with partition test 28 | CREATE TABLE ta_l2 ( 29 | a INT, 30 | b CHAR(1), 31 | c DATETIME, 32 | PRIMARY KEY(a) 33 | ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 34 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 35 | Variable_name Value 36 | Spider_direct_aggregate 0 37 | SELECT COUNT(*) FROM ta_l2; 38 | COUNT(*) 39 | 5 40 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 41 | Variable_name Value 42 | Spider_direct_aggregate 2 43 | SELECT MAX(a) FROM ta_l2; 44 | MAX(a) 45 | 5 46 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 47 | Variable_name Value 48 | Spider_direct_aggregate 2 49 | SELECT MIN(a) FROM ta_l2; 50 | MIN(a) 51 | 1 52 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 53 | Variable_name Value 54 | Spider_direct_aggregate 2 55 | SELECT MAX(a) FROM ta_l2 WHERE a < 5; 56 | MAX(a) 57 | 4 58 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 59 | Variable_name Value 60 | Spider_direct_aggregate 2 61 | SELECT MIN(a) FROM ta_l2 WHERE a > 1; 62 | MIN(a) 63 | 2 64 | SHOW GLOBAL STATUS LIKE 'Spider_direct_aggregate%'; 65 | Variable_name Value 66 | Spider_direct_aggregate 2 67 | 68 | deinit 69 | DROP DATABASE IF EXISTS auto_test_local; 70 | DROP DATABASE IF EXISTS auto_test_remote; 71 | DROP DATABASE IF EXISTS auto_test_remote2; 72 | for master_1 73 | for child2 74 | child2_1 75 | child2_2 76 | child2_3 77 | for child3 78 | child3_1 79 | child3_2 80 | child3_3 81 | 82 | end of test 83 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/r/vp_fixes.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table and insert 28 | DROP TABLE IF EXISTS tb_l; 29 | CREATE TABLE tb_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE2 MASTER_1_CHARSET2 35 | INSERT INTO tb_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | DROP TABLE IF EXISTS ta_l; 42 | CREATE TABLE ta_l ( 43 | PRIMARY KEY(a) 44 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 45 | INSERT INTO ta_l SELECT a, b, c FROM tb_l; 46 | 47 | 0.9 48 | create different primary key table 49 | CREATE TABLE ta_l_int ( 50 | a INT DEFAULT 10, 51 | b INT AUTO_INCREMENT, 52 | c INT DEFAULT 11, 53 | PRIMARY KEY(b) 54 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 55 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 56 | create un-correspond primary key table 57 | DROP TABLE IF EXISTS ta_l_int; 58 | CREATE TABLE ta_l_int ( 59 | a INT DEFAULT 10, 60 | b INT DEFAULT 12, 61 | c INT DEFAULT 11, 62 | PRIMARY KEY(c) 63 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 64 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 65 | 66 | deinit 67 | DROP DATABASE IF EXISTS auto_test_local; 68 | DROP DATABASE IF EXISTS auto_test_remote; 69 | DROP DATABASE IF EXISTS auto_test_remote2; 70 | for master_1 71 | for child2 72 | child2_1 73 | child2_2 74 | child2_3 75 | for child3 76 | child3_1 77 | child3_2 78 | child3_3 79 | 80 | end of test 81 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/connect_child2_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/connect_child2_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/connect_child2_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/connect_child3_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/connect_child3_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/connect_child3_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/connect_master_1.inc: -------------------------------------------------------------------------------- 1 | --connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/connect_slave1_1.inc: -------------------------------------------------------------------------------- 1 | --connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/ha_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_deinit_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_deinit_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_deinit_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_deinit_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/ha_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_init_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_init_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_init_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_init_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/have_engine.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM information_schema.engines WHERE 2 | (support = 'YES' OR support = 'DEFAULT') AND 3 | engine = '$TEST_ENGINE_TYPE'`) 4 | { 5 | SELECT engine, support FROM information_schema.engines; 6 | --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/have_func.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`) 2 | { 3 | SELECT name FROM mysql.func; 4 | --let $SKIP_REASON= "Need $TEST_FUNC_NAME function" 5 | } 6 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/have_partition.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_PARTITION= 0; 2 | if (`SELECT count(*) FROM information_schema.plugins WHERE 3 | plugin_status = 'ACTIVE' AND 4 | plugin_name = 'partition'`) 5 | { 6 | let $HAVE_PARTITION= 1; 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/have_trigger.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables 2 | WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`; 3 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/hs_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_deinit_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/hs_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_init_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/slave_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --connection slave1_1 4 | STOP SLAVE; 5 | --source ../include/deinit_slave1_1.inc 6 | --disconnect slave1_1 7 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/slave_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --source connect_slave1_1.inc 4 | --connection slave1_1 5 | SET SESSION sql_log_bin= 0; 6 | --let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id` 7 | --let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE 8 | --source have_partition.inc 9 | --source have_trigger.inc 10 | --source ../include/init_slave1_1.inc 11 | --source have_engine.inc 12 | --let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` 13 | if (!$SLAVE1_1_SLAVE_STATUS) 14 | { 15 | eval CHANGE MASTER TO 16 | MASTER_HOST = '127.0.0.1', 17 | MASTER_USER = 'root', 18 | MASTER_PASSWORD = '', 19 | MASTER_PORT = $MASTER_1_MYPORT 20 | ; 21 | } 22 | START SLAVE; 23 | --connection master_1 24 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 25 | --connection slave1_1 26 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 27 | if ($USE_CHILD_GROUP2) 28 | { 29 | --connection child2_1 30 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 31 | --connection child2_2 32 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 33 | --connection child2_3 34 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 35 | } 36 | if ($USE_CHILD_GROUP3) 37 | { 38 | --connection child3_1 39 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 40 | --connection child3_2 41 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 42 | --connection child3_3 43 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 44 | } 45 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/deinit_master_1.inc 5 | --disconnect master_1 6 | --echo for child2 7 | if ($USE_CHILD_GROUP2) 8 | { 9 | --echo child2_1 10 | --connection child2_1 11 | --source ../include/deinit_child2_1.inc 12 | --disconnect child2_1 13 | --echo child2_2 14 | --connection child2_2 15 | --source ../include/deinit_child2_2.inc 16 | --disconnect child2_2 17 | --echo child2_3 18 | --connection child2_3 19 | --source ../include/deinit_child2_3.inc 20 | --disconnect child2_3 21 | } 22 | --echo for child3 23 | if ($USE_CHILD_GROUP3) 24 | { 25 | --echo child3_1 26 | --connection child3_1 27 | --source ../include/deinit_child3_1.inc 28 | --disconnect child3_1 29 | --echo child3_2 30 | --connection child3_2 31 | --source ../include/deinit_child3_2.inc 32 | --disconnect child3_2 33 | --echo child3_3 34 | --connection child3_3 35 | --source ../include/deinit_child3_3.inc 36 | --disconnect child3_3 37 | } 38 | -------------------------------------------------------------------------------- /src/mysql-test/spider/oracle2/t/test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --source connect_master_1.inc 4 | --connection master_1 5 | CALL mtr.add_suppression("unknown variable"); 6 | SET SESSION sql_log_bin= 0; 7 | --let $MASTER_1_SERVER_ID=`SELECT @@global.server_id` 8 | --let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE 9 | --source have_partition.inc 10 | --source have_trigger.inc 11 | --source ../include/init_master_1.inc 12 | --source have_engine.inc 13 | --echo for child2 14 | if ($USE_CHILD_GROUP2) 15 | { 16 | --echo child2_1 17 | --source connect_child2_1.inc 18 | --connection child2_1 19 | CALL mtr.add_suppression("unknown variable *"); 20 | SET SESSION sql_log_bin= 0; 21 | --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id` 22 | --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE 23 | --source ../include/init_child2_1.inc 24 | --source have_engine.inc 25 | --echo child2_2 26 | --source connect_child2_2.inc 27 | --connection child2_2 28 | CALL mtr.add_suppression("unknown variable *"); 29 | SET SESSION sql_log_bin= 0; 30 | --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id` 31 | --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE 32 | --source ../include/init_child2_2.inc 33 | --source have_engine.inc 34 | --echo child2_3 35 | --source connect_child2_3.inc 36 | --connection child2_3 37 | CALL mtr.add_suppression("unknown variable *"); 38 | SET SESSION sql_log_bin= 0; 39 | --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id` 40 | --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE 41 | --source ../include/init_child2_3.inc 42 | --source have_engine.inc 43 | } 44 | --echo for child3 45 | if ($USE_CHILD_GROUP3) 46 | { 47 | --echo child3_1 48 | --source connect_child3_1.inc 49 | --connection child3_1 50 | CALL mtr.add_suppression("unknown variable *"); 51 | SET SESSION sql_log_bin= 0; 52 | --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id` 53 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 54 | --source ../include/init_child3_1.inc 55 | --source have_engine.inc 56 | --echo child3_2 57 | --source connect_child3_2.inc 58 | --connection child3_2 59 | CALL mtr.add_suppression("unknown variable *"); 60 | SET SESSION sql_log_bin= 0; 61 | --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id` 62 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 63 | --source ../include/init_child3_2.inc 64 | --source have_engine.inc 65 | --echo child3_3 66 | --source connect_child3_3.inc 67 | --connection child3_3 68 | CALL mtr.add_suppression("unknown variable *"); 69 | SET SESSION sql_log_bin= 0; 70 | --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id` 71 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 72 | --source ../include/init_child3_3.inc 73 | --source have_engine.inc 74 | } 75 | -------------------------------------------------------------------------------- /src/mysql-test/spider/r/direct_aggregate.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table select test 28 | DROP TABLE IF EXISTS ta_l; 29 | CREATE TABLE ta_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 35 | INSERT INTO ta_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | 42 | direct_aggregating test 43 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 44 | Variable_name Value 45 | Spider_direct_aggregate 0 46 | SELECT COUNT(*) FROM ta_l; 47 | COUNT(*) 48 | 5 49 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 50 | Variable_name Value 51 | Spider_direct_aggregate 0 52 | SELECT MAX(a) FROM ta_l; 53 | MAX(a) 54 | 5 55 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 56 | Variable_name Value 57 | Spider_direct_aggregate 0 58 | SELECT MIN(a) FROM ta_l; 59 | MIN(a) 60 | 1 61 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 62 | Variable_name Value 63 | Spider_direct_aggregate 0 64 | SELECT MAX(a) FROM ta_l WHERE a < 5; 65 | MAX(a) 66 | 4 67 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 68 | Variable_name Value 69 | Spider_direct_aggregate 0 70 | SELECT MIN(a) FROM ta_l WHERE a > 1; 71 | MIN(a) 72 | 2 73 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 74 | Variable_name Value 75 | Spider_direct_aggregate 0 76 | 77 | deinit 78 | DROP DATABASE IF EXISTS auto_test_local; 79 | DROP DATABASE IF EXISTS auto_test_remote; 80 | DROP DATABASE IF EXISTS auto_test_remote2; 81 | for master_1 82 | for child2 83 | child2_1 84 | child2_2 85 | child2_3 86 | for child3 87 | child3_1 88 | child3_2 89 | child3_3 90 | 91 | end of test 92 | -------------------------------------------------------------------------------- /src/mysql-test/spider/r/direct_aggregate_part.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | with partition test 28 | CREATE TABLE ta_l2 ( 29 | a INT, 30 | b CHAR(1), 31 | c DATETIME, 32 | PRIMARY KEY(a) 33 | ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1 34 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 35 | Variable_name Value 36 | Spider_direct_aggregate 0 37 | SELECT COUNT(*) FROM ta_l2; 38 | COUNT(*) 39 | 5 40 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 41 | Variable_name Value 42 | Spider_direct_aggregate 0 43 | SELECT MAX(a) FROM ta_l2; 44 | MAX(a) 45 | 5 46 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 47 | Variable_name Value 48 | Spider_direct_aggregate 0 49 | SELECT MIN(a) FROM ta_l2; 50 | MIN(a) 51 | 1 52 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 53 | Variable_name Value 54 | Spider_direct_aggregate 0 55 | SELECT MAX(a) FROM ta_l2 WHERE a < 5; 56 | MAX(a) 57 | 4 58 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 59 | Variable_name Value 60 | Spider_direct_aggregate 0 61 | SELECT MIN(a) FROM ta_l2 WHERE a > 1; 62 | MIN(a) 63 | 2 64 | SHOW STATUS LIKE 'Spider_direct_aggregate'; 65 | Variable_name Value 66 | Spider_direct_aggregate 0 67 | 68 | deinit 69 | DROP DATABASE IF EXISTS auto_test_local; 70 | DROP DATABASE IF EXISTS auto_test_remote; 71 | DROP DATABASE IF EXISTS auto_test_remote2; 72 | for master_1 73 | for child2 74 | child2_1 75 | child2_2 76 | child2_3 77 | for child3 78 | child3_1 79 | child3_2 80 | child3_3 81 | 82 | end of test 83 | -------------------------------------------------------------------------------- /src/mysql-test/spider/r/vp_fixes.result: -------------------------------------------------------------------------------- 1 | for master_1 2 | for child2 3 | child2_1 4 | child2_2 5 | child2_3 6 | for child3 7 | child3_1 8 | child3_2 9 | child3_3 10 | 11 | drop and create databases 12 | DROP DATABASE IF EXISTS auto_test_local; 13 | CREATE DATABASE auto_test_local; 14 | USE auto_test_local; 15 | DROP DATABASE IF EXISTS auto_test_remote; 16 | CREATE DATABASE auto_test_remote; 17 | USE auto_test_remote; 18 | DROP DATABASE IF EXISTS auto_test_remote2; 19 | CREATE DATABASE auto_test_remote2; 20 | USE auto_test_remote2; 21 | 22 | test select 1 23 | SELECT 1; 24 | 1 25 | 1 26 | 27 | create table and insert 28 | DROP TABLE IF EXISTS tb_l; 29 | CREATE TABLE tb_l ( 30 | a INT, 31 | b CHAR(1), 32 | c DATETIME, 33 | PRIMARY KEY(a) 34 | ) MASTER_1_ENGINE2 MASTER_1_CHARSET2 35 | INSERT INTO tb_l (a, b, c) VALUES 36 | (1, 'a', '2008-08-01 10:21:39'), 37 | (2, 'b', '2000-01-01 00:00:00'), 38 | (3, 'e', '2007-06-04 20:03:11'), 39 | (4, 'd', '2003-11-30 05:01:03'), 40 | (5, 'c', '2001-12-31 23:59:59'); 41 | DROP TABLE IF EXISTS ta_l; 42 | CREATE TABLE ta_l ( 43 | PRIMARY KEY(a) 44 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 45 | INSERT INTO ta_l SELECT a, b, c FROM tb_l; 46 | 47 | 0.9 48 | create different primary key table 49 | CREATE TABLE ta_l_int ( 50 | a INT DEFAULT 10, 51 | b INT AUTO_INCREMENT, 52 | c INT DEFAULT 11, 53 | PRIMARY KEY(b) 54 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 55 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 56 | create un-correspond primary key table 57 | DROP TABLE IF EXISTS ta_l_int; 58 | CREATE TABLE ta_l_int ( 59 | a INT DEFAULT 10, 60 | b INT DEFAULT 12, 61 | c INT DEFAULT 11, 62 | PRIMARY KEY(c) 63 | ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1 64 | INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); 65 | 66 | deinit 67 | DROP DATABASE IF EXISTS auto_test_local; 68 | DROP DATABASE IF EXISTS auto_test_remote; 69 | DROP DATABASE IF EXISTS auto_test_remote2; 70 | for master_1 71 | for child2 72 | child2_1 73 | child2_2 74 | child2_3 75 | for child3 76 | child3_1 77 | child3_2 78 | child3_3 79 | 80 | end of test 81 | -------------------------------------------------------------------------------- /src/mysql-test/spider/suite.opt: -------------------------------------------------------------------------------- 1 | --loose-innodb --loose-skip-performance-schema 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/suite.pm: -------------------------------------------------------------------------------- 1 | package My::Suite::Spider; 2 | 3 | @ISA = qw(My::Suite); 4 | 5 | return "No Spider engine" unless $ENV{HA_SPIDER_SO}; 6 | return "Not run for embedded server" if $::opt_embedded_server; 7 | 8 | sub is_default { 1 } 9 | 10 | bless { }; 11 | 12 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/connect_child2_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_1, localhost, root, , , $CHILD2_1_MYPORT, $CHILD2_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/connect_child2_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_2, localhost, root, , , $CHILD2_2_MYPORT, $CHILD2_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/connect_child2_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child2_3, localhost, root, , , $CHILD2_3_MYPORT, $CHILD2_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/connect_child3_1.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_1, localhost, root, , , $CHILD3_1_MYPORT, $CHILD3_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/connect_child3_2.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_2, localhost, root, , , $CHILD3_2_MYPORT, $CHILD3_2_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/connect_child3_3.inc: -------------------------------------------------------------------------------- 1 | --connect (child3_3, localhost, root, , , $CHILD3_3_MYPORT, $CHILD3_3_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/connect_master_1.inc: -------------------------------------------------------------------------------- 1 | --connect (master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/connect_slave1_1.inc: -------------------------------------------------------------------------------- 1 | --connect (slave1_1, localhost, root, , , $SLAVE1_1_MYPORT, $SLAVE1_1_MYSOCK) 2 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/ha_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_deinit_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_deinit_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_deinit_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_deinit_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/ha_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/ha_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/ha_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/ha_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/ha_init_child2_3.inc 17 | } 18 | --echo for child3 19 | if ($USE_CHILD_GROUP3) 20 | { 21 | --echo child3_1 22 | --connection child3_1 23 | --source ../include/ha_init_child3_1.inc 24 | --echo child3_2 25 | --connection child3_2 26 | --source ../include/ha_init_child3_2.inc 27 | --echo child3_3 28 | --connection child3_3 29 | --source ../include/ha_init_child3_3.inc 30 | } 31 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/have_engine.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM information_schema.engines WHERE 2 | (support = 'YES' OR support = 'DEFAULT') AND 3 | engine = '$TEST_ENGINE_TYPE'`) 4 | { 5 | SELECT engine, support FROM information_schema.engines; 6 | --let $SKIP_REASON= "Need $TEST_ENGINE_TYPE engine" 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/have_func.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM mysql.func WHERE name = '$TEST_FUNC_NAME'`) 2 | { 3 | SELECT name FROM mysql.func; 4 | --let $SKIP_REASON= "Need $TEST_FUNC_NAME function" 5 | } 6 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/have_partition.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_PARTITION= 0; 2 | if (`SELECT count(*) FROM information_schema.plugins WHERE 3 | plugin_status = 'ACTIVE' AND 4 | plugin_name = 'partition'`) 5 | { 6 | let $HAVE_PARTITION= 1; 7 | } 8 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/have_plugin.inc: -------------------------------------------------------------------------------- 1 | if (!`SELECT count(*) FROM information_schema.plugins WHERE plugin_name = '$TEST_PLUGIN_NAME'`) 2 | { 3 | SELECT plugin_name FROM information_schema.plugins; 4 | --let $SKIP_REASON= "Need $TEST_PLUGIN_NAME plugin" 5 | } 6 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/have_trigger.inc: -------------------------------------------------------------------------------- 1 | let $HAVE_TRIGGER= `SELECT COUNT(*) FROM information_schema.tables 2 | WHERE TABLE_SCHEMA = 'information_schema' AND TABLE_NAME = 'TRIGGERS'`; 3 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/hs_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_deinit_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_deinit_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_deinit_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_deinit_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/hs_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/hs_init_master_1.inc 5 | --echo for child2 6 | if ($USE_CHILD_GROUP2) 7 | { 8 | --echo child2_1 9 | --connection child2_1 10 | --source ../include/hs_init_child2_1.inc 11 | --echo child2_2 12 | --connection child2_2 13 | --source ../include/hs_init_child2_2.inc 14 | --echo child2_3 15 | --connection child2_3 16 | --source ../include/hs_init_child2_3.inc 17 | } 18 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/slave_test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --connection slave1_1 4 | STOP SLAVE; 5 | --source ../include/deinit_slave1_1.inc 6 | --disconnect slave1_1 7 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/slave_test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for slave1_1 3 | --source connect_slave1_1.inc 4 | --connection slave1_1 5 | SET SESSION sql_log_bin= 0; 6 | --let $SLAVE1_1_SERVER_ID=`SELECT @@global.server_id` 7 | --let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE 8 | --source have_partition.inc 9 | --source have_trigger.inc 10 | --source ../include/init_slave1_1.inc 11 | --source have_engine.inc 12 | --let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` 13 | if (!$SLAVE1_1_SLAVE_STATUS) 14 | { 15 | eval CHANGE MASTER TO 16 | MASTER_HOST = '127.0.0.1', 17 | MASTER_USER = 'root', 18 | MASTER_PASSWORD = '', 19 | MASTER_PORT = $MASTER_1_MYPORT 20 | ; 21 | } 22 | START SLAVE; 23 | --connection master_1 24 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 25 | --connection slave1_1 26 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 27 | if ($USE_CHILD_GROUP2) 28 | { 29 | --connection child2_1 30 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 31 | --connection child2_2 32 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 33 | --connection child2_3 34 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 35 | } 36 | if ($USE_CHILD_GROUP3) 37 | { 38 | --connection child3_1 39 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 40 | --connection child3_2 41 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 42 | --connection child3_3 43 | call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 44 | } 45 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/test_deinit.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --connection master_1 4 | --source ../include/deinit_master_1.inc 5 | --disconnect master_1 6 | --echo for child2 7 | if ($USE_CHILD_GROUP2) 8 | { 9 | --echo child2_1 10 | --connection child2_1 11 | --source ../include/deinit_child2_1.inc 12 | --disconnect child2_1 13 | --echo child2_2 14 | --connection child2_2 15 | --source ../include/deinit_child2_2.inc 16 | --disconnect child2_2 17 | --echo child2_3 18 | --connection child2_3 19 | --source ../include/deinit_child2_3.inc 20 | --disconnect child2_3 21 | } 22 | --echo for child3 23 | if ($USE_CHILD_GROUP3) 24 | { 25 | --echo child3_1 26 | --connection child3_1 27 | --source ../include/deinit_child3_1.inc 28 | --disconnect child3_1 29 | --echo child3_2 30 | --connection child3_2 31 | --source ../include/deinit_child3_2.inc 32 | --disconnect child3_2 33 | --echo child3_3 34 | --connection child3_3 35 | --source ../include/deinit_child3_3.inc 36 | --disconnect child3_3 37 | } 38 | -------------------------------------------------------------------------------- /src/mysql-test/spider/t/test_init.inc: -------------------------------------------------------------------------------- 1 | # get connection and exist engine test 2 | --echo for master_1 3 | --source connect_master_1.inc 4 | --connection master_1 5 | CALL mtr.add_suppression("unknown variable"); 6 | SET SESSION sql_log_bin= 0; 7 | --let $MASTER_1_SERVER_ID=`SELECT @@global.server_id` 8 | --let $TEST_ENGINE_TYPE= $MASTER_1_ENGINE_TYPE 9 | --source have_partition.inc 10 | --source have_trigger.inc 11 | --source ../include/init_master_1.inc 12 | --source have_engine.inc 13 | --echo for child2 14 | if ($USE_CHILD_GROUP2) 15 | { 16 | --echo child2_1 17 | --source connect_child2_1.inc 18 | --connection child2_1 19 | CALL mtr.add_suppression("unknown variable *"); 20 | SET SESSION sql_log_bin= 0; 21 | --let $CHILD2_1_SERVER_ID=`SELECT @@global.server_id` 22 | --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE 23 | --source ../include/init_child2_1.inc 24 | --source have_engine.inc 25 | --echo child2_2 26 | --source connect_child2_2.inc 27 | --connection child2_2 28 | CALL mtr.add_suppression("unknown variable *"); 29 | SET SESSION sql_log_bin= 0; 30 | --let $CHILD2_2_SERVER_ID=`SELECT @@global.server_id` 31 | --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE 32 | --source ../include/init_child2_2.inc 33 | --source have_engine.inc 34 | --echo child2_3 35 | --source connect_child2_3.inc 36 | --connection child2_3 37 | CALL mtr.add_suppression("unknown variable *"); 38 | SET SESSION sql_log_bin= 0; 39 | --let $CHILD2_3_SERVER_ID=`SELECT @@global.server_id` 40 | --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE 41 | --source ../include/init_child2_3.inc 42 | --source have_engine.inc 43 | } 44 | --echo for child3 45 | if ($USE_CHILD_GROUP3) 46 | { 47 | --echo child3_1 48 | --source connect_child3_1.inc 49 | --connection child3_1 50 | CALL mtr.add_suppression("unknown variable *"); 51 | SET SESSION sql_log_bin= 0; 52 | --let $CHILD3_1_SERVER_ID=`SELECT @@global.server_id` 53 | --let $TEST_ENGINE_TYPE= $CHILD3_1_ENGINE_TYPE 54 | --source ../include/init_child3_1.inc 55 | --source have_engine.inc 56 | --echo child3_2 57 | --source connect_child3_2.inc 58 | --connection child3_2 59 | CALL mtr.add_suppression("unknown variable *"); 60 | SET SESSION sql_log_bin= 0; 61 | --let $CHILD3_2_SERVER_ID=`SELECT @@global.server_id` 62 | --let $TEST_ENGINE_TYPE= $CHILD3_2_ENGINE_TYPE 63 | --source ../include/init_child3_2.inc 64 | --source have_engine.inc 65 | --echo child3_3 66 | --source connect_child3_3.inc 67 | --connection child3_3 68 | CALL mtr.add_suppression("unknown variable *"); 69 | SET SESSION sql_log_bin= 0; 70 | --let $CHILD3_3_SERVER_ID=`SELECT @@global.server_id` 71 | --let $TEST_ENGINE_TYPE= $CHILD3_3_ENGINE_TYPE 72 | --source ../include/init_child3_3.inc 73 | --source have_engine.inc 74 | } 75 | -------------------------------------------------------------------------------- /src/plug.in: -------------------------------------------------------------------------------- 1 | MYSQL_STORAGE_ENGINE(spider,,[Spider Storage Engine], 2 | [Access transactional/nontransactional objects on remote servers], 3 | [max,max-no-ndb]) 4 | MYSQL_PLUGIN_DIRECTORY(spider, [storage/spider]) 5 | MYSQL_PLUGIN_STATIC(spider, [libspider.a]) 6 | MYSQL_PLUGIN_DYNAMIC(spider, [ha_spider.la]) 7 | -------------------------------------------------------------------------------- /src/spd_copy_tables.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010-2014 Kentoku Shiba 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 15 | 16 | int spider_udf_set_copy_tables_param_default( 17 | SPIDER_COPY_TABLES *copy_tables 18 | ); 19 | 20 | int spider_udf_parse_copy_tables_param( 21 | SPIDER_COPY_TABLES *copy_tables, 22 | char *param, 23 | int param_length 24 | ); 25 | 26 | int spider_udf_get_copy_tgt_tables( 27 | THD *thd, 28 | SPIDER_COPY_TABLES *copy_tables, 29 | MEM_ROOT *mem_root, 30 | bool need_lock 31 | ); 32 | 33 | int spider_udf_get_copy_tgt_conns( 34 | SPIDER_COPY_TABLES *copy_tables 35 | ); 36 | 37 | void spider_udf_free_copy_tables_alloc( 38 | SPIDER_COPY_TABLES *copy_tables 39 | ); 40 | 41 | int spider_udf_copy_tables_create_table_list( 42 | SPIDER_COPY_TABLES *copy_tables, 43 | char *spider_table_name, 44 | uint spider_table_name_length, 45 | char *src_link_idx_list, 46 | uint src_link_idx_list_length, 47 | char *dst_link_idx_list, 48 | uint dst_link_idx_list_length 49 | ); 50 | 51 | #ifndef WITHOUT_SPIDER_BG_SEARCH 52 | int spider_udf_bg_copy_exec_sql( 53 | SPIDER_COPY_TABLE_CONN *table_conn 54 | ); 55 | #endif 56 | -------------------------------------------------------------------------------- /src/spd_direct_sql.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009-2014 Kentoku Shiba 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 15 | 16 | uint spider_udf_calc_hash( 17 | char *key, 18 | uint mod 19 | ); 20 | 21 | int spider_udf_direct_sql_create_table_list( 22 | SPIDER_DIRECT_SQL *direct_sql, 23 | char *table_name_list, 24 | uint table_name_list_length 25 | ); 26 | 27 | int spider_udf_direct_sql_create_conn_key( 28 | SPIDER_DIRECT_SQL *direct_sql 29 | ); 30 | 31 | SPIDER_CONN *spider_udf_direct_sql_create_conn( 32 | const SPIDER_DIRECT_SQL *direct_sql, 33 | int *error_num 34 | ); 35 | 36 | SPIDER_CONN *spider_udf_direct_sql_get_conn( 37 | const SPIDER_DIRECT_SQL *direct_sql, 38 | SPIDER_TRX *trx, 39 | int *error_num 40 | ); 41 | 42 | int spider_udf_direct_sql_get_server( 43 | SPIDER_DIRECT_SQL *direct_sql 44 | ); 45 | 46 | int spider_udf_parse_direct_sql_param( 47 | SPIDER_TRX *trx, 48 | SPIDER_DIRECT_SQL *direct_sql, 49 | const char *param, 50 | int param_length 51 | ); 52 | 53 | int spider_udf_set_direct_sql_param_default( 54 | SPIDER_TRX *trx, 55 | SPIDER_DIRECT_SQL *direct_sql 56 | ); 57 | 58 | void spider_udf_free_direct_sql_alloc( 59 | SPIDER_DIRECT_SQL *direct_sql, 60 | my_bool bg 61 | ); 62 | 63 | #ifndef WITHOUT_SPIDER_BG_SEARCH 64 | int spider_udf_bg_direct_sql( 65 | SPIDER_DIRECT_SQL *direct_sql 66 | ); 67 | #endif 68 | -------------------------------------------------------------------------------- /src/spd_malloc.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2012-2014 Kentoku Shiba 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 15 | 16 | #define spider_free(A,B,C) spider_free_mem(A,B,C) 17 | #define spider_malloc(A,B,C,D) \ 18 | spider_alloc_mem(A,B,__func__,__FILE__,__LINE__,C,D) 19 | #define spider_bulk_malloc(A,B,C,...) \ 20 | spider_bulk_alloc_mem(A,B,__func__,__FILE__,__LINE__,C,__VA_ARGS__) 21 | #define spider_current_trx \ 22 | (current_thd ? ((SPIDER_TRX *) *thd_ha_data(current_thd, spider_hton_ptr)) : NULL) 23 | 24 | #define init_calc_mem(A) init_mem_calc(A,__func__,__FILE__,__LINE__) 25 | 26 | #define SPIDER_CALC_MEM_ID(name) name ## _id 27 | #define SPIDER_CALC_MEM_FUNC(name) name ## _func_name 28 | #define SPIDER_CALC_MEM_FILE(name) name ## _file_name 29 | #define SPIDER_CALC_MEM_LINE(name) name ## _line_no 30 | #define spider_alloc_calc_mem_init(A,B) \ 31 | {SPIDER_CALC_MEM_ID(A) = B; SPIDER_CALC_MEM_FUNC(A) = __func__; SPIDER_CALC_MEM_FILE(A) = __FILE__; SPIDER_CALC_MEM_LINE(A) = __LINE__;} 32 | #define spider_alloc_calc_mem(A,B,C) \ 33 | spider_alloc_mem_calc(A,SPIDER_CALC_MEM_ID(B),SPIDER_CALC_MEM_FUNC(B),SPIDER_CALC_MEM_FILE(B),SPIDER_CALC_MEM_LINE(B),C) 34 | 35 | void spider_merge_mem_calc( 36 | SPIDER_TRX *trx, 37 | bool force 38 | ); 39 | 40 | void spider_free_mem_calc( 41 | SPIDER_TRX *trx, 42 | uint id, 43 | size_t size 44 | ); 45 | 46 | void spider_alloc_mem_calc( 47 | SPIDER_TRX *trx, 48 | uint id, 49 | const char *func_name, 50 | const char *file_name, 51 | ulong line_no, 52 | size_t size 53 | ); 54 | 55 | void spider_free_mem( 56 | SPIDER_TRX *trx, 57 | void *ptr, 58 | myf my_flags 59 | ); 60 | 61 | void *spider_alloc_mem( 62 | SPIDER_TRX *trx, 63 | uint id, 64 | const char *func_name, 65 | const char *file_name, 66 | ulong line_no, 67 | size_t size, 68 | myf my_flags 69 | ); 70 | 71 | void *spider_bulk_alloc_mem( 72 | SPIDER_TRX *trx, 73 | uint id, 74 | const char *func_name, 75 | const char *file_name, 76 | ulong line_no, 77 | myf my_flags, 78 | ... 79 | ); 80 | -------------------------------------------------------------------------------- /src/spd_ping_table.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009-2014 Kentoku Shiba 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 15 | 16 | SPIDER_TABLE_MON_LIST *spider_get_ping_table_mon_list( 17 | SPIDER_TRX *trx, 18 | THD *thd, 19 | spider_string *str, 20 | uint conv_name_length, 21 | int link_idx, 22 | uint32 server_id, 23 | bool need_lock, 24 | int *error_num 25 | ); 26 | 27 | void spider_free_ping_table_mon_list( 28 | SPIDER_TABLE_MON_LIST *table_mon_list 29 | ); 30 | 31 | void spider_release_ping_table_mon_list_loop( 32 | uint mutex_hash, 33 | SPIDER_TABLE_MON_LIST *table_mon_list 34 | ); 35 | 36 | void spider_release_ping_table_mon_list( 37 | const char *conv_name, 38 | uint conv_name_length, 39 | int link_idx 40 | ); 41 | 42 | int spider_get_ping_table_mon( 43 | THD *thd, 44 | SPIDER_TABLE_MON_LIST *table_mon_list, 45 | char *name, 46 | uint name_length, 47 | int link_idx, 48 | uint32 server_id, 49 | MEM_ROOT *mem_root, 50 | bool need_lock 51 | ); 52 | 53 | SPIDER_TABLE_MON_LIST *spider_get_ping_table_tgt( 54 | THD *thd, 55 | char *name, 56 | uint name_length, 57 | int link_idx, 58 | uint32 server_id, 59 | spider_string *str, 60 | bool need_lock, 61 | int *error_num 62 | ); 63 | 64 | SPIDER_CONN *spider_get_ping_table_tgt_conn( 65 | SPIDER_TRX *trx, 66 | SPIDER_SHARE *share, 67 | int *error_num 68 | ); 69 | 70 | int spider_init_ping_table_mon_cache( 71 | THD *thd, 72 | MEM_ROOT *mem_root, 73 | bool need_lock 74 | ); 75 | 76 | int spider_ping_table_cache_compare( 77 | TABLE *table, 78 | MEM_ROOT *mem_root 79 | ); 80 | 81 | void spider_ping_table_free_mon_list( 82 | SPIDER_TABLE_MON_LIST *table_mon_list 83 | ); 84 | 85 | void spider_ping_table_free_mon( 86 | SPIDER_TABLE_MON *table_mon 87 | ); 88 | 89 | int spider_ping_table_mon_from_table( 90 | SPIDER_TRX *trx, 91 | THD *thd, 92 | SPIDER_SHARE *share, 93 | uint32 server_id, 94 | char *conv_name, 95 | uint conv_name_length, 96 | int link_idx, 97 | char *where_clause, 98 | uint where_clause_length, 99 | long monitoring_kind, 100 | longlong monitoring_limit, 101 | bool need_lock 102 | ); 103 | -------------------------------------------------------------------------------- /src/spd_udf.def: -------------------------------------------------------------------------------- 1 | LIBRARY ha_spider 2 | VERSION 1.0 3 | EXPORTS 4 | spider_direct_sql 5 | spider_direct_sql_init 6 | spider_direct_sql_deinit 7 | spider_bg_direct_sql 8 | spider_bg_direct_sql_init 9 | spider_bg_direct_sql_deinit 10 | spider_bg_direct_sql_clear 11 | spider_bg_direct_sql_add 12 | spider_ping_table 13 | spider_ping_table_init 14 | spider_ping_table_deinit 15 | spider_flush_table_mon_cache 16 | spider_flush_table_mon_cache_init 17 | spider_flush_table_mon_cache_deinit 18 | spider_copy_tables 19 | spider_copy_tables_init 20 | spider_copy_tables_deinit 21 | -------------------------------------------------------------------------------- /src/spd_udf.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009-2014 Kentoku Shiba 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; version 2 of the License. 6 | 7 | This program is distributed in the hope that it will be useful, 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | GNU General Public License for more details. 11 | 12 | You should have received a copy of the GNU General Public License 13 | along with this program; if not, write to the Free Software 14 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 15 | 16 | long long spider_direct_sql_body( 17 | UDF_INIT *initid, 18 | UDF_ARGS *args, 19 | char *is_null, 20 | char *error, 21 | my_bool bg 22 | ); 23 | 24 | my_bool spider_direct_sql_init_body( 25 | UDF_INIT *initid, 26 | UDF_ARGS *args, 27 | char *message, 28 | my_bool bg 29 | ); 30 | 31 | void spider_direct_sql_deinit_body( 32 | UDF_INIT *initid 33 | ); 34 | 35 | #ifndef WITHOUT_SPIDER_BG_SEARCH 36 | void spider_direct_sql_bg_start( 37 | UDF_INIT *initid 38 | ); 39 | 40 | long long spider_direct_sql_bg_end( 41 | UDF_INIT *initid 42 | ); 43 | #endif 44 | 45 | long long spider_ping_table_body( 46 | UDF_INIT *initid, 47 | UDF_ARGS *args, 48 | char *is_null, 49 | char *error 50 | ); 51 | 52 | my_bool spider_ping_table_init_body( 53 | UDF_INIT *initid, 54 | UDF_ARGS *args, 55 | char *message 56 | ); 57 | 58 | void spider_ping_table_deinit_body( 59 | UDF_INIT *initid 60 | ); 61 | 62 | long long spider_flush_table_mon_cache_body(); 63 | 64 | long long spider_copy_tables_body( 65 | UDF_INIT *initid, 66 | UDF_ARGS *args, 67 | char *is_null, 68 | char *error 69 | ); 70 | 71 | my_bool spider_copy_tables_init_body( 72 | UDF_INIT *initid, 73 | UDF_ARGS *args, 74 | char *message 75 | ); 76 | 77 | void spider_copy_tables_deinit_body( 78 | UDF_INIT *initid 79 | ); 80 | --------------------------------------------------------------------------------