From 9f92d64846c4e737f9935dd34822969e2d102c92 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Wed, 28 May 2025 11:16:21 +0300 Subject: [PATCH 01/69] MDEV-34493 memory leak when using galera node with only replication thread Applying of write set containing many row events causes applier `thd->mem_root` to grow until applying is over. This may contribute to memory fragmentation problem, producing large chunks of memory which are not released back to operating system. In order to reduce memory fragmentation, free `thd->mem_root` in `Rows_log_event::do_apply_event()` after applying a row event with `F_STMT_END` set. --- sql/log_event_server.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index 2152dd24aa8..3700cb55ac0 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -5969,7 +5969,11 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) slave_rows_error_report(ERROR_LEVEL, thd->is_error() ? 0 : error, rgi, thd, table, get_type_str(), RPL_LOG_NAME, log_pos); - if (thd->slave_thread) + if (thd->slave_thread +#ifdef WITH_WSREP + || (WSREP(thd) && wsrep_thd_is_applying(thd)) +#endif /* WITH_WSREP */ + ) free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC)); } From 07be7a688922f06c956a3338533a12ca1904855f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 9 Oct 2025 18:49:24 +0300 Subject: [PATCH 02/69] MDEV-37782: Assertion buf < end failed in mtr_t::encrypt() mtr_t::encrypt(): Handle the special case that the type and length are at the very end of a m_log snippet, followed by another snippet that contains the rest of the payload. It should be noted that in log_decrypt_mtr(), the mini-transaction consists of a single contiguous memory area. Furthermore, for the initial log record in mtr_t::encrypt() at least the page identifier will always be included in the initial m_log snippet. Tested by: Alice Sherepa --- storage/innobase/log/log0crypt.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc index ff52fed0513..16b4acf1a10 100644 --- a/storage/innobase/log/log0crypt.cc +++ b/storage/innobase/log/log0crypt.cc @@ -670,8 +670,11 @@ ATTRIBUTE_NOINLINE size_t mtr_t::encrypt() noexcept { while (buf + rlen > end) { - rlen-= uint32_t(end - buf); - c.append(buf, end - buf); + if (size_t size= end - buf) + { + rlen-= uint32_t(size); + c.append(buf, size); + } ++i; ut_ad(i != m_log.end()); buf= i->start(); @@ -690,7 +693,7 @@ ATTRIBUTE_NOINLINE size_t mtr_t::encrypt() noexcept } buf= const_cast(mtr_t::parse_length(buf, &rlen)); - ut_ad(buf < end); + ut_ad(buf <= end); } } From 5e93fe11cb7d3aa15ec0e14ebf17a4042d8a4506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 10 Oct 2025 12:31:07 +0300 Subject: [PATCH 03/69] MDEV-37677: Inconsistent flush_list after InnoDB recovery In commit bea4adcb5a410659803d4aecc4b384a0e7d67d56 (MDEV-35225) we inadvertently introduced a race condition. Another thread may invoke buf_page_t::write_complete() between the time log_sort_flush_list() inserted the block to the list for sorting, and the time it would apply the sorted list back to buf_pool.flush_list. In this case, log_sort_flush_list() would neither add the block to buf_pool.flush_list nor clear the buf_page_t::oldest_modification_ so that it would correctly indicate whether the block is in the list. log_sort_flush_list(): Simplify the logic, and always add the entire sorted list to the buf_pool.flush_list, even if they had been written back during the time we were copying or sorting. This fixes an anomaly where a subsequent buf_pool_t::insert_into_flush_list() would end up incrementing buf_pool.flush_list.count by one too much. Thanks to Daniel Black for providing an "rr replay" trace of a failure. --- storage/innobase/log/log0recv.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index b262c2fbd95..41a8f4a4fb2 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3667,10 +3667,8 @@ static void log_sort_flush_list() noexcept for (size_t i= 0; i < idx; i++) { buf_page_t *b= list[i]; - const lsn_t lsn{b->oldest_modification()}; - if (lsn == 1) - continue; - DBUG_ASSERT(lsn > 2); + ut_d(const lsn_t lsn{b->oldest_modification()}); + ut_ad(lsn == 1 || lsn > 2); UT_LIST_ADD_LAST(buf_pool.flush_list, b); } From 8a2b620493eb7df9e62def9d5a0901f6e45b3c13 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 8 Oct 2025 11:42:17 +0200 Subject: [PATCH 04/69] Windows ARM - speed up tests on CI, by using --debug-no-sync --- .github/workflows/windows-arm64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.yml index 78f3628a105..a061849cc25 100644 --- a/.github/workflows/windows-arm64.yml +++ b/.github/workflows/windows-arm64.yml @@ -54,4 +54,4 @@ jobs: $cidir = "$tmp/ci" mkdir $cidir fsutil file setCaseSensitiveInfo $cidir enable - perl bld\mysql-test\mysql-test-run.pl --force --parallel=$parallel --suite=main,innodb --vardir=$cidir/var --mysqld=--lower-case-table-names=0 --mysqld=--loose-innodb-flush-log-at-trx-commit=2 + perl bld\mysql-test\mysql-test-run.pl --force --parallel=$parallel --suite=main,innodb --vardir=$cidir/var --mysqld=--lower-case-table-names=0 --mysqld=--loose-innodb-flush-log-at-trx-commit=2 --mysqld=--debug-no-sync From cabb77c9a1ce6a0cfc416b50f27df4568afe0977 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 10 Oct 2025 08:21:55 +0200 Subject: [PATCH 05/69] MDEV-33474 postfix - refine include/exclude rules for runtime dependencies Don't exclude OpenSSL runtime dependencies, even if they are in Windows system directory. chocolatey package manager, and underlying ShiningLight installer and manager puts them there. Previously, the assumption was that system32 only contains OS libraries. That is normally also the case, except this specific case. --- cmake/install_macros.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index cad94a64193..282800a3285 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -286,6 +286,7 @@ FUNCTION(INSTALL_RUNTIME_DEPS) POST_EXCLUDE_REGEXES ".*system32/.*\\.dll" # Windows stuff POST_INCLUDE_REGEXES + "libssl" "libcrypto" # Account for OpenSSL libraries in system32 DIRECTORIES $<$:${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin $<$,$>:${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin> From de3e6e6519ba619288a43e3ac65f666b80f7cf69 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Sun, 12 Oct 2025 21:08:04 +0300 Subject: [PATCH 06/69] Missing DBUG_RETURN or DBUG_VOID_RETURN in Diagnostics_area::set_ok_status --- sql/sql_error.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_error.cc b/sql/sql_error.cc index bb05ab298be..dd34e9d9428 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -349,7 +349,7 @@ Diagnostics_area::set_ok_status(ulonglong affected_rows, with an OK packet. */ if (unlikely(is_error() || is_disabled())) - return; + DBUG_VOID_RETURN; /* When running a bulk operation, m_status will be DA_OK for the first operation and set to DA_OK_BULK for all following operations. From 9f8716ab612ee13a4ecd41dfc70fd89c0add81df Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 13 Oct 2025 13:04:29 +0530 Subject: [PATCH 07/69] MDEV-37138: Innochecksum fails to handle doublewrite buffer and multiple file tablespace Problem: ======= - innochecksum was incorrectly interpreting doublewrite buffer pages as index pages, causing confusion about stale tables in the system tablespace. - innochecksum fails to parse the multi-file system tablespace Solution: ======== 1. Rewrite checksum of doublewrite buffer pages are skipped. 2. Introduced the option --tablespace-flags which can be used to initialize page size. This option can handle the ibdata2, ibdata3 etc without parsing ibdata1. --- extra/innochecksum.cc | 212 ++++++++++++------ .../r/innochecksum_flags_and_skip.result | 28 +++ .../innodb/t/innochecksum_flags_and_skip.opt | 2 + .../innodb/t/innochecksum_flags_and_skip.test | 171 ++++++++++++++ .../suite/innodb_zip/r/innochecksum_2.result | 17 +- .../suite/innodb_zip/r/innochecksum_3.result | 1 + .../suite/innodb_zip/t/innochecksum_2.opt | 1 + .../suite/innodb_zip/t/innochecksum_2.test | 37 ++- storage/innobase/include/fsp0types.h | 2 + storage/innobase/include/trx0sys.h | 5 +- storage/innobase/include/trx0undo.h | 3 +- 11 files changed, 399 insertions(+), 80 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innochecksum_flags_and_skip.result create mode 100644 mysql-test/suite/innodb/t/innochecksum_flags_and_skip.opt create mode 100644 mysql-test/suite/innodb/t/innochecksum_flags_and_skip.test diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index ebe4431ff1d..4f049f86328 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -49,7 +49,6 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */ #include "page0zip.h" /* page_zip_*() */ #include "trx0undo.h" /* TRX_* */ #include "fil0crypt.h" /* fil_space_verify_crypt_checksum */ - #include #ifdef UNIV_NONINL @@ -78,6 +77,8 @@ static ulint extent_size; static ulint xdes_size; ulong srv_page_size; uint32_t srv_page_size_shift; +static uint32_t dblwr_1; +static uint32_t dblwr_2; /* Current page number (0 based). */ uint32_t cur_page_num; /* Current space. */ @@ -101,8 +102,10 @@ FILE* log_file = NULL; /* Enabled for log write option. */ static bool is_log_enabled = false; static bool skip_freed_pages; +static uint32_t tablespace_flags= 0; static byte field_ref_zero_buf[UNIV_PAGE_SIZE_MAX]; const byte *field_ref_zero = field_ref_zero_buf; +constexpr uint32_t USE_FSP_FLAGS{UINT32_MAX}; #ifndef _WIN32 /* advisory lock for non-window system. */ @@ -257,12 +260,9 @@ void print_leaf_stats( } /** Init the page size for the tablespace. -@param[in] buf buffer used to read the page */ -static void init_page_size(const byte* buf) +@param[in] flags InnoDB tablespace flags */ +static void init_page_size_from_flags(const uint32_t flags) { - const unsigned flags = mach_read_from_4(buf + FIL_PAGE_DATA - + FSP_SPACE_FLAGS); - if (fil_space_t::full_crc32(flags)) { const uint32_t ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags); srv_page_size_shift = UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize; @@ -544,24 +544,15 @@ static bool is_page_corrupted(byte *buf, bool is_encrypted, uint32_t flags) return(is_corrupted); } -/********************************************//* - Check if page is doublewrite buffer or not. - @param [in] page buffer page - - @retval true if page is doublewrite buffer otherwise false. -*/ -static -bool -is_page_doublewritebuffer( - const byte* page) +/** Check if page is doublewrite buffer or not. +@retval true if page is doublewrite buffer otherwise false. */ +static bool is_page_doublewritebuffer() { - if ((cur_page_num >= extent_size) - && (cur_page_num < extent_size * 3)) { - /* page is doublewrite buffer. */ - return (true); - } - - return (false); + if (cur_space != 0) return false; + const uint32_t extent{static_cast( + cur_page_num & ~(extent_size - 1))}; + return cur_page_num > FSP_DICT_HDR_PAGE_NO && + extent && (extent == dblwr_1 || extent == dblwr_2); } /*******************************************************//* @@ -768,7 +759,7 @@ Parse the page and collect/dump the information about page type @param [in] file file for diagnosis. @param [in] is_encrypted tablespace is encrypted */ -void +static void parse_page( const byte* page, byte* xdes, @@ -788,6 +779,12 @@ parse_page( str = skip_page ? "Double_write_buffer" : "-"; page_no = mach_read_from_4(page + FIL_PAGE_OFFSET); if (skip_freed_pages) { + + /** Skip doublewrite pages when -r is enabled */ + if (is_page_doublewritebuffer()) { + return; + } + const byte *des= xdes + XDES_ARR_OFFSET + xdes_size * ((page_no & (physical_page_size - 1)) / extent_size); @@ -982,6 +979,18 @@ parse_page( fprintf(file, "#::" UINT32PF "\t\t|\t\tTransaction system " "page\t\t|\t%s\n", cur_page_num, str); } + + if (cur_space == 0 && + (mach_read_from_4(page + TRX_SYS_DOUBLEWRITE + + TRX_SYS_DOUBLEWRITE_MAGIC) == + TRX_SYS_DOUBLEWRITE_MAGIC_N)) { + dblwr_1 = mach_read_from_4( + page + TRX_SYS_DOUBLEWRITE + + TRX_SYS_DOUBLEWRITE_BLOCK1); + dblwr_2 = mach_read_from_4( + page + TRX_SYS_DOUBLEWRITE + + TRX_SYS_DOUBLEWRITE_BLOCK2); + } break; case FIL_PAGE_TYPE_FSP_HDR: @@ -1224,6 +1233,9 @@ static struct my_option innochecksum_options[] = { {"skip-freed-pages", 'r', "skip freed pages for the tablespace", &skip_freed_pages, &skip_freed_pages, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"tablespace-flags", 0, "InnoDB tablespace flags (default: 4294967295 " + "= read from page 0)", &tablespace_flags, &tablespace_flags, 0, + GET_UINT, REQUIRED_ARG, USE_FSP_FLAGS, 0, USE_FSP_FLAGS, 0, 0, 0}, {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -1298,6 +1310,14 @@ innochecksum_get_one_option( my_end(0); exit(EXIT_SUCCESS); break; + default: + if (tablespace_flags != USE_FSP_FLAGS && + !fil_space_t::is_valid_flags(tablespace_flags, false) && + !fil_space_t::is_valid_flags(tablespace_flags, true)) { + fprintf(stderr, "Error: Provided --tablespace-flags " + "is not valid."); + return true; + } } return(false); @@ -1428,6 +1448,87 @@ rewrite_checksum( && !write_file(filename, fil_in, buf, flags, pos); } +/** Read and validate page 0, then initialize tablespace flags +and page size. +@param fil_in File pointer +@param buf Buffer to read page into +@return whether the page was read successfully */ +static bool read_and_validate_page0(FILE *fil_in, byte *buf) +{ + /* Read the minimum page size first */ + size_t initial_page_size= UNIV_ZIP_SIZE_MIN; + if (tablespace_flags != USE_FSP_FLAGS) + { + init_page_size_from_flags(tablespace_flags); + initial_page_size= physical_page_size; + } + + /* Read just enough to get the tablespace flags */ + size_t bytes= fread(buf, 1, initial_page_size, fil_in); + + if (bytes != initial_page_size) + { + fprintf(stderr, "Error: Was not able to read the " + "minimum page size of %zu bytes. Bytes read " + "was %zu\n", initial_page_size, bytes); + return false; + } + + /* Read space_id and page offset */ + cur_space= mach_read_from_4(buf + FIL_PAGE_SPACE_ID); + cur_page_num= mach_read_from_4(buf + FIL_PAGE_OFFSET); + + /* Get tablespace flags from the FSP header */ + uint32_t flags= mach_read_from_4(buf + FSP_HEADER_OFFSET + + FSP_SPACE_FLAGS); + + if (tablespace_flags != USE_FSP_FLAGS) + { + if (cur_page_num == 0 && flags != tablespace_flags) + fprintf(stderr, "Error: Mismatch between provided tablespace " + "flags (0x%x) and file flags (0x%x)\n", + tablespace_flags, flags); + } + else + { + if (cur_page_num) + { + fprintf(stderr, "Error: First page of the tablespace file " + "should be 0, but encountered page number %" PRIu32 ". " + "If you are checking multi file system " + "tablespace files, please specify the correct " + "tablespace flags using --tablespace-flags option.\n", + cur_page_num); + return false; + } + /* Initialize page size parameters based on flags */ + init_page_size_from_flags(flags); + /* Read the rest of the page if it's larger than the minimum size */ + if (physical_page_size > UNIV_ZIP_SIZE_MIN) + { + /* Read rest of the page 0 to determine crypt_data */ + ulint bytes= read_file(buf, true, physical_page_size, fil_in); + if (bytes != physical_page_size) + { + fprintf(stderr, "Error: Was not able to read the rest of the " + "page of " ULINTPF " bytes. Bytes read was " ULINTPF "\n", + physical_page_size - UNIV_ZIP_SIZE_MIN, bytes); + return false; + } + } + tablespace_flags= flags; + } + + if (physical_page_size < UNIV_ZIP_SIZE_MIN || + physical_page_size > UNIV_PAGE_SIZE_MAX) + { + fprintf(stderr, "Error: Invalid page size " ULINTPF + " encountered\n", physical_page_size); + return false; + } + return true; +} + int main( int argc, char **argv) @@ -1563,51 +1664,13 @@ int main( } } - /* Read the minimum page size. */ - bytes = fread(buf, 1, UNIV_ZIP_SIZE_MIN, fil_in); - partial_page_read = true; - - if (bytes != UNIV_ZIP_SIZE_MIN) { - fprintf(stderr, "Error: Was not able to read the " - "minimum page size "); - fprintf(stderr, "of %d bytes. Bytes read was " ULINTPF "\n", - UNIV_ZIP_SIZE_MIN, bytes); - + /* Read and validate page 0 */ + if (!read_and_validate_page0(fil_in, buf)) { exit_status = 1; goto my_exit; } - /* enable variable is_system_tablespace when space_id of given - file is zero. Use to skip the checksum verification and rewrite - for doublewrite pages. */ - cur_space = mach_read_from_4(buf + FIL_PAGE_SPACE_ID); - cur_page_num = mach_read_from_4(buf + FIL_PAGE_OFFSET); - - /* Determine page size, zip_size and page compression - from fsp_flags and encryption metadata from page 0 */ - init_page_size(buf); - - uint32_t flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + buf); - - if (physical_page_size == UNIV_ZIP_SIZE_MIN) { - partial_page_read = false; - } else { - /* Read rest of the page 0 to determine crypt_data */ - bytes = read_file(buf, partial_page_read, physical_page_size, fil_in); - if (bytes != physical_page_size) { - fprintf(stderr, "Error: Was not able to read the " - "rest of the page "); - fprintf(stderr, "of " ULINTPF " bytes. Bytes read was " ULINTPF "\n", - physical_page_size - UNIV_ZIP_SIZE_MIN, bytes); - - exit_status = 1; - goto my_exit; - } - partial_page_read = false; - } - - - /* Now that we have full page 0 in buffer, check encryption */ + /* Check if tablespace is encrypted */ bool is_encrypted = check_encryption(filename, buf); /* Verify page 0 contents. Note that we can't allow @@ -1618,7 +1681,8 @@ int main( allow_mismatches = 0; exit_status = verify_checksum(buf, is_encrypted, - &mismatch_count, flags); + &mismatch_count, + tablespace_flags); if (exit_status) { fprintf(stderr, "Error: Page 0 checksum mismatch, can't continue. \n"); @@ -1629,7 +1693,8 @@ int main( if ((exit_status = rewrite_checksum( filename, fil_in, buf, - &pos, is_encrypted, flags))) { + &pos, is_encrypted, + tablespace_flags))) { goto my_exit; } @@ -1825,7 +1890,7 @@ unexpected_eof: first_non_zero: if (is_system_tablespace) { /* enable when page is double write buffer.*/ - skip_page = is_page_doublewritebuffer(buf); + skip_page = is_page_doublewritebuffer(); } else { skip_page = false; } @@ -1846,13 +1911,16 @@ first_non_zero: && !is_page_free(xdes, physical_page_size, cur_page_num) && (exit_status = verify_checksum( buf, is_encrypted, - &mismatch_count, flags))) { + &mismatch_count, + tablespace_flags))) { goto my_exit; } - if ((exit_status = rewrite_checksum( - filename, fil_in, buf, - &pos, is_encrypted, flags))) { + if (!is_page_doublewritebuffer() && + (exit_status = rewrite_checksum( + filename, fil_in, buf, + &pos, is_encrypted, + tablespace_flags))) { goto my_exit; } diff --git a/mysql-test/suite/innodb/r/innochecksum_flags_and_skip.result b/mysql-test/suite/innodb/r/innochecksum_flags_and_skip.result new file mode 100644 index 00000000000..183bb58192a --- /dev/null +++ b/mysql-test/suite/innodb/r/innochecksum_flags_and_skip.result @@ -0,0 +1,28 @@ +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +SET GLOBAL innodb_log_checkpoint_now=ON; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +INSERT INTO t1 SET a=1; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +# Skip InnoDB Doublewrite Buffer +Should not exist when summary excludes dblwr pages +Should exist when summary includes dblwr pages +# restart +CREATE TABLE ibd_1(f1 INT PRIMARY KEY)ENGINE=InnoDB; +INSERT INTO ibd_1 VALUES(1), (2), (3), (4); +# Pass wrong tablespace flag for ibdata2 +FOUND 1 /Error: Page 0 checksum mismatch/ in result.log +# Pass wrong tablespace flag for ibdata1 +FOUND 1 /Error: Mismatch between provided tablespace flags/ in result.log +# Pass invalid tablespace flag for ibdata1 +FOUND 1 /Error: Provided --tablespace-flags is not valid/ in result.log +# innochecksum should be succesfull +NOT FOUND /Fail/ in result.log +# Create a tablespace with page number > 2^31 +# Test innochecksum with the modified ibdata3 +FOUND 1 /Error: First page of the tablespace file should be 0, but encountered page number 2147483649/ in result.log +# Test innochecksum with the modified ibdata3 with tablespace flags +FOUND 1 /Exceeded the maximum allowed checksum mismatch/ in result.log +# restart +DROP TABLE t1, ibd_1; diff --git a/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.opt b/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.opt new file mode 100644 index 00000000000..5d265d61d14 --- /dev/null +++ b/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.opt @@ -0,0 +1,2 @@ +--innodb_data_file_path=ibdata1:3M;ibdata2:1M:autoextend +--innodb_sys_tablespaces diff --git a/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.test b/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.test new file mode 100644 index 00000000000..a8e700e13ac --- /dev/null +++ b/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.test @@ -0,0 +1,171 @@ +--source include/have_innodb.inc +--source include/not_embedded.inc +--source include/have_debug.inc +let MYSQLD_DATADIR= `SELECT @@datadir`; +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +SET GLOBAL innodb_log_checkpoint_now=ON; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; +INSERT INTO t1 SET a=1; +FLUSH TABLE t1 FOR EXPORT; +UNLOCK TABLES; + +let INDEX_ID= `select INDEX_ID FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = (SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1")`; + +let FLAG= `SELECT flag FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE NAME="innodb_system"`; + +let $shutdown_timeout=0; +--source include/shutdown_mysqld.inc +let $resultlog=$MYSQLTEST_VARDIR/tmp/result.log; +let $resultlog_1=$MYSQLTEST_VARDIR/tmp/result_1.log; + +exec $INNOCHECKSUM -S -r $MYSQLD_DATADIR/ibdata1 > $resultlog; +--echo # Skip InnoDB Doublewrite Buffer +exec $INNOCHECKSUM -S $MYSQLD_DATADIR/ibdata1 > $resultlog_1; + +perl; +use strict; +use warnings; +use File::Spec::Functions qw(catfile); + +sub check_index_in_file { + my ($filename, $search_id, $file_desc, $expect_found) = @_; + my $found = 0; + open(my $fh, '<', $filename) or die "Could not open file '$filename': $!\n"; + my $line_count = 0; + while (my $line = <$fh>) { + $line_count++; + chomp $line; + # Skip empty lines and header lines + next if $line =~ /^\s*$/; + next if $line =~ /index_id.*#pages/; # Skip header line + # Split the line by whitespace + my @fields = grep { $_ ne '' } split(/\s+/, $line); + next unless @fields; # Skip if no fields + # The first field is the index_id + my $current_id = $fields[0]; + # Check if this is the ID we're looking for + if (defined $current_id && $current_id eq $search_id) { + $found = 1; + last; + } + } + close $fh; + + if ($found != $expect_found) { + print "\n=== UNEXPECTED RESULT - SHOWING FILE CONTENTS ($file_desc) ===\n"; + open($fh, '<', $filename) or die "Cannot reopen file: $!"; + print while <$fh>; + close $fh; + print "=== END OF FILE ===\n\n"; + } +} + +my $search_id = $ENV{'INDEX_ID'}; + +# Define file paths +my $resultlog = catfile($ENV{'MYSQLTEST_VARDIR'}, 'tmp', 'result.log'); +my $resultlog_1 = catfile($ENV{'MYSQLTEST_VARDIR'}, 'tmp', 'result_1.log'); + +# Check both files +print "Should not exist when summary excludes dblwr pages\n"; +check_index_in_file($resultlog, $search_id, 'result.log', 0); + +print "Should exist when summary includes dblwr pages\n"; +check_index_in_file($resultlog_1, $search_id, 'result_1.log', 1); +EOF + +remove_file $resultlog; +remove_file $resultlog_1; + +# We expect deterministic checksum error when we pass +# incorrect wrong flags to innochecksum. Below restart is needed +# to make sure that we flush all the pages. +--source include/start_mysqld.inc +CREATE TABLE ibd_1(f1 INT PRIMARY KEY)ENGINE=InnoDB; +INSERT INTO ibd_1 VALUES(1), (2), (3), (4); +let $shutdown_timeout=; +--source include/shutdown_mysqld.inc +--echo # Pass wrong tablespace flag for ibdata2 +--error 1 +exec $INNOCHECKSUM -S --tablespace_flags=39 $MYSQLD_DATADIR/ibdata2 > $resultlog 2>&1; + +let SEARCH_FILE=$resultlog; +let SEARCH_PATTERN=Error: Page 0 checksum mismatch; +--source include/search_pattern_in_file.inc +remove_file $resultlog; + +--echo # Pass wrong tablespace flag for ibdata1 +--error 1 +exec $INNOCHECKSUM -S --tablespace_flags=39 $MYSQLD_DATADIR/ibdata1 > $resultlog 2>&1; + +let SEARCH_PATTERN=Error: Mismatch between provided tablespace flags; +--source include/search_pattern_in_file.inc +remove_file $resultlog; + +--echo # Pass invalid tablespace flag for ibdata1 +--error 1 +exec $INNOCHECKSUM -S --tablespace_flags=89 $MYSQLD_DATADIR/ibdata1 > $resultlog 2>&1; + +let SEARCH_PATTERN=Error: Provided --tablespace-flags is not valid; +--source include/search_pattern_in_file.inc +remove_file $resultlog; + +--echo # innochecksum should be succesfull +exec $INNOCHECKSUM -S --tablespace_flags=$FLAG $MYSQLD_DATADIR/ibdata2 > $resultlog 2>&1; + +let SEARCH_PATTERN=Fail; +--source include/search_pattern_in_file.inc + +--echo # Create a tablespace with page number > 2^31 +--let $ibdata3 = $MYSQLD_DATADIR/ibdata3 +perl; +do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; +my $polynomial = 0x82f63b78; # CRC-32C +my $ps = 16384; # Default InnoDB page size +my $page_num = 2147483649; # 2^31 + 1 +my $filename = "$ENV{MYSQLD_DATADIR}/ibdata3"; + +# Create a zero-filled page +my $page = "\0" x $ps; + +# Set page number (FIL_PAGE_OFFSET) +substr($page, 4, 4) = pack('NN', $page_num); +# Set a valid LSN (log sequence number) +my $lsn = 0x12345678; +substr($page, 16, 8) = pack('NN', $lsn & 0xFFFFFFFF, $lsn >> 32); + +# Calculate the checksum +my $checksum = pack('N', + mycrc32(substr($page, 4, 22), 0, $polynomial) ^ + mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial) +); +# Write the checksum at the beginning (FIL_PAGE_SPACE_OR_CHKSUM) +# and at the end (FIL_PAGE_END_LSN_OLD_CHKSUM) of the page +substr($page, 0, 4) = $checksum; +substr($page, $ps - 8, 4) = $checksum; + +# Write the page to file +open(my $fh, '>', $filename) or die "Could not open file $filename: $!"; +binmode $fh; +print $fh $page; +close $fh; +EOF + +--echo # Test innochecksum with the modified ibdata3 +--error 1 +exec $INNOCHECKSUM -S $ibdata3 > $resultlog 2>&1; +let SEARCH_PATTERN=Error: First page of the tablespace file should be 0, but encountered page number 2147483649; +--source include/search_pattern_in_file.inc +remove_file $resultlog; + +--echo # Test innochecksum with the modified ibdata3 with tablespace flags +--error 1 +exec $INNOCHECKSUM -S --tablespace_flags=$FLAG $ibdata3 > $resultlog 2>&1; +let SEARCH_PATTERN=Exceeded the maximum allowed checksum mismatch; +--source include/search_pattern_in_file.inc + +remove_file $ibdata3; +--source include/start_mysqld.inc +DROP TABLE t1, ibd_1; +remove_file $resultlog; diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_2.result b/mysql-test/suite/innodb_zip/r/innochecksum_2.result index e7e36e5188e..0477abda548 100644 --- a/mysql-test/suite/innodb_zip/r/innochecksum_2.result +++ b/mysql-test/suite/innodb_zip/r/innochecksum_2.result @@ -14,6 +14,12 @@ INSERT INTO t1 SELECT * from t1; INSERT INTO t1 SELECT * from t1; INSERT INTO t1 SELECT * from t1; INSERT INTO t1 SELECT * from t1; +CREATE TABLE t2 (j LONGBLOB) ENGINE = InnoDB +ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; +CREATE TABLE t3 (j LONGBLOB) ENGINE = InnoDB +ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; +CREATE TABLE t4(c1 INT PRIMARY KEY,c2 VARCHAR(20), +INDEX(c2(10))) ENGINE=InnoDB; # stop the server Variables (--variable-name=value) @@ -35,6 +41,7 @@ log (No default value) leaf FALSE merge 0 skip-freed-pages FALSE +tablespace-flags 4294967295 [1]:# check the both short and long options for "help" [2]:# Run the innochecksum when file isn't provided. # It will print the innochecksum usage similar to --help option. @@ -69,6 +76,9 @@ See https://mariadb.com/kb/en/library/innochecksum/ for usage hints. pages -r, --skip-freed-pages skip freed pages for the tablespace + --tablespace-flags=# + InnoDB tablespace flags (default: 4294967295 = read from + page 0) Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) @@ -88,9 +98,12 @@ log (No default value) leaf FALSE merge 0 skip-freed-pages FALSE +tablespace-flags 4294967295 [3]:# check the both short and long options for "count" and exit Number of pages:# Number of pages:# [4]:# Print the version of innochecksum and exit -innochecksum Ver #.#.## Restart the DB server -DROP TABLE t1; +innochecksum Ver #.#.# +[5]:# check t1.ibd and t2.ibd summary with and without tablespace_flags +# Restart the DB server +DROP TABLE t4, t3, t2, t1; diff --git a/mysql-test/suite/innodb_zip/r/innochecksum_3.result b/mysql-test/suite/innodb_zip/r/innochecksum_3.result index 0e5e4d2d7f7..af37f4d5df5 100644 --- a/mysql-test/suite/innodb_zip/r/innochecksum_3.result +++ b/mysql-test/suite/innodb_zip/r/innochecksum_3.result @@ -140,6 +140,7 @@ log (No default value) leaf FALSE merge 0 skip-freed-pages FALSE +tablespace-flags 4294967295 [5]: Page type dump for with shortform for tab1.ibd diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_2.opt b/mysql-test/suite/innodb_zip/t/innochecksum_2.opt index ac26eca328c..af67edaab10 100644 --- a/mysql-test/suite/innodb_zip/t/innochecksum_2.opt +++ b/mysql-test/suite/innodb_zip/t/innochecksum_2.opt @@ -1 +1,2 @@ --skip-innodb-doublewrite +--innodb_sys_tablespaces diff --git a/mysql-test/suite/innodb_zip/t/innochecksum_2.test b/mysql-test/suite/innodb_zip/t/innochecksum_2.test index 57926d921f4..7d862a9a1e0 100644 --- a/mysql-test/suite/innodb_zip/t/innochecksum_2.test +++ b/mysql-test/suite/innodb_zip/t/innochecksum_2.test @@ -25,6 +25,23 @@ while ($i > 0) { dec $i; } +CREATE TABLE t2 (j LONGBLOB) ENGINE = InnoDB +ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; + +CREATE TABLE t3 (j LONGBLOB) ENGINE = InnoDB +ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; + +CREATE TABLE t4(c1 INT PRIMARY KEY,c2 VARCHAR(20), + INDEX(c2(10))) ENGINE=InnoDB; + +let FLAG= `SELECT flag FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE NAME="test/t1"`; + +let FLAG2= `SELECT flag FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE NAME="test/t2"`; + +let FLAG3= `SELECT flag FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE NAME="test/t3"`; + +let FLAG4= `SELECT flag FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE NAME="test/t4"`; + --echo # stop the server --source include/shutdown_mysqld.inc @@ -80,10 +97,24 @@ EOF --exec $INNOCHECKSUM -c $MYSQLD_DATADIR/test/t1.ibd --echo [4]:# Print the version of innochecksum and exit ---replace_regex /.*innochecksum.*Ver.*[0-9]*.[0-9]*.[0-9]*.*/innochecksum Ver #.#.#/ ---exec $INNOCHECKSUM -V $MYSQLD_DATADIR/test/t1.ibd +--replace_regex /.*innochecksum.*Ver [0-9]*\.[0-9]*\.[0-9]*, for .*\)/innochecksum Ver #.#.#/ +--exec $INNOCHECKSUM -V +--echo [5]:# check t1.ibd and t2.ibd summary with and without tablespace_flags +let $resultlog=$MYSQLTEST_VARDIR/tmp/result.log; +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/t1.ibd -s 3 -e 5 > $resultlog +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/t2.ibd -s 3 -e 5 > $resultlog +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/t3.ibd -s 3 -e 5 > $resultlog +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/t4.ibd -s 3 -e 5 > $resultlog + + +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/t1.ibd --tablespace_flags=$FLAG -s 3 -e 5 > $resultlog +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/t2.ibd --tablespace_flags=$FLAG2 -s 3 -e 5 > $resultlog +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/t3.ibd --tablespace_flags=$FLAG3 -s 3 -e 5 > $resultlog +--exec $INNOCHECKSUM -S $MYSQLD_DATADIR/test/t4.ibd --tablespace_flags=$FLAG4 -s 3 -e 5 > $resultlog + +remove_file $resultlog; --echo # Restart the DB server --source include/start_mysqld.inc -DROP TABLE t1; +DROP TABLE t4, t3, t2, t1; diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h index 9a23e840380..38473911921 100644 --- a/storage/innobase/include/fsp0types.h +++ b/storage/innobase/include/fsp0types.h @@ -149,6 +149,7 @@ enum fsp_reserve_t { FSP_CLEANING, /* reservation done during purge operations */ FSP_BLOB /* reservation being done for BLOB insertion */ }; +#endif /* UNIV_INNOCHECKSUM */ /* Number of pages described in a single descriptor page: currently each page description takes less than 1 byte; a descriptor page is repeated every @@ -189,6 +190,7 @@ every XDES_DESCRIBED_PER_PAGE pages in every tablespace. */ /*--------------------------------------*/ /* @} */ +#ifndef UNIV_INNOCHECKSUM /** Check if tablespace is system temporary. @param[in] space_id verify is checksum is enabled for given space. @return true if tablespace is system temporary. */ diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 604441ce030..9f0289c1f71 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -24,6 +24,7 @@ Transaction system Created 3/26/1996 Heikki Tuuri *******************************************************/ +#ifndef UNIV_INNOCHECKSUM #pragma once #include "buf0buf.h" #include "fil0fil.h" @@ -277,6 +278,7 @@ FIXED WSREP XID info offsets for 4k page size 10.0.32-galera #define TRX_SYS_WSREP_XID_BQUAL_LEN 12 #define TRX_SYS_WSREP_XID_DATA 16 #endif /* WITH_WSREP*/ +#endif /* !UNIV_INNOCHECKSUM */ /** Doublewrite buffer */ /* @{ */ @@ -325,7 +327,7 @@ constexpr uint32_t TRX_SYS_DOUBLEWRITE_MAGIC_N= 536853855; /** Contents of TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED */ constexpr uint32_t TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N= 1783657386; /* @} */ - +#ifndef UNIV_INNOCHECKSUM trx_t* current_trx(); struct rw_trx_hash_element_t @@ -1307,3 +1309,4 @@ private: /** The transaction system */ extern trx_sys_t trx_sys; +#endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index 7c6081d415d..2ee2e8ac8a5 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -27,9 +27,8 @@ Created 3/26/1996 Heikki Tuuri #ifndef trx0undo_h #define trx0undo_h -#ifndef UNIV_INNOCHECKSUM #include "trx0sys.h" - +#ifndef UNIV_INNOCHECKSUM /** The LSB of the "is insert" flag in DB_ROLL_PTR */ #define ROLL_PTR_INSERT_FLAG_POS 55 /** The LSB of the 7-bit trx_rseg_t::id in DB_ROLL_PTR */ From 1efbba3ac18ffba0a597e316c841687273bbf806 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Thu, 2 Oct 2025 14:41:05 -0400 Subject: [PATCH 08/69] MDEV-37791: gcov doesn't work on macOS Clang is the default compiler on macOS and it requires the --coverage flag to enable gcov compatible output. gcov.h is not available on macOS, so don't set the -DHAVE_gcov variable. --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e9d0da5a4e..ef5b901342e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,9 +297,13 @@ IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_ASSERTIONS") ENDIF() -OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF) +OPTION(ENABLE_GCOV "Enable gcov (debug, macOS and Linux builds only)" OFF) IF (ENABLE_GCOV) - MY_CHECK_AND_SET_COMPILER_FLAG("-DHAVE_gcov -fprofile-arcs -ftest-coverage -lgcov" DEBUG) + IF (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + MY_CHECK_AND_SET_COMPILER_FLAG("--coverage" DEBUG) + ELSE() + MY_CHECK_AND_SET_COMPILER_FLAG("-DHAVE_gcov -fprofile-arcs -ftest-coverage -lgcov" DEBUG) + ENDIF() ENDIF() OPTION(WITHOUT_PACKED_SORT_KEYS "disable packed sort keys" OFF) From aa8af2dcddb64ecdb794ff5c805608c13bdfb7ee Mon Sep 17 00:00:00 2001 From: Nikita Malyavin Date: Wed, 8 Oct 2025 19:22:52 +0200 Subject: [PATCH 09/69] Fix CF_ flags numeration for sql_command_flags --- sql/sql_class.h | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index f604f8ff948..1bbcbea50dd 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -7603,27 +7603,23 @@ public: If command creates or drops a database */ #define CF_DB_CHANGE (1U << 23) - -#ifdef WITH_WSREP -/** - DDL statement that may be subject to error filtering. -*/ -#define CF_WSREP_MAY_IGNORE_ERRORS (1U << 24) -/** - Basic DML statements that create writeset. -*/ -#define CF_WSREP_BASIC_DML (1u << 25) - -#endif /* WITH_WSREP */ - - -/* Bits in server_command_flags */ - /** Statement that deletes existing rows (DELETE, DELETE_MULTI) */ #define CF_DELETES_DATA (1U << 24) +#ifdef WITH_WSREP +/** + DDL statement that may be subject to error filtering. +*/ +#define CF_WSREP_MAY_IGNORE_ERRORS (1U << 25) +/** + Basic DML statements that create writeset. +*/ +#define CF_WSREP_BASIC_DML (1u << 26) +#endif /* WITH_WSREP */ + +/* Bits in server_command_flags */ /** Skip the increase of the global query id counter. Commonly set for commands that are stateless (won't cause any change on the server From 44dc149c78ca62cf2200b758dc23d15d01711f0e Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 10 Oct 2025 20:09:39 +0200 Subject: [PATCH 10/69] MDEV-37843 Remove InnoDB "optimizations" for debug_no_sync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch removes unnecessary and potentially performance affecting reads of my_disable_sync global variable, which exists for single purpose of speeding up mtr tests, by making fsync a no-op. The read is still left in its proper location in os_file_flush_func(). Background According to Marko Mäkelä, the removed code originated from the porting of MDEV-30054 — debug-no-sync doesn’t fully disable sync calls, introduced in merge commit be24e75229a4496e525677149c8a116a3ff4b372. At that point, the access to my_disable_sync variable in higher-level Innodb code was already unnecessary because MDEV-30136 had already implemented proper handling of flush skipping (in os0file.cc) about nine months earlier. --- storage/innobase/trx/trx0trx.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index f1e65c2e1e3..698c39eb695 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1262,9 +1262,7 @@ static void trx_flush_log_if_needed(lsn_t lsn, trx_t *trx) if (log_sys.get_flushed_lsn(std::memory_order_relaxed) >= lsn) return; - const bool flush= - (!my_disable_sync && - (srv_flush_log_at_trx_commit & 1)); + const bool flush= srv_flush_log_at_trx_commit & 1; if (!log_sys.is_mmap()) { completion_callback cb; @@ -1963,7 +1961,7 @@ trx_prepare( We must not be holding any mutexes or latches here. */ if (auto f = srv_flush_log_at_trx_commit) { - log_write_up_to(lsn, (f & 1) && !my_disable_sync); + log_write_up_to(lsn, f & 1); } if (!UT_LIST_GET_LEN(trx->lock.trx_locks) From 73745461d08d248c41fdc4acff2ccd4ecb9af79d Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Mon, 13 Oct 2025 15:01:38 -0400 Subject: [PATCH 11/69] MDEV-37851: main.repair_symlink-5543 broken on macOS Add error code 62 to the list of system-dependent but expected error codes. --- mysql-test/main/repair_symlink-5543.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/repair_symlink-5543.test b/mysql-test/main/repair_symlink-5543.test index 002b8d8023b..42ffa82696a 100644 --- a/mysql-test/main/repair_symlink-5543.test +++ b/mysql-test/main/repair_symlink-5543.test @@ -10,9 +10,9 @@ eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR'; insert t1 values (1); --system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD # Some systems fail with errcode 31 (FreeBSD), 40 (Linux), 85 (AIX), -# or 90 (MIPS) when doing openat, +# 62 (macOS), or 90 (MIPS) when doing openat, # while others don't have openat and fail with errcode 20. ---replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0|31|85/20/ /".*"/""/ +--replace_regex / '.*\/t1/ 'MYSQL_TMP_DIR\/t1/ /[49]0|31|85|62/20/ /".*"/""/ repair table t1; drop table t1; @@ -20,7 +20,7 @@ drop table t1; eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR'; insert t2 values (1); --system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD ---replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0|31|85/20/ /".*"/""/ +--replace_regex / '.*\/t2/ 'MYSQL_TMP_DIR\/t2/ /[49]0|31|85|62/20/ /".*"/""/ repair table t2; drop table t2; From 9220be8866a00788d11b08418498a704d04cc2b4 Mon Sep 17 00:00:00 2001 From: "i18n.site" Date: Wed, 13 Nov 2024 10:54:51 +0800 Subject: [PATCH 12/69] MDEV-36010 - fix myrocks_hotbackup for python3 python collections.OrderedDict removed iteritems see https://peps.python.org/pep-0469/ myrocks_hotbackup --move_back --datadir=$DATADIR --rocksdb_datadir="$DATADIR/#rocksdb" --rocksdb_waldir=$DATADIR --backup_dir=/tmp/myrocks.bak 2024-11-13 14:00:35.415 ERROR Directory /mnt/data/i18n/mariadb/data has file or directory #rocksdb! --- storage/rocksdb/myrocks_hotbackup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/rocksdb/myrocks_hotbackup.py b/storage/rocksdb/myrocks_hotbackup.py index 42c25c95c1c..5fe83d68b64 100755 --- a/storage/rocksdb/myrocks_hotbackup.py +++ b/storage/rocksdb/myrocks_hotbackup.py @@ -268,7 +268,7 @@ class RocksDBBackup(): start_time= time.time() last_progress_time= start_time progress_size= 0 - for fname, size in self.target_sst.iteritems(): + for fname, size in self.target_sst.items(): self.do_backup_sst(fname, size) progress_size= progress_size + size elapsed_seconds = time.time() - start_time @@ -319,11 +319,13 @@ class MySQLUtil: if socket: dbh = MySQLdb.Connect(user=user, passwd=password, + charset='utf8', unix_socket=socket) else: dbh = MySQLdb.Connect(user=user, passwd=password, port=port, + charset='utf8', host="127.0.0.1") return dbh @@ -645,8 +647,8 @@ def move_back(): print_move_back_usage() sys.exit() create_moveback_dir(opts.datadir) - create_moveback_dir(opts.rocksdb_datadir) create_moveback_dir(opts.rocksdb_waldir) + create_moveback_dir(opts.rocksdb_datadir) os.chdir(opts.backupdir) for f in os.listdir(opts.backupdir): From b9c3ee3bb56cc193f8b3731d2c7ef14f3aead997 Mon Sep 17 00:00:00 2001 From: jweisbuch Date: Wed, 16 Jul 2025 18:00:34 +0200 Subject: [PATCH 13/69] MDEV-37852 mytop: fix connection to localhost If a port is specified and DBD-MariaDB is used. This resulted in in: ("Connection error: port cannot be specified when host is localhost or embedded") Fixes Debian bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1109394 --- scripts/mytop.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/mytop.sh b/scripts/mytop.sh index e5d926ef616..bf4e72eb92c 100644 --- a/scripts/mytop.sh +++ b/scripts/mytop.sh @@ -1,6 +1,6 @@ #!/usr/bin/env perl # -# $Id: mytop,v 1.99-maria6 2019/10/22 14:53:51 jweisbuch Exp $ +# $Id: mytop,v 1.99-maria8 2025/07/16 17:59:26 jweisbuch Exp $ =pod @@ -21,7 +21,7 @@ use Socket; use List::Util qw(min max); use File::Basename; -$main::VERSION = "1.99-maria6"; +$main::VERSION = "1.99-maria8"; my $path_for_script = dirname($0); $| = 1; @@ -256,7 +256,11 @@ if (eval {DBI->install_driver("MariaDB")}) { if ($config{socket} and -S $config{socket}) { - $dsn .= "${prefix}_socket=$config{socket}"; + $dsn .= "${prefix}_socket=$config{socket}"; +} +elsif($config{host} eq "localhost") +{ + $dsn .= "host=$config{host}"; } else { From 3241798214b066d62ba3274ba5dc29549349ca65 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Sat, 20 Sep 2025 13:22:50 +0300 Subject: [PATCH 14/69] MDEV-37686 rpl.create_or_replace_mix2 fails in MDEV-35915 branch The test failed as the Jira ticket describes because of insufficient main transaction isolation from an out-of-band dynamic "new" transaction. Specifically the replicated transaction's temporary tables became accessible to the "new" transaction. The fixes ensure the "new" transaction can't reach any piece of replication transaction execution context, the temporary table list including. This is safe as by so far start_new_trans class instances need not any replication info, as it must've been anticipated by design. --- sql/sql_class.cc | 3 +++ sql/sql_class.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b9812f29e4b..0b155f9de9a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -6359,6 +6359,8 @@ start_new_trans::start_new_trans(THD *thd) thd->server_status&= ~(SERVER_STATUS_IN_TRANS | SERVER_STATUS_IN_TRANS_READONLY); thd->server_status|= SERVER_STATUS_AUTOCOMMIT; + org_rgi_slave= thd->rgi_slave; + thd->rgi_slave= NULL; } @@ -6375,6 +6377,7 @@ void start_new_trans::restore_old_transaction() MYSQL_COMMIT_TRANSACTION(org_thd->m_transaction_psi); org_thd->m_transaction_psi= m_transaction_psi; org_thd->variables.wsrep_on= wsrep_on; + org_thd->rgi_slave= org_rgi_slave; org_thd= 0; } diff --git a/sql/sql_class.h b/sql/sql_class.h index 1bbcbea50dd..58028f0183d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -5882,6 +5882,11 @@ class start_new_trans uint in_sub_stmt; uint server_status; my_bool wsrep_on; + /* + THD:rgi_slave may hold a part of the replicated "old" transaction's + execution context. Therefore it has to be reset/restored too. + */ + rpl_group_info* org_rgi_slave; public: start_new_trans(THD *thd); From 6c56c92a6c31ce4e85e3032ba72177dcadfa8aa5 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Thu, 25 Sep 2025 01:10:14 +0530 Subject: [PATCH 15/69] MDEV-36809: json_array_intersect crashs when unused table ref provided Analysis: So, there were two problems that needed to be fixed. 1) To fix the crash. 2) After fixing the crash, the result was wrong. Reason for crash: When we pass the hash to get_intersect_between_arrays(), We were initialially not passing it value, so the operations were not performed correctly. Reason for wrong result: The number of rows that it was returning were same as that in the table, but, only the first row had correct ouput, rest of them were NULL (it should also be the result of interection). This was because we modified the "items" HASH by deleting the "seen" elements. So for next rows, it did not have the elements it should have in the hash. Fix: 1) To fix the crash: pass the HASH by reference 2) To fix incorrect result: Maintain a separate "seen" hash, if an item is found the the "items" hash, delete it ony temporarily and put it in the seen hash. At then end, put the items from "seen" back into "items" and reset "seen". --- mysql-test/main/func_json.result | 14 ++++++++++ mysql-test/main/func_json.test | 8 ++++++ sql/item_jsonfunc.cc | 48 ++++++++++++++++++++++---------- sql/item_jsonfunc.h | 17 +++++++---- 4 files changed, 67 insertions(+), 20 deletions(-) diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index bcf0477a0f9..9957fb3dd26 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -5272,6 +5272,8 @@ SET @obj1='{ "a": 1,"b": 2,"c": 3}'; SELECT JSON_OBJECT_FILTER_KEYS (@obj1,@arr1); JSON_OBJECT_FILTER_KEYS (@obj1,@arr1) NULL +SET character_set_database=default; +SET CHARACTER SET default; # End of 11.2 Test # Beginning of 11.4 Test # @@ -5283,4 +5285,16 @@ NULL SELECT json_array_intersect(@a,@b); json_array_intersect(@a,@b) NULL +# MDEV-36809: json_array_intersect crashs when unused table ref provided +# +select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') as result from mysql.user; +result +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +SELECT ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ); +( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ) +1.000000 # End of 11.4 Test diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index e56c5ee4820..6219d7ac9c1 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -4175,6 +4175,9 @@ SET CHARACTER SET utf8; SET @obj1='{ "a": 1,"b": 2,"c": 3}'; SELECT JSON_OBJECT_FILTER_KEYS (@obj1,@arr1); +SET character_set_database=default; +SET CHARACTER SET default; + --echo # End of 11.2 Test --echo # Beginning of 11.4 Test @@ -4188,4 +4191,9 @@ SELECT JSON_OBJECT_FILTER_KEYS (@obj1,@arr1); SELECT json_array_intersect(@a,@b); +--echo # MDEV-36809: json_array_intersect crashs when unused table ref provided +--echo # +select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') as result from mysql.user; +SELECT ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ); + --echo # End of 11.4 Test diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index c2fc76f07ca..ac9f5b57f4d 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -5242,14 +5242,14 @@ bool Item_func_json_key_value::fix_length_and_dec(THD *thd) } -static bool create_hash(json_engine_t *value, HASH *items, bool &hash_inited, +static bool create_hash(json_engine_t *value, HASH *items, bool &item_hash_inited, MEM_ROOT *hash_root) { int level= value->stack_p; if (my_hash_init(PSI_INSTRUMENT_ME, items, value->s.cs, 0, 0, 0, get_key_name, NULL, 0)) return true; - hash_inited= true; + item_hash_inited= true; while (json_scan_next(value) == 0 && value->stack_p >= level) { @@ -5318,6 +5318,11 @@ static bool get_current_value(json_engine_t *js, const uchar *&value_start, return false; } +static my_bool restore_entry(void *element, void *arg) +{ + HASH *items = (HASH*) arg; + return my_hash_insert(items, (const uchar*) element); +} /* If the outermost layer of JSON is an array, @@ -5330,14 +5335,16 @@ static bool get_current_value(json_engine_t *js, const uchar *&value_start, FALSE - if two array documents have intersection TRUE - If two array documents do not have intersection */ -static bool get_intersect_between_arrays(String *str, json_engine_t *value, - HASH items) +bool Item_func_json_array_intersect:: + get_intersect_between_arrays(String *str, json_engine_t *value, + HASH *items, HASH *seen) { bool res= true, has_value= false; int level= value->stack_p; - String temp_str(0); + temp_str.length(0); temp_str.append('['); + while (json_scan_next(value) == 0 && value->stack_p >= level) { const uchar *value_start= NULL; @@ -5373,14 +5380,14 @@ static bool get_intersect_between_arrays(String *str, json_engine_t *value, of times the value appears in the hash table. */ uchar * found= NULL; - if ((found= my_hash_search(&items, + if ((found= my_hash_search(items, (const uchar *) new_entry, strlen(new_entry)))) { has_value= true; temp_str.append( (const char*) value_start, value_len); temp_str.append(','); - if (my_hash_delete(&items, found)) + if (my_hash_delete(items, found) || my_hash_insert(seen, (const uchar *)found)) { free(new_entry); goto error; @@ -5399,6 +5406,8 @@ static bool get_intersect_between_arrays(String *str, json_engine_t *value, } error: + my_hash_iterate(seen, restore_entry, items); + my_hash_reset(seen); return res; } @@ -5417,12 +5426,14 @@ String* Item_func_json_array_intersect::val_str(String *str) { if (args[0]->null_value) goto null_return; - if (hash_inited) + if (item_hash_inited) my_hash_free(&items); + if (seen_hash_inited) + my_hash_free(&seen); if (root_inited) free_root(&hash_root, MYF(0)); root_inited= false; - hash_inited= false; + item_hash_inited= false; prepare_json_and_create_hash(&je1, js1); } @@ -5438,7 +5449,7 @@ String* Item_func_json_array_intersect::val_str(String *str) if (json_read_value(&je2) || je2.value_type != JSON_VALUE_ARRAY) goto error_return; - if (get_intersect_between_arrays(str, &je2, items)) + if (get_intersect_between_arrays(str, &je2, &items, &seen)) goto error_return; if (str->length()) @@ -5465,7 +5476,7 @@ null_return: return NULL; } -void Item_func_json_array_intersect::prepare_json_and_create_hash(json_engine_t *je1, String *js) +bool Item_func_json_array_intersect::prepare_json_and_create_hash(json_engine_t *je1, String *js) { json_scan_start(je1, js->charset(), (const uchar *) js->ptr(), (const uchar *) js->ptr() + js->length()); @@ -5473,12 +5484,17 @@ void Item_func_json_array_intersect::prepare_json_and_create_hash(json_engine_t Scan value uses the hash table to get the intersection of two arrays. */ + if (my_hash_init(PSI_INSTRUMENT_ME, &seen, je1->s.cs, 0, 0, 0, + get_key_name, NULL, 0)) + return true; + seen_hash_inited= true; + if (!root_inited) init_alloc_root(PSI_NOT_INSTRUMENTED, &hash_root, 1024, 0, MYF(0)); root_inited= true; if (json_read_value(je1) || je1->value_type != JSON_VALUE_ARRAY || - create_hash(je1, &items, hash_inited, &hash_root)) + create_hash(je1, &items, item_hash_inited, &hash_root)) { if (je1->s.error) report_json_error(js, je1, 0); @@ -5487,6 +5503,8 @@ void Item_func_json_array_intersect::prepare_json_and_create_hash(json_engine_t max_length= (args[0]->max_length < args[1]->max_length) ? args[0]->max_length : args[1]->max_length; + + return false; } bool Item_func_json_array_intersect::fix_length_and_dec(THD *thd) @@ -5509,8 +5527,10 @@ bool Item_func_json_array_intersect::fix_length_and_dec(THD *thd) js1= args[0]->val_json(&tmp_js1); - if (js1) - prepare_json_and_create_hash(&je1, js1); + if (js1 && prepare_json_and_create_hash(&je1, js1)) + { + return TRUE; + } end: set_maybe_null(); diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h index 14080b2b242..3d48cf95dd7 100644 --- a/sql/item_jsonfunc.h +++ b/sql/item_jsonfunc.h @@ -881,14 +881,15 @@ public: class Item_func_json_array_intersect: public Item_str_func { protected: - String tmp_js1, tmp_js2; - bool hash_inited, root_inited; - HASH items; + String tmp_js1, tmp_js2, temp_str; + bool item_hash_inited, seen_hash_inited, root_inited; + HASH items, seen; MEM_ROOT hash_root; bool parse_for_each_row; public: Item_func_json_array_intersect(THD *thd, Item *a, Item *b): - Item_str_func(thd, a, b) { hash_inited= root_inited= parse_for_each_row= false; } + Item_str_func(thd, a, b) + { item_hash_inited= seen_hash_inited= root_inited= parse_for_each_row= false; } String *val_str(String *) override; bool fix_length_and_dec(THD *thd) override; LEX_CSTRING func_name_cstring() const override @@ -901,12 +902,16 @@ public: void cleanup() override { Item_str_func::cleanup(); - if (hash_inited) + if (item_hash_inited) my_hash_free(&items); + if (seen_hash_inited) + my_hash_free(&seen); if (root_inited) free_root(&hash_root, MYF(0)); } - void prepare_json_and_create_hash(json_engine_t *je1, String *js); + bool prepare_json_and_create_hash(json_engine_t *je1, String *js); + bool get_intersect_between_arrays(String *str, json_engine_t *value, + HASH *items, HASH *seen); }; class Item_func_json_object_filter_keys: public Item_str_func From 6bc959432cead236213389e2530952feb8bd0b8b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 14 Oct 2025 14:47:27 +0200 Subject: [PATCH 16/69] bump wsrep_provider maturity to stable --- sql/wsrep_plugin.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/wsrep_plugin.cc b/sql/wsrep_plugin.cc index 644dc921f70..b6446afe4aa 100644 --- a/sql/wsrep_plugin.cc +++ b/sql/wsrep_plugin.cc @@ -322,8 +322,8 @@ maria_declare_plugin(wsrep_provider) NULL, /* Status variables */ /* System variables, this will be assigned by wsrep plugin below. */ NULL, - "1.0", /* Version (string) */ - MariaDB_PLUGIN_MATURITY_ALPHA /* Maturity */ + "1.0.1", /* Version (string) */ + MariaDB_PLUGIN_MATURITY_STABLE /* Maturity */ } maria_declare_plugin_end; From 5738edf406b1d14bf7a699a0f9b5da03305f8ad1 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 8 Oct 2025 00:06:07 +0200 Subject: [PATCH 17/69] MDEV-37653 Unexpected result of prepared statement when use boolean value as parameters IS TRUE and IS FALSE are only null-rejecting on the top level, consider, e.g. NOT (X IS TRUE) --- mysql-test/main/join_outer.result | 15 +++++++++++++++ mysql-test/main/join_outer.test | 13 +++++++++++++ mysql-test/main/join_outer_jcl6.result | 15 +++++++++++++++ sql/item_cmpfunc.h | 2 ++ 4 files changed, 45 insertions(+) diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result index c673f31a083..20ad7bfa115 100644 --- a/mysql-test/main/join_outer.result +++ b/mysql-test/main/join_outer.result @@ -2911,4 +2911,19 @@ Z 1 Y 1 X 1 drop view v0, v1, v2, v3; drop table t1, t2, t3; # end of 10.3 tests +# +# MDEV-37653 Unexpected result of prepared statement when use boolean value as parameters +# +create table t0(c0 real); +create table t1 like t0; +insert into t1 values (1); +insert into t0 values (1); +select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is true); +c0 c0 +1 NULL +select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is false); +c0 c0 +1 NULL +drop table t0, t1; +# end of 10.11 tests SET optimizer_switch=@org_optimizer_switch; diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test index d370a11967e..a579860561b 100644 --- a/mysql-test/main/join_outer.test +++ b/mysql-test/main/join_outer.test @@ -2434,4 +2434,17 @@ drop table t1, t2, t3; --echo # end of 10.3 tests +--echo # +--echo # MDEV-37653 Unexpected result of prepared statement when use boolean value as parameters +--echo # +create table t0(c0 real); +create table t1 like t0; +insert into t1 values (1); +insert into t0 values (1); +select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is true); +select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is false); +drop table t0, t1; + +--echo # end of 10.11 tests + SET optimizer_switch=@org_optimizer_switch; diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result index 270d9a5f104..7a2cab440fc 100644 --- a/mysql-test/main/join_outer_jcl6.result +++ b/mysql-test/main/join_outer_jcl6.result @@ -2918,4 +2918,19 @@ Z 1 Y 1 X 1 drop view v0, v1, v2, v3; drop table t1, t2, t3; # end of 10.3 tests +# +# MDEV-37653 Unexpected result of prepared statement when use boolean value as parameters +# +create table t0(c0 real); +create table t1 like t0; +insert into t1 values (1); +insert into t0 values (1); +select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is true); +c0 c0 +1 NULL +select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is false); +c0 c0 +1 NULL +drop table t0, t1; +# end of 10.11 tests SET optimizer_switch=@org_optimizer_switch; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 5e120a7e666..5253d9c296d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -266,6 +266,8 @@ public: bool fix_length_and_dec(THD *thd) override; void print(String *str, enum_query_type query_type) override; enum precedence precedence() const override { return CMP_PRECEDENCE; } + table_map not_null_tables() const override + { return is_top_level_item() ? not_null_tables_cache : 0; } protected: Item_func_truth(THD *thd, Item *a, bool a_value, bool a_affirmative): From addb01fb60d441bbf01b86bf94f7f8375cf745e3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 13 Oct 2025 14:12:06 +0200 Subject: [PATCH 18/69] MDEV-37740 LOCATE(X,Y,NULL) is not NULL LOCATE is documented to return NULL if any of its arguments is NULL --- mysql-test/main/func_str.result | 6 +++++- mysql-test/main/func_str.test | 5 ++++- sql/item_func.cc | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index fd2cfcc0fb9..7e7e64d9413 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -5623,5 +5623,9 @@ DROP TABLE t2; DROP TABLE t1; SET sql_mode=DEFAULT; # -# End of 10.11 tests +# MDEV-37740 LOCATE(X,Y,NULL) is not NULL # +select locate(1,2,NULL); +locate(1,2,NULL) +NULL +# End of 10.11 tests diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 801a6d9505a..0c331d955c9 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -2573,5 +2573,8 @@ DROP TABLE t1; SET sql_mode=DEFAULT; --echo # ---echo # End of 10.11 tests +--echo # MDEV-37740 LOCATE(X,Y,NULL) is not NULL --echo # +select locate(1,2,NULL); + +--echo # End of 10.11 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 9e25f6e2dea..19cd1e38730 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3247,7 +3247,10 @@ longlong Item_func_locate::val_int() start0= start= args[2]->val_int(); if ((start <= 0) || (start > a->length())) + { + null_value= args[2]->is_null(); return 0; + } start0--; start--; /* start is now sufficiently valid to pass to charpos function */ From 2f5bad2f2bbe1c43bf796edb67b93fc64d3c3157 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 14 Oct 2025 13:28:04 +0200 Subject: [PATCH 19/69] bump inet4 maturity to stable --- .../type_inet/mysql-test/type_inet/type_inet4_plugin.result | 4 ++-- plugin/type_inet/plugin.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet4_plugin.result b/plugin/type_inet/mysql-test/type_inet/type_inet4_plugin.result index 291d4c2d05b..d494502123e 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet4_plugin.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet4_plugin.result @@ -24,8 +24,8 @@ PLUGIN_TYPE DATA TYPE PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Data type INET4 PLUGIN_LICENSE GPL -PLUGIN_MATURITY Gamma -PLUGIN_AUTH_VERSION 1.0 +PLUGIN_MATURITY Stable +PLUGIN_AUTH_VERSION 1.0.1 # # End of 10.10 tests # diff --git a/plugin/type_inet/plugin.cc b/plugin/type_inet/plugin.cc index 38dad45a4f5..c530a7c2448 100644 --- a/plugin/type_inet/plugin.cc +++ b/plugin/type_inet/plugin.cc @@ -188,8 +188,8 @@ maria_declare_plugin(type_inet) 0x0100, // Numeric version 0xAABB means AA.BB version NULL, // Status variables NULL, // System variables - "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_GAMMA // Maturity(see include/mysql/plugin.h)*/ + "1.0.1", // String version representation + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h) From 2a722fcfc941200a3ed5aec2c414fbbaf34df1ca Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 14 Oct 2025 17:14:10 +0200 Subject: [PATCH 20/69] MDEV-37554 MariaDB auth protocol differs from MySQL fix auth protocol to match MySQL changes --- sql/sql_acl.cc | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index fd53c0f014e..b58312faa0e 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -14268,22 +14268,9 @@ static int server_mpvio_write_packet(MYSQL_PLUGIN_VIO *param, res= send_server_handshake_packet(mpvio, (char*) packet, packet_len); else if (mpvio->status == MPVIO_EXT::RESTART) res= send_plugin_request_packet(mpvio, packet, packet_len); - else if (packet_len > 0 && (*packet < 2 || *packet > 253)) - { - /* - we cannot allow plugin data packet to start from 0, 255 or 254 - - as the client will treat it as an OK, ERROR or "change plugin" packet. - We'll escape these bytes with \1. Consequently, we - have to escape \1 byte too. - */ + else /* plugin data, prefixed with 1 */ res= net_write_command(&mpvio->auth_info.thd->net, 1, (uchar*)"", 0, packet, packet_len); - } - else - { - res= my_net_write(&mpvio->auth_info.thd->net, packet, packet_len) || - net_flush(&mpvio->auth_info.thd->net); - } mpvio->status= MPVIO_EXT::FAILURE; // the status is no longer RESTART mpvio->packets_written++; DBUG_RETURN(res); From 9838d7e1127327c5b4bc48fd959c30318ad30677 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 5 Nov 2024 12:44:58 +0000 Subject: [PATCH 21/69] MDEV-36009: Systemd: Restart on OOM Per https://github.com/systemd/systemd/issues/36529 OOM counts as a on-abnormal condition. To ensure that MariaDB testart on OOM the Restart is changes to on-abnormal which an extension on the current on-abort condition. --- support-files/mariadb.service.in | 2 +- support-files/mariadb@.service.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index 2d4186b50b2..547fc1732fa 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -103,7 +103,7 @@ SendSIGKILL=no # Restart crashed server only, on-failure would also restart, for example, when # my.cnf contains unknown option -Restart=on-abort +Restart=on-abnormal RestartSec=5s UMask=007 diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 7f1365a3b20..40d87817c10 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -217,7 +217,7 @@ SendSIGKILL=no # Restart crashed server only, on-failure would also restart, for example, when # my.cnf contains unknown option -Restart=on-abort +Restart=on-abnormal RestartSec=5s UMask=007 From 8258b2fd56e6c7fad64d3877ca01049778f1a541 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 9 Oct 2025 17:02:37 +1100 Subject: [PATCH 22/69] MDEV-37829 Call spider_internal_xa_prepare when XA COMMIT ... ONE PHASE This allows 1PC XA involving spider tables. --- .../spider/bugfix/r/mdev_37829.result | 76 ++++++++++++++ .../mysql-test/spider/bugfix/r/xa_cmd.result | 73 ++++++++++++++ .../spider/bugfix/t/mdev_37829.test | 99 +++++++++++++++++++ .../mysql-test/spider/bugfix/t/xa_cmd.test | 52 ++++++++++ storage/spider/spd_trx.cc | 10 +- 5 files changed, 302 insertions(+), 8 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_37829.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_37829.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_37829.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_37829.result new file mode 100644 index 00000000000..84394d68519 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_37829.result @@ -0,0 +1,76 @@ +# +# MDEV-37829 XA COMMIT ONE PHASE fails with "This xid does not +# exist" if a trigger references a SPIDER table +# +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t ( +id INT auto_increment NOT NULL, +name varchar(100) NULL, +CONSTRAINT test_pk PRIMARY KEY (id) +) ENGINE=InnoDB; +Warnings: +Warning 1280 Name 'test_pk' ignored for PRIMARY key. +INSERT INTO t(id, name) VALUES(1,'test1'); +CREATE TABLE t2 ( +id INT auto_increment NOT NULL, +name varchar(100) NULL, +CONSTRAINT test2_pk PRIMARY KEY (id) +) ENGINE=InnoDB; +Warnings: +Warning 1280 Name 'test2_pk' ignored for PRIMARY key. +CREATE TABLE t3 ( +id INT auto_increment NOT NULL, +name varchar(100) NULL, +CONSTRAINT test3_pk PRIMARY KEY (id) +) ENGINE=SPIDER COMMENT='wrapper "mysql", srv "srv", table "t2"'; +Warnings: +Warning 1280 Name 'test3_pk' ignored for PRIMARY key. +CREATE PROCEDURE tProc() +BEGIN +# This conditional logic is intentionally FALSE. +# The SELECT on the SPIDER table will never run. +SET @t := FALSE; +IF @t = TRUE THEN +SELECT name INTO @b FROM t3 WHERE id = 1; +END IF; +END$$ +CREATE TRIGGER t_au +AFTER UPDATE +ON t FOR EACH ROW +BEGIN +# This condition will also be false in our test case. +IF NEW.name = '3' THEN +CALL tProc(); +END IF; +END$$ +SELECT "Using 2PC..."; +Using 2PC... +Using 2PC... +XA START 'TESTTRX_2P'; +UPDATE t SET name = 'abc' WHERE ID = 1; +SHOW WARNINGS; +Level Code Message +XA END 'TESTTRX_2P'; +XA PREPARE 'TESTTRX_2P'; +XA COMMIT 'TESTTRX_2P'; +SELECT "Using 1PC..."; +Using 1PC... +Using 1PC... +XA START 'TESTTRX_1P'; +UPDATE t SET name = 'abc' WHERE ID = 1; +SHOW WARNINGS; +Level Code Message +XA END 'TESTTRX_1P'; +XA COMMIT 'TESTTRX_1P' ONE PHASE; +drop trigger t_au; +drop procedure tProc; +drop table t, t2, t3; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result b/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result index 8e1b2994c66..5a560ce25d1 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result +++ b/storage/spider/mysql-test/spider/bugfix/r/xa_cmd.result @@ -34,10 +34,79 @@ INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); XA END 'test'; XA PREPARE 'test'; XA COMMIT 'test'; +# MDEV-37829 XA COMMIT ONE PHASE fails with "This xid does not +# exist" if a trigger references a SPIDER table +# +# Below we test a version of the MDEV-37829 case that is not a +# no-op on the spider table +XA START 'test1'; +INSERT INTO tbl_a (pkey) VALUES (100); +XA END 'test1'; +XA COMMIT 'test1' ONE PHASE; +select * from tbl_a; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +100 +create table t (c int); +insert into t values (1),(2); +CREATE PROCEDURE tProc() +BEGIN +SET @t := TRUE; +IF @t = TRUE THEN +INSERT INTO tbl_a select max(pkey) + 1 from tbl_a; +END IF; +END$$ +CREATE TRIGGER t_au +AFTER UPDATE +ON t FOR EACH ROW +BEGIN +IF NEW.c < 50 THEN +CALL tProc(); +END IF; +END$$ +XA START 'test'; +update t set c = c + 1 where c = 1; +XA END 'test'; +XA PREPARE 'test'; +XA COMMIT 'test'; +XA START 'test1'; +update t set c = c + 1 where c = 2; +XA END 'test1'; +XA COMMIT 'test1' ONE PHASE; +drop table t; +select * from tbl_a; +pkey +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +100 +101 +102 +103 connection child2_1; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; argument insert into `auto_test_remote`.`tbl_a`(`pkey`)values(0),(1),(2),(3),(4),(5),(6),(7),(8),(9) +insert into `auto_test_remote`.`tbl_a`(`pkey`)values(100) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`)values(101) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`)values(102) +insert high_priority into `auto_test_remote`.`tbl_a`(`pkey`)values(103) SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %' SELECT pkey FROM tbl_a ORDER BY pkey; pkey @@ -51,6 +120,10 @@ pkey 7 8 9 +100 +101 +102 +103 deinit connection master_1; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_37829.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_37829.test new file mode 100644 index 00000000000..828fc6a39ca --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_37829.test @@ -0,0 +1,99 @@ +--echo # +--echo # MDEV-37829 XA COMMIT ONE PHASE fails with "This xid does not +--echo # exist" if a trigger references a SPIDER table +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--source include/have_innodb.inc +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +# See also spider/bugfix.xa_cmd for a case that is not a no-op on +# the spider table + +# 1. SETUP: Create local InnoDB tables and one remote SPIDER table + +# Local table to be updated +CREATE TABLE t ( + id INT auto_increment NOT NULL, + name varchar(100) NULL, + CONSTRAINT test_pk PRIMARY KEY (id) +) ENGINE=InnoDB; + +INSERT INTO t(id, name) VALUES(1,'test1'); + +# Remote table target +CREATE TABLE t2 ( + id INT auto_increment NOT NULL, + name varchar(100) NULL, + CONSTRAINT test2_pk PRIMARY KEY (id) +) ENGINE=InnoDB; + +# SPIDER table pointing to the remote target +CREATE TABLE t3 ( + id INT auto_increment NOT NULL, + name varchar(100) NULL, + CONSTRAINT test3_pk PRIMARY KEY (id) +) ENGINE=SPIDER COMMENT='wrapper "mysql", srv "srv", table "t2"'; + + +# 2. SETUP: Create a procedure and trigger that reference the SPIDER table + +DELIMITER $$; + +CREATE PROCEDURE tProc() +BEGIN + # This conditional logic is intentionally FALSE. + # The SELECT on the SPIDER table will never run. + SET @t := FALSE; + IF @t = TRUE THEN + SELECT name INTO @b FROM t3 WHERE id = 1; + END IF; +END$$ + +CREATE TRIGGER t_au +AFTER UPDATE +ON t FOR EACH ROW +BEGIN + # This condition will also be false in our test case. + IF NEW.name = '3' THEN + CALL tProc(); + END IF; +END$$ + +DELIMITER ;$$ + + +# 3. TEST CASE 1: Two-phase commit +SELECT "Using 2PC..."; +XA START 'TESTTRX_2P'; +UPDATE t SET name = 'abc' WHERE ID = 1; +SHOW WARNINGS; +XA END 'TESTTRX_2P'; +XA PREPARE 'TESTTRX_2P'; +XA COMMIT 'TESTTRX_2P'; + +# 4. TEST CASE 2: One-phase commit + +SELECT "Using 1PC..."; +XA START 'TESTTRX_1P'; +UPDATE t SET name = 'abc' WHERE ID = 1; +SHOW WARNINGS; +XA END 'TESTTRX_1P'; +XA COMMIT 'TESTTRX_1P' ONE PHASE; + +drop trigger t_au; +drop procedure tProc; +drop table t, t2, t3; + +drop server srv; +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test index 690fe3e5b50..5a44ab5e01b 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test +++ b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test @@ -48,6 +48,58 @@ XA END 'test'; XA PREPARE 'test'; XA COMMIT 'test'; +--echo # MDEV-37829 XA COMMIT ONE PHASE fails with "This xid does not +--echo # exist" if a trigger references a SPIDER table +--echo # +--echo # Below we test a version of the MDEV-37829 case that is not a +--echo # no-op on the spider table + +XA START 'test1'; +INSERT INTO tbl_a (pkey) VALUES (100); +XA END 'test1'; +XA COMMIT 'test1' ONE PHASE; + +select * from tbl_a; + +create table t (c int); +insert into t values (1),(2); + +DELIMITER $$; + +CREATE PROCEDURE tProc() +BEGIN + SET @t := TRUE; + IF @t = TRUE THEN + INSERT INTO tbl_a select max(pkey) + 1 from tbl_a; + END IF; +END$$ + +CREATE TRIGGER t_au +AFTER UPDATE +ON t FOR EACH ROW +BEGIN + IF NEW.c < 50 THEN + CALL tProc(); + END IF; +END$$ + +DELIMITER ;$$ + +XA START 'test'; +update t set c = c + 1 where c = 1; +XA END 'test'; +XA PREPARE 'test'; +XA COMMIT 'test'; + +XA START 'test1'; +update t set c = c + 1 where c = 2; +XA END 'test1'; +XA COMMIT 'test1' ONE PHASE; + +drop table t; + +select * from tbl_a; + --connection child2_1 --disable_view_protocol --disable_ps2_protocol diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 42d45bc8c3e..9956f016673 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -2962,21 +2962,15 @@ int spider_commit( { if (trx->trx_xa) { - if (trx->internal_xa && !trx->trx_xa_prepared) + if ((trx->internal_xa || thd->lex->xa_opt == XA_ONE_PHASE) && + !trx->trx_xa_prepared) { if ( (error_num = spider_internal_xa_prepare( thd, trx, table_xa, table_xa_member, TRUE)) ) { -/* - if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) - { -*/ /* rollback for semi_trx */ spider_rollback(hton, thd, all); -/* - } -*/ DBUG_RETURN(error_num); } trx->trx_xa_prepared = TRUE; From 7905ea94a055b9893b604099518dffdd555acba1 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 15 Oct 2025 11:13:31 +1100 Subject: [PATCH 23/69] MDEV-37193 Clean up spider tests Clean up spider tests by removing excessive $VARIABLE abstractions. Indentations are preserved to minimise diff. After this change only one disabled test remains with the following regexp: $ (cd ../src && git grep -l "eval .*\$\(MASTER\|CHILD\|SLAVE\)[A-Z0-9_]*_\(COMMENT\|TABLES\)") | grep spider.*\.test$ storage/spider/mysql-test/spider/bugfix/t/wait_timeout.test The patch is created with the following steps: Step 1. hack mysqltest.cc to log statements modified client/mysqltest.cc @@ -1745,17 +1745,23 @@ void verbose_msg(const char *fmt, ...) DBUG_ENTER("verbose_msg"); DBUG_PRINT("enter", ("format: %s", fmt)); - if (!verbose) - DBUG_VOID_RETURN; + /* + if (!verbose) + DBUG_VOID_RETURN; + */ fflush(stdout); va_start(args, fmt); - fprintf(stderr, "mysqltest: "); + /* + fprintf(stderr, "mysqltest: "); + */ if (cur_file && cur_file != file_stack) fprintf(stderr, "In included file \"%s\": ", cur_file->file_name); - if (start_lineno != 0) - fprintf(stderr, "At line %u: ", start_lineno); + /* + if (start_lineno != 0) + fprintf(stderr, "At line %u: ", start_lineno); + */ vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); va_end(args); @@ -10412,6 +10418,22 @@ int main(int argc, char **argv) if (ok_to_do) { + /* only log current file / do not log included files */ + if (!cur_file || cur_file == file_stack) + { + if (command->type == Q_EMPTY_LINE) + verbose_msg("%s", ""); + /* ignore if; eval will be handled after var subst */ + else if (command->type != Q_IF && command->type != Q_END_BLOCK && + command->type != Q_EVAL) + /* + read_command_buf instead of command->query because only + the former retains leading "--" + */ + verbose_msg("%s%s", read_command_buf, + strncmp("--", read_command_buf, 2) && + strncmp("#", read_command_buf, 1) ? ";" : ""); + } command->last_argument= command->first_argument; processed = 1; /* Need to remember this for handle_error() */ @@ -10595,6 +10617,14 @@ int main(int argc, char **argv) /* Restore settings */ display_result_vertically= old_display_result_vertically; + /* only log current file / do not log included files */ + if (!cur_file || cur_file == file_stack) + { + /* print evaled query */ + if (command->type == Q_EVAL) + verbose_msg("%s;", command->eval_query.str); + } + break; } case Q_SEND: Statements are printed in mysql-test/var/log/mysqltest.log between two lines: "Start processing test commands from '$test_file_name' ..." and "... Done processing test commands." Step 2. Overwrite the test files with logged statements and run the tests again to check they pass (not all pass, see below) (cd ../src && git grep -l "eval \$CHILD") | grep \.test$ | sed "s/^.*spider\//spider\//g" | sed "s/\/t\//./g" | sed "s/\.test$//g" | xargs -i sh -c './mysql-test/mtr {} && emacs --batch --load /home/ycp/source/mariadb-tools/mdev-37193.el --eval "(my-mdev-37193)" && ./mysql-test/mtr {}' where my-mdev-37193 is as follows: (defun my-mdev-37193 () (let ((log-file (file-name-concat default-directory "mysql-test/var/log/mysqltest.log")) test-file-name beg end) (if (file-exists-p log-file) (with-temp-buffer (insert-file-contents log-file) (goto-char (point-min)) (re-search-forward "^Start processing test commands from '\\(.*\\)' ...$") (setq test-file-name (match-string 1)) (beginning-of-line 2) (setq beg (point)) (re-search-forward "^... Done processing test commands.$") (beginning-of-line 1) (setq end (point)) (write-region beg end test-file-name) (message "Wrote %s." test-file-name)) (message "Log file does not exist (test disabled?): %s" log-file)))) In my run, out of the 79 cleaned tests, about 8 failed: 21606:spider/bg.spider_fixes [ fail ] 22463:spider/bugfix.mdev_20100 [ fail ] 22734:spider/bugfix.mdev_21884 [ fail ] 23876:spider/regression/e1121.direct_join_by_pkey_key [ fail ] 24077:spider/regression/e1121.direct_join_by_pkey_pkey [ fail ] 25653:spider.partition_mrr [ fail ] 26388:spider.spider_fixes [ fail ] 26970:spider.udf_pushdown [ fail ] Step 3. Remove all blank line removals in the diff The diff could contain removal of blank lines which could affect readability of tests arranged in logical blocks. this can be fixed with the following: git diff > backup.diff git diff --ignore-blank-lines -U1 > changes.diff git reset --hard git apply -- changes.diff Step 4. Manually Fix up the 8 failing tests above, which was relatively straightforward. Step 5. Fix sockets. Sockets need to be changed back to vars because their paths depends on those of the vardir. Do this (cd ../src && git grep -l "mysql-test/var/tmp/.*\\.sock") | grep \.test$ | xargs -i sh -c 'emacs --batch --load /home/ycp/source/mariadb-tools/mdev-37193.el --eval "(my-mdev-37193-fix-sockets \"../src/{}\")"' where my-mdev-37193-fix-sockets is defined as follows: (defun my-mdev-37193--translate-sock (m n) (pcase m ("1" "$MASTER_1_MYSOCK") ("2" (format "$CHILD2_%s_MYSOCK" n)) ("3" (format "$CHILD3_%s_MYSOCK" n)) ("4" (format "$SLAVE1_%s_MYSOCK" n)))) (defun my-mdev-37193--fix-sockets () "Fix sockets in the current buffer" (goto-char (point-min)) (while (re-search-forward "socket \".*mysqld\\.\\(.\\)\\.\\(.\\)\\.sock\"" nil t) (replace-match (format "socket \"%s\"" (my-mdev-37193--translate-sock (match-string 1) (match-string 2)))) (re-search-backward ";$") (beginning-of-line 2) (insert "eval\n"))) (defun my-mdev-37193-fix-sockets (file) "Fix sockets in FILE" (with-temp-buffer (insert-file-contents file) (my-mdev-37193--fix-sockets) (write-file file))) Subsequent small fixup of spider.ha and spider/bugfix.ha are needed because they involve strings of two sockets instead of one. Step 6. Clean up the "main" inc files by removing the obsolete vars. This can be done manually with the help of grep as there are not many such files. Note that there are still about 100 remaining .inc files matching relevant regexp (using the command below), but they are all "specialised", i.e. $VARs used in foo.test are declared in foo.inc, instead of some generic files several --source's away. So the readability is not as bad, and they are minor nuisances that can be easily fixed on demand and on-the-fly when needed. $ (cd ../src && git grep -l "let \$\(MASTER\|CHILD\|SLAVE\)[A-Z0-9_]*_\(COMMENT\|TABLES\)") | grep spider.*\.inc | sed "s/^/..\/src\//" | wc -l 99 Step 7. Further clean up white spaces to reduce diff and ease merging: git checkout -b tmp git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero - git checkout . git commit --- .../spider/bg/include/deinit_child2_1.inc | 0 .../spider/bg/include/deinit_child2_2.inc | 0 .../spider/bg/include/deinit_child2_3.inc | 0 .../spider/bg/include/deinit_child3_1.inc | 0 .../spider/bg/include/deinit_child3_2.inc | 0 .../spider/bg/include/deinit_child3_3.inc | 0 .../spider/bg/include/deinit_slave1_1.inc | 0 .../spider/bg/include/ha_deinit_child2_1.inc | 0 .../spider/bg/include/ha_deinit_child2_2.inc | 0 .../spider/bg/include/ha_deinit_child2_3.inc | 0 .../spider/bg/include/ha_deinit_master_1.inc | 0 .../spider/bg/include/ha_init_child2_1.inc | 8 - .../spider/bg/include/ha_init_child2_2.inc | 4 - .../spider/bg/include/ha_init_child2_3.inc | 4 - .../spider/bg/include/ha_init_child3_1.inc | 127 -- .../spider/bg/include/ha_init_child3_2.inc | 127 -- .../spider/bg/include/ha_init_child3_3.inc | 127 -- .../spider/bg/include/ha_init_master_1.inc | 95 -- .../spider/bg/include/init_child2_1.inc | 175 -- .../spider/bg/include/init_child2_2.inc | 80 - .../spider/bg/include/init_child2_3.inc | 11 - .../spider/bg/include/init_child3_1.inc | 0 .../spider/bg/include/init_child3_2.inc | 0 .../spider/bg/include/init_child3_3.inc | 0 .../spider/bg/include/init_master_1.inc | 183 -- .../spider/bg/include/init_slave1_1.inc | 10 - storage/spider/mysql-test/spider/bg/my.cnf | 29 - .../mysql-test/spider/bg/t/basic_sql.test | 1496 +---------------- .../spider/bg/t/basic_sql_part.test | 345 +--- .../spider/bg/t/direct_aggregate.test | 92 +- .../spider/bg/t/direct_aggregate_part.test | 127 +- .../mysql-test/spider/bg/t/direct_update.test | 96 +- .../spider/bg/t/direct_update_part.test | 126 +- .../mysql-test/spider/bg/t/function.test | 119 +- storage/spider/mysql-test/spider/bg/t/ha.test | 727 +++----- .../mysql-test/spider/bg/t/ha_part.test | 923 ++++------ .../mysql-test/spider/bg/t/ha_test_deinit.inc | 8 - .../mysql-test/spider/bg/t/ha_test_init.inc | 6 - .../spider/bg/t/slave_test_deinit.inc | 1 - .../spider/bg/t/slave_test_init.inc | 1 - .../mysql-test/spider/bg/t/spider3_fixes.test | 135 +- .../spider/bg/t/spider3_fixes_part.test | 218 +-- .../mysql-test/spider/bg/t/spider_fixes.test | 805 ++------- .../spider/bg/t/spider_fixes_part.test | 444 ++--- .../mysql-test/spider/bg/t/vp_fixes.test | 192 +-- .../mysql-test/spider/bugfix/my_1_1.cnf | 9 - .../mysql-test/spider/bugfix/my_2_1.cnf | 20 - .../mysql-test/spider/bugfix/my_2_2.cnf | 5 - .../t/checksum_table_with_quick_mode_3.test | 13 +- .../spider/bugfix/t/cp932_column.test | 15 +- .../bugfix/t/group_by_order_by_limit.test | 30 +- .../spider/bugfix/t/insert_select.test | 26 +- .../spider/bugfix/t/mdev_19866.test | 28 +- .../spider/bugfix/t/mdev_20100.test | 34 +- .../spider/bugfix/t/mdev_20502.test | 14 +- .../spider/bugfix/t/mdev_21884.test | 32 +- .../spider/bugfix/t/mdev_22246.test | 24 +- .../spider/bugfix/t/mdev_24020.test | 24 +- .../spider/bugfix/t/mdev_24517.test | 24 +- .../spider/bugfix/t/mdev_24523.test | 24 +- .../spider/bugfix/t/quick_mode_0.test | 46 +- .../spider/bugfix/t/quick_mode_1.test | 46 +- .../spider/bugfix/t/quick_mode_2.test | 46 +- .../spider/bugfix/t/quick_mode_3.test | 46 +- .../bugfix/t/return_found_rows_insert.test | 23 +- .../bugfix/t/return_found_rows_update.test | 15 +- .../spider/bugfix/t/select_by_null.test | 13 +- .../bugfix/t/select_with_backquote.test | 14 +- .../spider/bugfix/t/slave_trx_isolation.test | 17 +- .../spider/bugfix/t/strict_group_by.test | 30 +- .../spider/bugfix/t/wrapper_mariadb.test | 13 +- .../mysql-test/spider/bugfix/t/xa_cmd.test | 13 +- .../mysql-test/spider/feature/my_1_1.cnf | 9 - .../mysql-test/spider/feature/my_2_1.cnf | 20 - .../mysql-test/spider/feature/my_2_2.cnf | 5 - .../spider/include/deinit_slave1_1.inc | 0 .../spider/include/ha_deinit_child2_1.inc | 0 .../spider/include/ha_deinit_child2_2.inc | 0 .../spider/include/ha_deinit_child2_3.inc | 0 .../spider/include/ha_deinit_master_1.inc | 0 .../spider/include/ha_init_child2_1.inc | 8 - .../spider/include/ha_init_child2_2.inc | 4 - .../spider/include/ha_init_child2_3.inc | 4 - .../spider/include/ha_init_child3_1.inc | 127 -- .../spider/include/ha_init_child3_2.inc | 127 -- .../spider/include/ha_init_child3_3.inc | 127 -- .../spider/include/ha_init_master_1.inc | 95 -- .../spider/include/init_child2_1.inc | 189 --- .../spider/include/init_child2_2.inc | 80 - .../spider/include/init_child2_3.inc | 11 - .../spider/include/init_master_1.inc | 192 --- .../spider/include/init_slave1_1.inc | 10 - storage/spider/mysql-test/spider/my_1_1.cnf | 9 - storage/spider/mysql-test/spider/my_2_1.cnf | 20 - storage/spider/mysql-test/spider/my_2_2.cnf | 5 - .../spider/regression/e1121/my_1_1.cnf | 9 - .../spider/regression/e1121/my_2_1.cnf | 20 - .../e1121/t/direct_join_by_pkey_key.test | 27 +- .../e1121/t/direct_join_by_pkey_pkey.test | 27 +- .../spider/regression/e112122/my_1_1.cnf | 9 - .../spider/regression/e112122/my_2_1.cnf | 20 - .../spider/regression/e112122/my_2_2.cnf | 5 - .../e112122/t/group_by_order_by_limit_ok.test | 30 +- .../mysql-test/spider/t/auto_increment.test | 100 +- .../spider/t/auto_increment_deinit.inc | 6 - .../spider/t/auto_increment_init.inc | 31 - .../spider/mysql-test/spider/t/basic_sql.test | 1496 +---------------- .../mysql-test/spider/t/basic_sql_part.test | 345 +--- .../t/checksum_table_with_quick_mode_3.test | 79 +- .../mysql-test/spider/t/direct_aggregate.test | 94 +- .../spider/t/direct_aggregate_part.test | 127 +- .../mysql-test/spider/t/direct_join.test | 229 +-- .../spider/t/direct_join_using.test | 134 +- .../mysql-test/spider/t/direct_left_join.test | 134 +- .../spider/t/direct_left_join_nullable.test | 146 +- .../t/direct_left_right_join_nullable.test | 146 +- .../direct_left_right_left_join_nullable.test | 146 +- .../spider/t/direct_right_join.test | 134 +- .../spider/t/direct_right_join_nullable.test | 146 +- .../t/direct_right_left_join_nullable.test | 146 +- ...direct_right_left_right_join_nullable.test | 146 +- .../mysql-test/spider/t/direct_update.test | 96 +- .../spider/t/direct_update_part.test | 126 +- .../mysql-test/spider/t/error_row_number.test | 4 + .../spider/mysql-test/spider/t/function.test | 119 +- storage/spider/mysql-test/spider/t/ha.test | 727 +++----- .../spider/mysql-test/spider/t/ha_part.test | 924 ++++------ .../mysql-test/spider/t/ha_test_deinit.inc | 7 - .../mysql-test/spider/t/ha_test_init.inc | 6 - .../spider/t/partition_cond_push.test | 146 +- .../spider/t/partition_fulltext.test | 155 +- ...on_join_pushdown_for_single_partition.test | 163 +- .../mysql-test/spider/t/partition_mrr.test | 182 +- .../spider/t/pushdown_not_like.test | 64 +- .../mysql-test/spider/t/quick_mode_0.test | 209 +-- .../mysql-test/spider/t/quick_mode_1.test | 209 +-- .../mysql-test/spider/t/quick_mode_2.test | 209 +-- .../mysql-test/spider/t/quick_mode_3.test | 209 +-- .../mysql-test/spider/t/slave_test_deinit.inc | 1 - .../mysql-test/spider/t/slave_test_init.inc | 1 - .../spider/t/slave_trx_isolation.test | 85 +- .../mysql-test/spider/t/spider3_fixes.test | 135 +- .../spider/t/spider3_fixes_part.test | 218 +-- .../mysql-test/spider/t/spider_fixes.test | 806 ++------- .../spider/t/spider_fixes_part.test | 615 ++----- .../spider/mysql-test/spider/t/timestamp.test | 356 +--- .../mysql-test/spider/t/timestamp_deinit.inc | 6 - .../mysql-test/spider/t/timestamp_init.inc | 55 - .../mysql-test/spider/t/udf_pushdown.test | 24 +- .../spider/mysql-test/spider/t/vp_fixes.test | 192 +-- 150 files changed, 3820 insertions(+), 14688 deletions(-) delete mode 100644 storage/spider/mysql-test/spider/bg/include/deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/deinit_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/deinit_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/deinit_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/deinit_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/ha_deinit_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/init_child3_1.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/init_child3_2.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/init_child3_3.inc delete mode 100644 storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/include/deinit_slave1_1.inc delete mode 100644 storage/spider/mysql-test/spider/include/ha_deinit_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/include/ha_deinit_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/include/ha_deinit_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/include/ha_deinit_master_1.inc delete mode 100644 storage/spider/mysql-test/spider/include/ha_init_child2_1.inc delete mode 100644 storage/spider/mysql-test/spider/include/ha_init_child2_2.inc delete mode 100644 storage/spider/mysql-test/spider/include/ha_init_child2_3.inc delete mode 100644 storage/spider/mysql-test/spider/include/init_slave1_1.inc diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child3_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child3_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/deinit_child3_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/bg/include/deinit_slave1_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_deinit_master_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc deleted file mode 100644 index 2684829408d..00000000000 --- a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_1.inc +++ /dev/null @@ -1,8 +0,0 @@ -let $CHILD2_1_HA_AS_DROP_TABLES= - $CHILD2_1_DROP_TABLES; -let $CHILD2_1_HA_AS_CREATE_TABLES= - $CHILD2_1_CREATE_TABLES; -let $CHILD2_1_HA_AS_DROP_TABLES2= - $CHILD2_1_DROP_TABLES2; -let $CHILD2_1_HA_AS_CREATE_TABLES2= - $CHILD2_1_CREATE_TABLES2; diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc deleted file mode 100644 index 205eaa6fe35..00000000000 --- a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_2.inc +++ /dev/null @@ -1,4 +0,0 @@ -let $CHILD2_2_HA_DROP_TABLES= - $CHILD2_2_DROP_TABLES; -let $CHILD2_2_HA_CREATE_TABLES= - $CHILD2_2_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc deleted file mode 100644 index 55cb858372c..00000000000 --- a/storage/spider/mysql-test/spider/bg/include/ha_init_child2_3.inc +++ /dev/null @@ -1,4 +0,0 @@ -let $CHILD2_3_HA_DROP_TABLES= - $CHILD2_3_DROP_TABLES; -let $CHILD2_3_HA_CREATE_TABLES= - $CHILD2_3_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc index 3ac4f97b1e0..8e8cecb0acb 100644 --- a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc +++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_1.inc @@ -11,130 +11,3 @@ eval INSERT INTO mysql.spider_link_mon_servers NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_1_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_1_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_1_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_1_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_1_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_1_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_1_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_1_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_1_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_1_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_1_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_1_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc index cf47099f439..dcf51f36ff4 100644 --- a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc +++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_2.inc @@ -11,130 +11,3 @@ eval INSERT INTO mysql.spider_link_mon_servers NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_2_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_2_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_2_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_2_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_2_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_2_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_2_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_2_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_2_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_2_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_2_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_2_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc index 094d26b62c6..7530d40e0c6 100644 --- a/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc +++ b/storage/spider/mysql-test/spider/bg/include/ha_init_child3_3.inc @@ -11,130 +11,3 @@ eval INSERT INTO mysql.spider_link_mon_servers NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_3_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_3_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_3_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_3_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_3_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_3_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_3_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_3_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_3_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_3_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_3_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_3_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/bg/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/bg/include/ha_init_master_1.inc index 78797d80ce7..46a47f916f0 100644 --- a/storage/spider/mysql-test/spider/bg/include/ha_init_master_1.inc +++ b/storage/spider/mysql-test/spider/bg/include/ha_init_master_1.inc @@ -8,98 +8,3 @@ eval INSERT INTO mysql.spider_link_mon_servers NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $MASTER_1_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $MASTER_1_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $MASTER_1_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $MASTER_1_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $MASTER_1_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; -let $MASTER_1_COPY_TABLES_2_1= - SELECT spider_copy_tables('ta_l', '0', '1'); - -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_HA_2_1= - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_HA_2_1= - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $MASTER_1_COMMENT_HA_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $MASTER_1_COMMENT_HA_AS_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $MASTER_1_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $MASTER_1_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $MASTER_1_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); -let $MASTER_1_COPY_TABLES_P_2_1= - SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); -let $MASTER_1_CHECK_HA_STATUS= - SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; -let $MASTER_1_CHANGE_HA_MON= - SELECT spider_flush_table_mon_cache(); diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc deleted file mode 100644 index 611ce6012a8..00000000000 --- a/storage/spider/mysql-test/spider/bg/include/init_child2_1.inc +++ /dev/null @@ -1,175 +0,0 @@ -let $CHILD2_1_DROP_TABLES= - DROP TABLE IF EXISTS ta_r; -let $CHILD2_1_CREATE_TABLES= - CREATE TABLE ta_r ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a), - KEY idx1(b) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; -let $CHILD2_1_DROP_TABLES2= - DROP TABLE IF EXISTS ta_r2; -let $CHILD2_1_CREATE_TABLES2= - CREATE TABLE ta_r2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES2= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; -let $CHILD2_1_DROP_TABLES3= - DROP TABLE IF EXISTS ta_r_no_idx; -let $CHILD2_1_CREATE_TABLES3= - CREATE TABLE ta_r_no_idx ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10' - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES3= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a; -let $CHILD2_1_DROP_TABLES4= - DROP TABLE IF EXISTS ta_r_auto_inc; -let $CHILD2_1_CREATE_TABLES4= - CREATE TABLE ta_r_auto_inc ( - a INT AUTO_INCREMENT, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES4= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc - ORDER BY a; -let $CHILD2_1_DROP_TABLES5= - DROP TABLE IF EXISTS ta_r_int; -let $CHILD2_1_CREATE_TABLES5= - CREATE TABLE ta_r_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES5= - SELECT a, b, c FROM ta_r_int ORDER BY a; -let $CHILD2_1_DROP_TABLES6= - DROP TABLE IF EXISTS ta_r_3; -let $CHILD2_1_CREATE_TABLES6= - CREATE TABLE ta_r_3 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10' - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES6= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a; -let $CHILD2_1_DROP_FT_TABLES= - DROP TABLE IF EXISTS ft_r; -let $CHILD2_1_CREATE_FT_TABLES= - CREATE TABLE ft_r ( - a INT DEFAULT 0, - b TEXT, - c TEXT, - d TEXT, - PRIMARY KEY(a), - FULLTEXT INDEX ft_idx1(b), - FULLTEXT INDEX ft_idx2(c) - ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET; -let $CHILD2_1_SELECT_FT_TABLES= - SELECT a, b, c, d FROM ft_r ORDER BY a; -let $CHILD2_1_DROP_FT_TABLES2= - DROP TABLE IF EXISTS ft_r2; -let $CHILD2_1_CREATE_FT_TABLES2= - CREATE TABLE ft_r2 ( - a INT DEFAULT 0, - b TEXT, - c TEXT, - d TEXT, - PRIMARY KEY(a), - FULLTEXT INDEX ft_idx1(b), - FULLTEXT INDEX ft_idx2(c) - ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET; -let $CHILD2_1_SELECT_FT_TABLES2= - SELECT a, b, c, d FROM ft_r2 ORDER BY a; -let $CHILD2_1_DROP_GM_TABLES= - DROP TABLE IF EXISTS gm_r; -let $CHILD2_1_CREATE_GM_TABLES= - CREATE TABLE gm_r ( - a INT DEFAULT 0, - b GEOMETRY NOT NULL, - c GEOMETRY NOT NULL, - PRIMARY KEY(a), - SPATIAL INDEX sp_idx1(b), - SPATIAL INDEX sp_idx2(c) - ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET; -let $CHILD2_1_SELECT_GM_TABLES= - SELECT a, b, c FROM gm_r ORDER BY a; -let $CHILD2_1_DROP_GM_TABLES2= - DROP TABLE IF EXISTS gm_r2; -let $CHILD2_1_CREATE_GM_TABLES2= - CREATE TABLE gm_r2 ( - a INT DEFAULT 0, - b GEOMETRY NOT NULL, - c GEOMETRY NOT NULL, - PRIMARY KEY(a), - SPATIAL INDEX sp_idx1(b), - SPATIAL INDEX sp_idx2(c) - ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET; -let $CHILD2_1_SELECT_GM_TABLES2= - SELECT a, b, c FROM gm_r2 ORDER BY a; -let $CHILD2_1_DROP_LOCK_TABLES1= - DROP TABLE IF EXISTS t1_1; -let $CHILD2_1_CREATE_LOCK_TABLES1= - CREATE TABLE t1_1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_DROP_LOCK_TABLES2= - DROP TABLE IF EXISTS t2_2; -let $CHILD2_1_CREATE_LOCK_TABLES2= - CREATE TABLE t2_2 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_DROP_INCREMENT_TABLES1= - DROP TABLE IF EXISTS t1_1; -let $CHILD2_1_CREATE_INCREMENT_TABLES1= - CREATE TABLE t1_1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_INCREMENT_TABLES1= - SELECT id FROM t1_1 ORDER BY id; -let $CHILD2_1_DROP_TEXT_PK_TABLES1= - DROP TABLE IF EXISTS t1; -let $CHILD2_1_CREATE_TEXT_PK_TABLES1= - CREATE TABLE t1 ( - a VARCHAR(255), - PRIMARY KEY (a) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2; -let $CHILD2_1_SELECT_TEXT_PK_TABLES1= - SELECT a FROM t1 ORDER BY a; -let $CHILD2_1_DROP_TEXT_KEY_TABLES1= - DROP TABLE IF EXISTS t1; -let $CHILD2_1_CREATE_TEXT_KEY_TABLES1= - CREATE TABLE t1 ( - a VARCHAR(255), - b VARCHAR(255), - c VARCHAR(255), - KEY idx1(a,b), - KEY idx2(b), - PRIMARY KEY(c) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TEXT_KEY_TABLES1= - SELECT a, b FROM t1 ORDER BY a, b; -let $CHILD2_1_AUTO_INCREMENT_INCREMENT1= - SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; -let $CHILD2_1_AUTO_INCREMENT_INCREMENT2= - SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; -let $CHILD2_1_AUTO_INCREMENT_OFFSET1= - SET GLOBAL AUTO_INCREMENT_OFFSET = 1; -let $CHILD2_1_AUTO_INCREMENT_OFFSET2= - SET GLOBAL AUTO_INCREMENT_OFFSET = 2; diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc deleted file mode 100644 index 9f0b5e2fe5a..00000000000 --- a/storage/spider/mysql-test/spider/bg/include/init_child2_2.inc +++ /dev/null @@ -1,80 +0,0 @@ -let $CHILD2_2_DROP_TABLES= - DROP TABLE IF EXISTS ta_r3; -let $CHILD2_2_CREATE_TABLES= - CREATE TABLE ta_r3 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_DROP_TABLES5= - DROP TABLE IF EXISTS ta_r_int; -let $CHILD2_2_CREATE_TABLES5= - CREATE TABLE ta_r_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_SELECT_TABLES= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; -let $CHILD2_2_DROP_FT_TABLES= - DROP TABLE IF EXISTS ft_r3; -let $CHILD2_2_CREATE_FT_TABLES= - CREATE TABLE ft_r3 ( - a INT DEFAULT 0, - b TEXT, - c TEXT, - d TEXT, - PRIMARY KEY(a), - FULLTEXT INDEX ft_idx1(b), - FULLTEXT INDEX ft_idx2(c) - ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET; -let $CHILD2_2_SELECT_FT_TABLES= - SELECT a, b, c, d FROM ft_r3 ORDER BY a; -let $CHILD2_2_DROP_GM_TABLES= - DROP TABLE IF EXISTS gm_r3; -let $CHILD2_2_CREATE_GM_TABLES= - CREATE TABLE gm_r3 ( - a INT DEFAULT 0, - b GEOMETRY NOT NULL, - c GEOMETRY NOT NULL, - PRIMARY KEY(a), - SPATIAL INDEX sp_idx1(b), - SPATIAL INDEX sp_idx2(c) - ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET; -let $CHILD2_2_SELECT_GM_TABLES= - SELECT a, b, c FROM gm_r3 ORDER BY a; -let $CHILD2_2_DROP_LOCK_TABLES1= - DROP TABLE IF EXISTS t1_2; -let $CHILD2_2_CREATE_LOCK_TABLES1= - CREATE TABLE t1_2 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_DROP_LOCK_TABLES2= - DROP TABLE IF EXISTS t2_1; -let $CHILD2_2_CREATE_LOCK_TABLES2= - CREATE TABLE t2_1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_DROP_INCREMENT_TABLES1= - DROP TABLE IF EXISTS t1_2; -let $CHILD2_2_CREATE_INCREMENT_TABLES1= - CREATE TABLE t1_2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_SELECT_INCREMENT_TABLES1= - SELECT id FROM t1_2 ORDER BY id; -let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= - SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; -let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= - SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; -let $CHILD2_2_AUTO_INCREMENT_OFFSET1= - SET GLOBAL AUTO_INCREMENT_OFFSET = 1; -let $CHILD2_2_AUTO_INCREMENT_OFFSET2= - SET GLOBAL AUTO_INCREMENT_OFFSET = 3; diff --git a/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc b/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc deleted file mode 100644 index 05dbb1c3dd1..00000000000 --- a/storage/spider/mysql-test/spider/bg/include/init_child2_3.inc +++ /dev/null @@ -1,11 +0,0 @@ -let $CHILD2_3_DROP_TABLES= - DROP TABLE IF EXISTS ta_r4; -let $CHILD2_3_CREATE_TABLES= - CREATE TABLE ta_r4 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET; -let $CHILD2_3_SELECT_TABLES= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; diff --git a/storage/spider/mysql-test/spider/bg/include/init_child3_1.inc b/storage/spider/mysql-test/spider/bg/include/init_child3_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/init_child3_2.inc b/storage/spider/mysql-test/spider/bg/include/init_child3_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/init_child3_3.inc b/storage/spider/mysql-test/spider/bg/include/init_child3_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/bg/include/init_master_1.inc b/storage/spider/mysql-test/spider/bg/include/init_master_1.inc index d6e302a6e1f..9a67251d023 100644 --- a/storage/spider/mysql-test/spider/bg/include/init_master_1.inc +++ b/storage/spider/mysql-test/spider/bg/include/init_master_1.inc @@ -9,186 +9,3 @@ SET spider_multi_split_read= 1; SET spider_reset_sql_alloc= 0; SET spider_bulk_update_size= 40; SET spider_direct_order_limit= 10000; -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_2_1= - COMMENT='database "auto_test_remote", table "ta_r"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_2_1= - COMMENT='database "auto_test_remote", table "ta_r"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT2_2_1= - COMMENT='database "auto_test_remote", table "ta_r_no_idx"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password "", prt "2000000"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT2_2_1= - COMMENT='database "auto_test_remote", table "ta_r_no_idx"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password "", prt "2000000"'; -} -let $MASTER_1_COMMENT_P_2_1= - COMMENT='table "ta_r3"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001"' - ); -let $MASTER_1_COMMENT2_P_2_1= - COMMENT='table "ta_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "ta_r2", priority "1000"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001"' - ); -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT3_2_1= - COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT3_2_1= - COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -let $MASTER_1_COMMENT3_P_2_1= - COMMENT='table "ta_r_int"' - PARTITION BY LIST(MOD(a, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='srv "s_2_1", priority "1000"', - PARTITION pt2 VALUES IN (1) - COMMENT='srv "s_2_2", priority "1000001"' - ); -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT4_2_1= - COMMENT='database "auto_test_remote", table "ta_r_int"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT4_2_1= - COMMENT='database "auto_test_remote", table "ta_r_int"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT5_2_1= - COMMENT='database "auto_test_remote", table "ta_r_3"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT5_2_1= - COMMENT='database "auto_test_remote", table "ta_r_3"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_FT_2_1= - COMMENT='database "auto_test_remote", table "ft_r"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_FT_2_1= - COMMENT='database "auto_test_remote", table "ft_r"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -let $MASTER_1_COMMENT2_FT_P_2_1= - COMMENT='table "ft_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "ft_r2", priority "1000"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001"' - ); -let $MASTER_1_COMMENT_GM_2_1= - COMMENT='srv "s_2_1", table "gm_r"'; -let $MASTER_1_COMMENT2_GM_P_2_1= - COMMENT='table "gm_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "gm_r2", priority "1000"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001"' - ); -let $MASTER_1_COMMENT_LOCK1= - COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2"'; -let $MASTER_1_COMMENT_LOCK2= - COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1"'; -let $MASTER_1_COMMENT_INCREMENT1_1= - COMMENT 'aim "1", tbl "t1_1", srv "s_2_1"'; -let $MASTER_1_COMMENT_INCREMENT1_P_1= - COMMENT 'aim "1"' - PARTITION BY LIST(MOD(id, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='tbl "t1_1", srv "s_2_1"', - PARTITION pt2 VALUES IN (1) - COMMENT='tbl "t1_2", srv "s_2_2"' - ); -let $MASTER_1_COMMENT_READONLY1_1= - COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1"'; -let $MASTER_1_COMMENT_ERROR_MODE1_1= - COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1"'; -let $MASTER_1_COMMENT_TEXT_PK1_1= - COMMENT 'tbl "t1", srv "s_2_1"'; -let $MASTER_1_COMMENT_TEXT_KEY1_1= - COMMENT 'tbl "t1", srv "s_2_1"'; -let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS= - SHOW STATUS LIKE 'Spider_direct_update'; -let $MASTER_1_CHECK_DIRECT_DELETE_STATUS= - SHOW STATUS LIKE 'Spider_direct_delete'; -let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS= - SHOW STATUS LIKE 'Spider_direct_order_limit'; -let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS= - SHOW STATUS LIKE 'Spider_direct_aggregate'; -let $MASTER_1_AUTO_INCREMENT_INCREMENT1= - SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON - SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '', - 'srv "s_2_1"') $STR_SEMICOLON - SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '', - 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_INCREMENT2= - SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON - SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', - 'srv "s_2_1"') $STR_SEMICOLON - SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', - 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET1= - SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON - SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '', - 'srv "s_2_1"') $STR_SEMICOLON - SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '', - 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET2= - SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON - SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', - 'srv "s_2_1"') $STR_SEMICOLON - SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', - 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET3= - SET SESSION AUTO_INCREMENT_OFFSET = 1; -let $MASTER_1_AUTO_INCREMENT_OFFSET4= - SET SESSION AUTO_INCREMENT_OFFSET = 777; diff --git a/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc deleted file mode 100644 index 73c3c6b9ef2..00000000000 --- a/storage/spider/mysql-test/spider/bg/include/init_slave1_1.inc +++ /dev/null @@ -1,10 +0,0 @@ -let $SLAVE1_1_COMMENT_INCREMENT1_1= - COMMENT ''; -let $SLAVE1_1_COMMENT_INCREMENT1_P_1= - COMMENT '' - PARTITION BY LIST(MOD(id, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='', - PARTITION pt2 VALUES IN (1) - COMMENT='' - ); diff --git a/storage/spider/mysql-test/spider/bg/my.cnf b/storage/spider/mysql-test/spider/bg/my.cnf index 246099c623e..3164fa6d113 100644 --- a/storage/spider/mysql-test/spider/bg/my.cnf +++ b/storage/spider/mysql-test/spider/bg/my.cnf @@ -145,32 +145,3 @@ CHILD3_3_ENGINE= ENGINE=InnoDB CHILD3_3_CHARSET= DEFAULT CHARSET=utf8 STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 -# CHILD2_2_DROP_TABLES -# CHILD2_2_CREATE_TABLES -# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/bg/t/basic_sql.test b/storage/spider/mysql-test/spider/bg/t/basic_sql.test index 24fa4314097..7b3ec715f86 100644 --- a/storage/spider/mysql-test/spider/bg/t/basic_sql.test +++ b/storage/spider/mysql-test/spider/bg/t/basic_sql.test @@ -12,8 +12,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -22,65 +20,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tb_l; @@ -92,12 +64,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -113,71 +85,32 @@ echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""' SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - INSERT INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - SELECT a, b, c FROM tb_l; -} --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo create table ignore select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -190,12 +123,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'f', '2008-07-01 10:21:39'), @@ -208,71 +141,32 @@ echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 IGNORE SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""' IGNORE SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - IGNORE SELECT a, b, c FROM tb_l; -} --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo create table ignore select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -282,85 +176,40 @@ echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 REPLACE SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""' REPLACE SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - REPLACE INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - REPLACE SELECT a, b, c FROM tb_l; -} --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%replace %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo create no index table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES3; - echo CHILD2_1_CREATE_TABLES3; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES3; +DROP TABLE IF EXISTS ta_r_no_idx; --enable_warnings - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r_no_idx ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l_no_idx; @@ -369,781 +218,331 @@ DROP TABLE IF EXISTS ta_l_no_idx; echo CREATE TABLE ta_l_no_idx MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 SELECT a, b, c FROM tb_l; -if ($MASTER_1_NEEDPK) -{ - --error ER_REQUIRES_PRIMARY_KEY - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l_no_idx ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; - INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_NEEDPK) -{ - if ($MASTER_1_MERGE) - { - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 +eval +CREATE TABLE ta_l_no_idx +ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_no_idx"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password "", prt "2000000"' SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l_no_idx ( - a INT, - b CHAR(1), - c DATETIME - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; - INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; - } - if (!$MASTER_1_MERGE) - { - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - } -} --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES3; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; --echo --echo select table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table shared mode -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a LOCK IN SHARE MODE; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table for update -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a FOR UPDATE; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table straight_join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_small_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_big_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_buffer_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_cache -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_no_cache -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select high_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select distinct -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select count -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT count(*) FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table join not use index -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 # MDEV-36357 --disable_view_protocol SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select using pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE a.b = 'g' ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select using index and pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE a.a > 0 AND a.b = 'g' ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo insert --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1151,45 +550,21 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert select --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1197,46 +572,22 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert select a --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1244,45 +595,21 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert low_priority --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1290,90 +617,42 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert high_priority --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo insert ignore -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1381,97 +660,49 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert update (insert) --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo insert update (update) -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1480,191 +711,95 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --connection master_1 TRUNCATE TABLE ta_l; INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo replace select -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo replace select a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo replace low_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', '2009-03-03 03:03:03'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1673,409 +808,193 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; TRUNCATE TABLE ta_l; INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update select -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update select a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update join a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update low_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update ignore -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update index pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2088,91 +1007,43 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo delete all -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2185,46 +1056,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2237,46 +1084,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2289,46 +1112,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2341,46 +1140,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2393,46 +1168,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE IGNORE FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2445,46 +1196,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE QUICK FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2497,46 +1224,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE b = 'e'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2549,90 +1252,42 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE a > 0 AND b = 'e'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo truncate -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'truncate %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2641,13 +1296,10 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/basic_sql_part.test b/storage/spider/mysql-test/spider/bg/t/basic_sql_part.test index 1bb18358d5d..b1a8499251c 100644 --- a/storage/spider/mysql-test/spider/bg/t/basic_sql_part.test +++ b/storage/spider/mysql-test/spider/bg/t/basic_sql_part.test @@ -5,16 +5,6 @@ --source test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -22,8 +12,6 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -32,30 +20,20 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings @@ -68,12 +46,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'f', '2008-07-01 10:21:39'), @@ -84,483 +62,226 @@ INSERT INTO tb_l (a, b, c) VALUES --echo --echo create table with partition and select test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 SELECT a, b, c FROM tb_l; - if ($MASTER_1_MERGE) - { - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001"' + ) SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - } - if (!$MASTER_1_MERGE) - { - eval CREATE TABLE ta_l2 ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 - SELECT a, b, c FROM tb_l; - } --enable_query_log - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo select partition using pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE a.b = 'g' ORDER BY a.a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } -} --echo --echo select partition using index pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE a.a > 0 AND a.b = 'g' ORDER BY a.a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } -} --echo --echo update partition pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo update partition index pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo delete partition pushdown -if ($HAVE_PARTITION) -{ TRUNCATE TABLE ta_l2; INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 DELETE FROM ta_l2 WHERE b = 'g'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo delete partition index pushdown -if ($HAVE_PARTITION) -{ TRUNCATE TABLE ta_l2; INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test b/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test index 4b33069245f..04a4a8d288f 100644 --- a/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test +++ b/storage/spider/mysql-test/spider/bg/t/direct_aggregate.test @@ -11,8 +11,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -21,65 +19,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -91,12 +63,15 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -107,70 +82,43 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo direct_aggregating test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT COUNT(*) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MAX(a) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MIN(a) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MAX(a) FROM ta_l WHERE a < 5; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MIN(a) FROM ta_l WHERE a > 1; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; --enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test index af35adb0dad..ddb89ba535b 100644 --- a/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test +++ b/storage/spider/mysql-test/spider/bg/t/direct_aggregate_part.test @@ -4,16 +4,6 @@ --source test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -21,8 +11,6 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -31,86 +19,49 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo with partition test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( @@ -119,12 +70,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -136,21 +93,20 @@ if ($HAVE_PARTITION) set @old_spider_direct_aggregate=@@session.spider_direct_aggregate; set spider_direct_aggregate=1; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT COUNT(*) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT SUM(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MAX(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MIN(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MAX(a) FROM ta_l2 WHERE a < 5; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MIN(a) FROM ta_l2 WHERE a > 1; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; --enable_ps2_protocol - SET spider_direct_aggregate=0; SELECT COUNT(*) FROM ta_l2; SELECT SUM(a) FROM ta_l2; @@ -158,48 +114,29 @@ if ($HAVE_PARTITION) SELECT MIN(a) FROM ta_l2; SELECT MAX(a) FROM ta_l2 WHERE a < 5; SELECT MIN(a) FROM ta_l2 WHERE a > 1; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; set spider_direct_aggregate=@old_spider_direct_aggregate; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/direct_update.test b/storage/spider/mysql-test/spider/bg/t/direct_update.test index 94f27e2859c..3ae3db391ec 100644 --- a/storage/spider/mysql-test/spider/bg/t/direct_update.test +++ b/storage/spider/mysql-test/spider/bg/t/direct_update.test @@ -11,8 +11,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -21,65 +19,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -91,12 +63,15 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -107,87 +82,60 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo direct_updating test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo update all rows with function UPDATE ta_l SET c = ADDDATE(c, 1); -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo update by primary key UPDATE ta_l SET b = 'x' WHERE a = 3; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo update by a column without index UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo update by primary key with order and limit UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo delete by primary key with order and limit DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo delete by a column without index DELETE FROM ta_l WHERE b = 'c'; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo delete by primary key DELETE FROM ta_l WHERE a = 3; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/direct_update_part.test b/storage/spider/mysql-test/spider/bg/t/direct_update_part.test index e8f1882594c..d24bc0c24ac 100644 --- a/storage/spider/mysql-test/spider/bg/t/direct_update_part.test +++ b/storage/spider/mysql-test/spider/bg/t/direct_update_part.test @@ -4,16 +4,6 @@ --source test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -21,8 +11,6 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -31,86 +19,49 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo with partition test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( @@ -119,12 +70,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -132,75 +89,56 @@ if ($HAVE_PARTITION) (4, 'd', '2003-11-30 05:01:03'), (5, 'c', '2001-12-31 23:59:59'); --enable_query_log - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo update all rows with function UPDATE ta_l2 SET c = ADDDATE(c, 1); - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo update by primary key UPDATE ta_l2 SET b = 'x' WHERE a = 3; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo update by a column without index UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo update by primary key with order and limit UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo delete by primary key with order and limit DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo delete by a column without index DELETE FROM ta_l2 WHERE b = 'c'; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo delete by primary key DELETE FROM ta_l2 WHERE a = 3; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/function.test b/storage/spider/mysql-test/spider/bg/t/function.test index 2472e774782..f2fb4e550fb 100644 --- a/storage/spider/mysql-test/spider/bg/t/function.test +++ b/storage/spider/mysql-test/spider/bg/t/function.test @@ -12,8 +12,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -22,66 +20,45 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo in() -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TEXT_PK_TABLES1; - echo CHILD2_1_CREATE_TEXT_PK_TABLES1; - } --disable_warnings - eval $CHILD2_1_DROP_TEXT_PK_TABLES1; +DROP TABLE IF EXISTS t1; --enable_warnings - eval $CHILD2_1_CREATE_TEXT_PK_TABLES1; +CREATE TABLE t1 ( +a VARCHAR(255), +PRIMARY KEY (a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE t1 ( a VARCHAR(255), PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( a VARCHAR(255), PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT 'tbl "t1", srv "s_2_1"'; --enable_query_log insert into t1 values ('1'); insert into t1 select a + 1 from t1; @@ -95,80 +72,40 @@ insert into t1 select a + 128 from t1; insert into t1 select a + 256 from t1; insert into t1 select a + 512 from t1; flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 select a from t1 where a in ('15', '120'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a FROM t1 ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo date_sub() -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -180,12 +117,15 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -209,25 +149,13 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -236,13 +164,10 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/ha.test b/storage/spider/mysql-test/spider/bg/t/ha.test index 4e734a87cc2..9fa0eeb95fa 100644 --- a/storage/spider/mysql-test/spider/bg/t/ha.test +++ b/storage/spider/mysql-test/spider/bg/t/ha.test @@ -1,6 +1,4 @@ # This test tests for ha features -if ($USE_HA_TEST) -{ --disable_warnings --disable_query_log --disable_result_log @@ -15,8 +13,6 @@ if ($USE_HA_TEST) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -29,9 +25,6 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ --connection child3_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; @@ -44,133 +37,111 @@ if ($USE_CHILD_GROUP3) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; --connection child2_3 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 SELECT 1; --connection child3_2 SELECT 1; --connection child3_3 SELECT 1; - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } -} --echo --echo create table test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_2_1; +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2"'; --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_2_1; +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2"'; --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2"'; --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -182,12 +153,16 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2"'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -198,373 +173,273 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo fail-over test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_HA_DROP_TABLES; - } --disable_warnings - eval $CHILD2_2_HA_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_CHECK_HA_STATUS; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; --error 12511 INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_CHECK_LINK_FAILED_LOG; -eval $MASTER_1_CHECK_HA_STATUS; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --enable_query_log --enable_result_log - } -} --echo --echo recovery test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_HA_CREATE_TABLES; - } - eval $CHILD2_2_HA_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_SET_RECOVERY_STATUS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --disable_view_protocol -eval $MASTER_1_COPY_TABLES_2_1; +SELECT spider_copy_tables('ta_l', '0', '1'); --enable_view_protocol -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_SET_OK_STATUS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; INSERT INTO ta_l (a, b, c) VALUES (8, 'g', '2011-05-05 21:33:30'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; DROP TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol -eval $MASTER_1_CHANGE_HA_MON; +SELECT spider_flush_table_mon_cache(); --enable_ps2_protocol --echo --echo active standby test --echo create table test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1; +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2"'; --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1; +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2"'; --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2"'; --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -576,12 +451,16 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2"'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -592,261 +471,158 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo fail-over test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_DROP_TABLES; - } --disable_warnings - eval $CHILD2_1_HA_AS_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_CHECK_HA_STATUS; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; --error 12511 INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_CHECK_LINK_FAILED_LOG; -eval $MASTER_1_CHECK_HA_STATUS; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --enable_query_log --enable_result_log - } -} --echo --echo recovery test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_CREATE_TABLES; - } - eval $CHILD2_1_HA_AS_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_AS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_AS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_AS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_SET_OK_STATUS_AS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; INSERT INTO ta_l (a, b, c) VALUES (8, 'g', '2011-05-05 21:33:30'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; DROP TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol -eval $MASTER_1_CHANGE_HA_MON; +SELECT spider_flush_table_mon_cache(); --enable_ps2_protocol --echo @@ -854,24 +630,18 @@ eval $MASTER_1_CHANGE_HA_MON; --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; --connection child2_3 DROP DATABASE IF EXISTS auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ --connection child3_1 DROP DATABASE IF EXISTS auto_test_local; --connection child3_2 DROP DATABASE IF EXISTS auto_test_local; --connection child3_3 DROP DATABASE IF EXISTS auto_test_local; -} --disable_query_log --disable_result_log --source ha_test_deinit.inc @@ -879,6 +649,5 @@ if ($USE_CHILD_GROUP3) --enable_result_log --enable_query_log --enable_warnings -} --echo --echo end of test diff --git a/storage/spider/mysql-test/spider/bg/t/ha_part.test b/storage/spider/mysql-test/spider/bg/t/ha_part.test index 5e7d625caa4..70535df04ea 100644 --- a/storage/spider/mysql-test/spider/bg/t/ha_part.test +++ b/storage/spider/mysql-test/spider/bg/t/ha_part.test @@ -1,6 +1,4 @@ # This test tests for ha features -if ($USE_HA_TEST) -{ --disable_warnings --disable_query_log --disable_result_log @@ -8,17 +6,6 @@ if ($USE_HA_TEST) --source ha_test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source ha_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -26,8 +13,6 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -40,9 +25,6 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ --connection child3_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; @@ -55,158 +37,135 @@ if ($USE_CHILD_GROUP3) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; --connection child2_3 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 SELECT 1; --connection child3_2 SELECT 1; --connection child3_3 SELECT 1; - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } -} -if ($HAVE_PARTITION) -{ --echo --echo create table with partition test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_DROP_TABLES; - echo CHILD2_3_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_3_DROP_TABLES; +DROP TABLE IF EXISTS ta_r4; --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r4 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_P_2_1; +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_P_2_1; +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_P_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --enable_query_log --enable_result_log - } - } --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l2; @@ -218,12 +177,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='msi "5", mkd "2"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -234,430 +199,334 @@ if ($HAVE_PARTITION) --echo --echo select test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } --echo --echo fail-over test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_HA_DROP_TABLES; - } --disable_warnings - eval $CHILD2_3_HA_DROP_TABLES; +DROP TABLE IF EXISTS ta_r4; --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_CHECK_HA_STATUS; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; --error 12511 INSERT INTO ta_l2 (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_CHECK_LINK_FAILED_LOG; - eval $MASTER_1_CHECK_HA_STATUS; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; INSERT INTO ta_l2 (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --enable_query_log --enable_result_log - } - } --echo --echo recovery test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_HA_CREATE_TABLES; - } - eval $CHILD2_3_HA_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r4 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --disable_view_protocol - eval $MASTER_1_COPY_TABLES_P_2_1; +SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); --enable_view_protocol - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_SET_OK_STATUS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; INSERT INTO ta_l2 (a, b, c) VALUES (8, 'g', '2011-05-05 21:33:30'), (9, 'h', '2011-05-05 22:32:10'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; DROP TABLE ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } - } -} -if ($HAVE_PARTITION) -{ --echo --echo create table with partition test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_DROP_TABLES; - echo CHILD2_3_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_3_DROP_TABLES; +DROP TABLE IF EXISTS ta_r4; --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r4 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1; +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2", alc "1"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1; +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2", alc "1"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2", alc "1"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --enable_query_log --enable_result_log - } - } --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l2; @@ -669,12 +538,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='msi "5", mkd "2", alc "1"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -685,328 +560,205 @@ if ($HAVE_PARTITION) --echo --echo select test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } --echo --echo fail-over test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_DROP_TABLES2; - } --disable_warnings - eval $CHILD2_1_HA_AS_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_CHECK_HA_STATUS; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; --error 12511 INSERT INTO ta_l2 (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_CHECK_LINK_FAILED_LOG; - eval $MASTER_1_CHECK_HA_STATUS; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; INSERT INTO ta_l2 (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --enable_query_log --enable_result_log - } - } --echo --echo recovery test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_CREATE_TABLES2; - } - eval $CHILD2_1_HA_AS_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_SET_OK_STATUS_AS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; INSERT INTO ta_l2 (a, b, c) VALUES (8, 'g', '2011-05-05 21:33:30'), (9, 'h', '2011-05-05 22:32:10'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; DROP TABLE ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; --connection child2_3 DROP DATABASE IF EXISTS auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ --connection child3_1 DROP DATABASE IF EXISTS auto_test_local; --connection child3_2 DROP DATABASE IF EXISTS auto_test_local; --connection child3_3 DROP DATABASE IF EXISTS auto_test_local; -} --disable_query_log --disable_result_log --source ha_test_deinit.inc @@ -1014,6 +766,5 @@ if ($USE_CHILD_GROUP3) --enable_result_log --enable_query_log --enable_warnings -} --echo --echo end of test diff --git a/storage/spider/mysql-test/spider/bg/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/bg/t/ha_test_deinit.inc index 53d0409d066..ff195f95048 100644 --- a/storage/spider/mysql-test/spider/bg/t/ha_test_deinit.inc +++ b/storage/spider/mysql-test/spider/bg/t/ha_test_deinit.inc @@ -1,19 +1,11 @@ # get connection and exist engine test --echo for master_1 ---connection master_1 ---source ../include/ha_deinit_master_1.inc --echo for child2 if ($USE_CHILD_GROUP2) { --echo child2_1 - --connection child2_1 - --source ../include/ha_deinit_child2_1.inc --echo child2_2 - --connection child2_2 - --source ../include/ha_deinit_child2_2.inc --echo child2_3 - --connection child2_3 - --source ../include/ha_deinit_child2_3.inc } --echo for child3 if ($USE_CHILD_GROUP3) diff --git a/storage/spider/mysql-test/spider/bg/t/ha_test_init.inc b/storage/spider/mysql-test/spider/bg/t/ha_test_init.inc index 70576ab16dc..4b836b03919 100644 --- a/storage/spider/mysql-test/spider/bg/t/ha_test_init.inc +++ b/storage/spider/mysql-test/spider/bg/t/ha_test_init.inc @@ -6,14 +6,8 @@ if ($USE_CHILD_GROUP2) { --echo child2_1 - --connection child2_1 - --source ../include/ha_init_child2_1.inc --echo child2_2 - --connection child2_2 - --source ../include/ha_init_child2_2.inc --echo child2_3 - --connection child2_3 - --source ../include/ha_init_child2_3.inc } --echo for child3 if ($USE_CHILD_GROUP3) diff --git a/storage/spider/mysql-test/spider/bg/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/bg/t/slave_test_deinit.inc index e9d99b7a960..4bbc7ec420d 100644 --- a/storage/spider/mysql-test/spider/bg/t/slave_test_deinit.inc +++ b/storage/spider/mysql-test/spider/bg/t/slave_test_deinit.inc @@ -2,5 +2,4 @@ --echo for slave1_1 --connection slave1_1 STOP SLAVE; ---source ../include/deinit_slave1_1.inc --disconnect slave1_1 diff --git a/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc b/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc index 84de2c7d2e6..4afbe361baf 100644 --- a/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc +++ b/storage/spider/mysql-test/spider/bg/t/slave_test_init.inc @@ -7,7 +7,6 @@ SET SESSION sql_log_bin= 0; --let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE --source have_partition.inc --source have_trigger.inc ---source ../include/init_slave1_1.inc --source have_engine.inc --let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` if (!$SLAVE1_1_SLAVE_STATUS) diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test index 64d3b657ae8..04ad28a9dce 100644 --- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test +++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test @@ -14,15 +14,10 @@ source include/have_log_bin.inc; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -31,74 +26,40 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} - --echo --echo 3.1 --echo auto_increment -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_1; --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 2; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; @@ -106,7 +67,6 @@ if ($USE_REPLICATION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log -} --disable_warnings DROP TABLE IF EXISTS t1, t2; --enable_warnings @@ -121,20 +81,26 @@ echo CREATE TABLE t2 ( ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; echo MASTER_1_AUTO_INCREMENT_INCREMENT2; echo MASTER_1_AUTO_INCREMENT_OFFSET2; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; -eval CREATE TABLE t2 ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "1", tbl "t1_1", srv "s_2_1"'; +CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "1", tbl "t1_1", srv "s_2_1"'; --disable_ps_protocol -eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +SET SESSION AUTO_INCREMENT_INCREMENT = 777 ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"'); +SET SESSION AUTO_INCREMENT_OFFSET = 777 ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"'); --enable_ps_protocol -if ($USE_REPLICATION) -{ SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_warnings @@ -148,16 +114,15 @@ if ($USE_REPLICATION) id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t2 ( +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT ''; +CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT ''; --connection master_1 -} --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); @@ -167,28 +132,28 @@ SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 (id) VALUES (null); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 (id) VALUES (null); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); SELECT id FROM t1 ORDER BY id; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); @@ -204,14 +169,14 @@ SELECT id FROM t2 ORDER BY id; SET INSERT_ID=5000; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 () VALUES (); SELECT LAST_INSERT_ID(); @@ -222,8 +187,6 @@ SELECT MAX(id) FROM t1; INSERT INTO t2 (id) VALUES (1000); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; @@ -232,57 +195,27 @@ if ($USE_REPLICATION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT id FROM t1_1 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --enable_query_log --enable_result_log - } -} - --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source slave_test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test index bcd85f42b81..156784ae8e7 100644 --- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test +++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test @@ -7,17 +7,6 @@ source include/have_log_bin.inc; --source slave_test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source slave_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -25,15 +14,10 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -42,97 +26,49 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} - --echo auto_increment with partition -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_1; --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 2; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_INCREMENT_TABLES1; - echo CHILD2_2_CREATE_INCREMENT_TABLES1; - echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_2_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_2_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_2; --enable_warnings - eval $CHILD2_2_CREATE_INCREMENT_TABLES1; - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 3; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 - if ($USE_REPLICATION) - { save_master_pos; --connection slave1_1 sync_with_master; @@ -140,7 +76,6 @@ if ($HAVE_PARTITION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log - } --disable_warnings DROP TABLE IF EXISTS t1, t2; --enable_warnings @@ -155,20 +90,38 @@ if ($HAVE_PARTITION) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; echo MASTER_1_AUTO_INCREMENT_INCREMENT2; echo MASTER_1_AUTO_INCREMENT_OFFSET2; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t2 ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "1"' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='tbl "t1_1", srv "s_2_1"', +PARTITION pt2 VALUES IN (1) +COMMENT='tbl "t1_2", srv "s_2_2"' + ); +CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "1"' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='tbl "t1_1", srv "s_2_1"', +PARTITION pt2 VALUES IN (1) +COMMENT='tbl "t1_2", srv "s_2_2"' + ); --disable_ps_protocol - eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; - eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +SET SESSION AUTO_INCREMENT_INCREMENT = 777 ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"'); +SET SESSION AUTO_INCREMENT_OFFSET = 777 ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"'); --enable_ps_protocol - if ($USE_REPLICATION) - { SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_warnings @@ -182,16 +135,27 @@ if ($HAVE_PARTITION) id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t2 ( +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT '' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='', +PARTITION pt2 VALUES IN (1) +COMMENT='' + ); +CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT '' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='', +PARTITION pt2 VALUES IN (1) +COMMENT='' + ); --connection master_1 - } --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); @@ -201,28 +165,28 @@ if ($HAVE_PARTITION) SELECT MAX(id) FROM t2; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 (id) VALUES (null); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 (id) VALUES (null); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); SELECT id FROM t1 ORDER BY id; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); @@ -238,14 +202,14 @@ if ($HAVE_PARTITION) SET INSERT_ID=5000; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 () VALUES (); SELECT LAST_INSERT_ID(); @@ -256,8 +220,6 @@ if ($HAVE_PARTITION) INSERT INTO t2 (id) VALUES (1000); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; - if ($USE_REPLICATION) - { save_master_pos; --connection slave1_1 sync_with_master; @@ -266,76 +228,32 @@ if ($HAVE_PARTITION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log - } - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } +SELECT id FROM t1_1 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_2_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT id FROM t1_2 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --enable_query_log --enable_result_log - } - } -} - --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source slave_test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test index 061dbac20bf..5784a671405 100644 --- a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test +++ b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test @@ -14,15 +14,10 @@ source include/have_log_bin.inc; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -31,65 +26,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tb_l; @@ -101,12 +70,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -121,145 +90,76 @@ DROP TABLE IF EXISTS ta_l; echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l SELECT a, b, c FROM tb_l; --echo --echo 2.13 --echo select table with "order by desc" and "<" -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a < 5 ORDER BY a DESC LIMIT 3; --enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table with "order by desc" and "<=" -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a <= 5 ORDER BY a DESC LIMIT 3; --enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo 2.14 --echo update table with range scan and split_read -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -270,30 +170,19 @@ TRUNCATE TABLE ta_l; --disable_warnings DROP TABLE IF EXISTS ta_l; --enable_warnings -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES6; - echo CHILD2_1_CREATE_TABLES6; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES6; +DROP TABLE IF EXISTS ta_r_3; --enable_warnings - eval $CHILD2_1_CREATE_TABLES6; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE ta_l ( @@ -302,324 +191,160 @@ echo CREATE TABLE ta_l ( c datetime DEFAULT NULL, PRIMARY KEY (a, b, c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a int(11) NOT NULL DEFAULT '0', b char(1) DEFAULT NULL, c datetime DEFAULT NULL, PRIMARY KEY (a, b, c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' AND c = '2001-12-31 23:59:59'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' AND b <= 'd' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' AND b < 'e' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 AND b >= 'b' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 AND b >= 'b' AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo 2.16 --echo auto_increment insert with trigger -if ($HAVE_TRIGGER) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES4; - echo CHILD2_1_CREATE_TABLES4; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES4; +DROP TABLE IF EXISTS ta_r_auto_inc; --enable_warnings - eval $CHILD2_1_CREATE_TABLES4; +CREATE TABLE ta_r_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l_auto_inc ( @@ -628,139 +353,87 @@ if ($HAVE_TRIGGER) c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; - eval CREATE TABLE ta_l_auto_inc ( +eval +CREATE TABLE ta_l_auto_inc ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tc_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; - eval CREATE TABLE tc_l ( +CREATE TABLE tc_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 INSERT INTO ta_l_auto_inc (a, b, c) VALUES (NULL, 's', '2008-12-31 20:59:59'); - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES4; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc +ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; -} --echo --echo 2.17 --echo engine-condition-pushdown with "or" and joining -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo 2.23 --echo index merge -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE ta_l_int ( @@ -771,59 +444,38 @@ echo CREATE TABLE ta_l_int ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( +eval +CREATE TABLE ta_l_int ( a INT AUTO_INCREMENT, b INT DEFAULT 10, c INT DEFAULT 11, PRIMARY KEY(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo 2.24 @@ -840,78 +492,35 @@ echo CREATE TABLE ta_l_int ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -if ($MASTER_1_NEEDPK) -{ - --error ER_REQUIRES_PRIMARY_KEY - eval CREATE TABLE ta_l_int ( +eval +CREATE TABLE ta_l_int ( a INT NOT NULL, b INT DEFAULT 10, c INT DEFAULT 11, KEY idx1(b), KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; -} -if (!$MASTER_1_NEEDPK) -{ - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; -} +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log SELECT a, b, c FROM ta_l_int ORDER BY a; INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l_int SET c = 4 WHERE b = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l_int ORDER BY a; @@ -920,75 +529,47 @@ SELECT a, b, c FROM ta_l_int ORDER BY a; --echo 2.25 --echo direct order limit --connection master_1 -eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; +SHOW STATUS LIKE 'Spider_direct_order_limit'; --disable_ps2_protocol SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; --enable_ps2_protocol -eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; - +SHOW STATUS LIKE 'Spider_direct_order_limit'; --echo --echo 2.26 --echo lock tables -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_LOCK_TABLES1; - echo CHILD2_1_DROP_LOCK_TABLES2; - echo CHILD2_1_CREATE_LOCK_TABLES1; - echo CHILD2_1_CREATE_LOCK_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_LOCK_TABLES1; - eval $CHILD2_1_DROP_LOCK_TABLES2; +DROP TABLE IF EXISTS t1_1; +DROP TABLE IF EXISTS t2_2; --enable_warnings - eval $CHILD2_1_CREATE_LOCK_TABLES1; - eval $CHILD2_1_CREATE_LOCK_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2_2 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_LOCK_TABLES1; - echo CHILD2_2_DROP_LOCK_TABLES2; - echo CHILD2_2_CREATE_LOCK_TABLES1; - echo CHILD2_2_CREATE_LOCK_TABLES2; - } --disable_warnings - eval $CHILD2_2_DROP_LOCK_TABLES1; - eval $CHILD2_2_DROP_LOCK_TABLES2; +DROP TABLE IF EXISTS t1_2; +DROP TABLE IF EXISTS t2_1; --enable_warnings - eval $CHILD2_2_CREATE_LOCK_TABLES1; - eval $CHILD2_2_CREATE_LOCK_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_2 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2_1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS t1; @@ -999,18 +580,18 @@ echo CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2"'; echo CREATE TABLE t2 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2; -eval CREATE TABLE t2 ( +CREATE TABLE t2 ( id int(11) NOT NULL, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1"'; --enable_query_log LOCK TABLES t1 READ, t2 READ; UNLOCK TABLES; @@ -1018,45 +599,22 @@ UNLOCK TABLES; --echo --echo auto_increment -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_1; --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 2; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; @@ -1064,7 +622,6 @@ if ($USE_REPLICATION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log -} --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -1075,16 +632,22 @@ echo CREATE TABLE t1 ( ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; echo MASTER_1_AUTO_INCREMENT_INCREMENT2; echo MASTER_1_AUTO_INCREMENT_OFFSET2; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "1", tbl "t1_1", srv "s_2_1"'; --disable_ps_protocol -eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +SET SESSION AUTO_INCREMENT_INCREMENT = 777 ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"'); +SET SESSION AUTO_INCREMENT_OFFSET = 777 ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"'); --enable_ps_protocol -if ($USE_REPLICATION) -{ SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_warnings @@ -1094,12 +657,11 @@ if ($USE_REPLICATION) id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT ''; --connection master_1 -} --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); @@ -1126,8 +688,6 @@ SELECT MAX(id) FROM t1; INSERT INTO t1 (id) VALUES (1000); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; @@ -1136,47 +696,21 @@ if ($USE_REPLICATION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT id FROM t1_1 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --enable_query_log --enable_result_log - } -} - --echo --echo read only let $MASTER_1_ENGINE_IS_SPIDER= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`; -if ($MASTER_1_ENGINE_IS_SPIDER) -{ --connection master_1 --disable_warnings DROP TABLE IF EXISTS t1; @@ -1186,35 +720,27 @@ if ($MASTER_1_ENGINE_IS_SPIDER) id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1"'; --let $MIN_VAL= `SELECT MIN(id) FROM t1` --enable_query_log SELECT id FROM t1 ORDER BY id; --error 12518 INSERT INTO t1 (id) VALUES (1); --error 12518 - eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL; +UPDATE t1 SET id = 4 WHERE id = 777; --error 12518 - eval DELETE FROM t1 WHERE id = $MIN_VAL; +DELETE FROM t1 WHERE id = 777; --error 12518 DELETE FROM t1; --error 12518 TRUNCATE t1; -} -if (!$MASTER_1_ENGINE_IS_SPIDER) -{ - --echo skipped -} - --echo --echo 2.27 --echo error mode -if ($MASTER_1_ENGINE_IS_SPIDER) -{ --connection master_1 --disable_warnings DROP TABLE IF EXISTS t1; @@ -1224,48 +750,35 @@ if ($MASTER_1_ENGINE_IS_SPIDER) id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1"'; --enable_query_log SELECT id FROM t1 ORDER BY id; INSERT INTO t1 (id) VALUES (1); DELETE FROM t1; TRUNCATE t1; -} -if (!$MASTER_1_ENGINE_IS_SPIDER) -{ - --echo skipped -} - --echo --echo 3.0 --echo is null -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TEXT_KEY_TABLES1; - echo CHILD2_1_CREATE_TEXT_KEY_TABLES1; - } --disable_warnings - eval $CHILD2_1_DROP_TEXT_KEY_TABLES1; +DROP TABLE IF EXISTS t1; --enable_warnings - eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1; +CREATE TABLE t1 ( +a VARCHAR(255), +b VARCHAR(255), +c VARCHAR(255), +KEY idx1(a,b), +KEY idx2(b), +PRIMARY KEY(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS t1; @@ -1279,14 +792,14 @@ echo CREATE TABLE t1 ( KEY idx2(b), PRIMARY KEY(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( a VARCHAR(255), b VARCHAR(255), c VARCHAR(255), KEY idx1(a,b), KEY idx2(b), PRIMARY KEY(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'tbl "t1", srv "s_2_1"'; --enable_query_log insert into t1 values (null, null, '2048'); insert into t1 values ('1', '1', '1'); @@ -1301,47 +814,22 @@ insert into t1 select a + 128, b + 128, c + 128 from t1; insert into t1 select a + 256, b + 256, c + 256 from t1; insert into t1 select a + 512, b + 512, c + 512 from t1; flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 select a from t1 where a is null order by a limit 30; select b from t1 where b is null order by b limit 30; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a FROM t1 ORDER BY a; --enable_query_log --enable_result_log - } -} - --echo --echo direct_order_limit @@ -1357,65 +845,34 @@ insert into t1 select a, b + 32, c + 32 from t1; insert into t1 select a, b + 64, c + 64 from t1; insert into t1 select a, b + 128, c + 128 from t1; flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; select a, c from t1 where a = '10' order by b desc limit 5; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a FROM t1 ORDER BY a; --enable_query_log --enable_result_log - } -} - --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source slave_test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/bg/t/spider_fixes_part.test index e6c4456edcb..7dbbf10fd37 100644 --- a/storage/spider/mysql-test/spider/bg/t/spider_fixes_part.test +++ b/storage/spider/mysql-test/spider/bg/t/spider_fixes_part.test @@ -7,17 +7,6 @@ source include/have_log_bin.inc; --source slave_test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source slave_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -25,15 +14,10 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -42,30 +26,20 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings @@ -78,12 +52,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -95,59 +69,32 @@ INSERT INTO tb_l (a, b, c) VALUES --echo --echo 2.17 --echo partition with sort -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( @@ -156,103 +103,66 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo --echo 2.23 --echo partition update with moving partition -if ($HAVE_PARTITION) -{ --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l2; --enable_warnings - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( @@ -261,89 +171,72 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); UPDATE ta_l2 SET a = 4 WHERE a = 3; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo index merge with partition -if ($HAVE_PARTITION) -{ --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l_int; --enable_warnings - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_2_DROP_TABLES5; - echo CHILD2_2_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_2_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l_int ( @@ -354,139 +247,76 @@ if ($HAVE_PARTITION) KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1; - eval CREATE TABLE ta_l_int ( +CREATE TABLE ta_l_int ( a INT AUTO_INCREMENT, b INT DEFAULT 10, c INT DEFAULT 11, PRIMARY KEY(a), KEY idx1(b), KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "ta_r_int"' + PARTITION BY LIST(MOD(a, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='srv "s_2_1", priority "1000"', +PARTITION pt2 VALUES IN (1) +COMMENT='srv "s_2_2", priority "1000001"' + ); --enable_query_log INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } -} - --echo --echo 2.26 --echo auto_increment with partition -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_1; --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 2; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_INCREMENT_TABLES1; - echo CHILD2_2_CREATE_INCREMENT_TABLES1; - echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_2_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_2_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_2; --enable_warnings - eval $CHILD2_2_CREATE_INCREMENT_TABLES1; - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 3; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 - if ($USE_REPLICATION) - { save_master_pos; --connection slave1_1 sync_with_master; @@ -494,7 +324,6 @@ if ($HAVE_PARTITION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log - } --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -505,16 +334,28 @@ if ($HAVE_PARTITION) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; echo MASTER_1_AUTO_INCREMENT_INCREMENT2; echo MASTER_1_AUTO_INCREMENT_OFFSET2; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "1"' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='tbl "t1_1", srv "s_2_1"', +PARTITION pt2 VALUES IN (1) +COMMENT='tbl "t1_2", srv "s_2_2"' + ); --disable_ps_protocol - eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; - eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +SET SESSION AUTO_INCREMENT_INCREMENT = 777 ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"'); +SET SESSION AUTO_INCREMENT_OFFSET = 777 ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"'); --enable_ps_protocol - if ($USE_REPLICATION) - { SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_warnings @@ -524,12 +365,17 @@ if ($HAVE_PARTITION) id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT '' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='', +PARTITION pt2 VALUES IN (1) +COMMENT='' + ); --connection master_1 - } --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); @@ -556,8 +402,6 @@ if ($HAVE_PARTITION) INSERT INTO t1 (id) VALUES (1000); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; - if ($USE_REPLICATION) - { save_master_pos; --connection slave1_1 sync_with_master; @@ -566,76 +410,32 @@ if ($HAVE_PARTITION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log - } - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } +SELECT id FROM t1_1 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_2_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT id FROM t1_2 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --enable_query_log --enable_result_log - } - } -} - --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source slave_test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bg/t/vp_fixes.test b/storage/spider/mysql-test/spider/bg/t/vp_fixes.test index 2c3e1523611..83a13e5c935 100644 --- a/storage/spider/mysql-test/spider/bg/t/vp_fixes.test +++ b/storage/spider/mysql-test/spider/bg/t/vp_fixes.test @@ -12,8 +12,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -22,65 +20,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tb_l; @@ -92,12 +64,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -112,41 +84,37 @@ DROP TABLE IF EXISTS ta_l; echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l SELECT a, b, c FROM tb_l; --echo --echo 0.9 --echo create different primary key table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE ta_l_int ( @@ -155,95 +123,59 @@ echo CREATE TABLE ta_l_int ( c INT DEFAULT 11, PRIMARY KEY(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( +eval +CREATE TABLE ta_l_int ( a INT DEFAULT 10, b INT AUTO_INCREMENT, c INT DEFAULT 11, PRIMARY KEY(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)` -if ($MASTER_1_IS_VP) -{ - --error 14514 - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -} -if (!$MASTER_1_IS_VP) -{ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); --disable_query_log --disable_result_log TRUNCATE TABLE ta_l_int; --enable_query_log --enable_result_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES5; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, c FROM ta_r_int ORDER BY a; --enable_query_log --enable_result_log - } -} --echo create un-correspond primary key table --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l_int; --enable_warnings -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE ta_l_int ( @@ -252,79 +184,47 @@ echo CREATE TABLE ta_l_int ( c INT DEFAULT 11, PRIMARY KEY(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( +eval +CREATE TABLE ta_l_int ( a INT DEFAULT 10, b INT DEFAULT 12, c INT DEFAULT 11, PRIMARY KEY(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 -if ($MASTER_1_IS_VP) -{ - --error 14514 - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -} -if (!$MASTER_1_IS_VP) -{ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); --disable_query_log --disable_result_log TRUNCATE TABLE ta_l_int; --enable_query_log --enable_result_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES5; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, c FROM ta_r_int ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/bugfix/my_1_1.cnf b/storage/spider/mysql-test/spider/bugfix/my_1_1.cnf index 5f17295d895..be960747491 100644 --- a/storage/spider/mysql-test/spider/bugfix/my_1_1.cnf +++ b/storage/spider/mysql-test/spider/bugfix/my_1_1.cnf @@ -26,7 +26,6 @@ MASTER_1_HSRPORT= 20000 MASTER_1_HSWPORT= 20001 MASTER_1_MYSOCK= @mysqld.1.1.socket MASTER_1_ENGINE_TYPE= Spider -#MASTER_1_ENGINE_TYPE= MyISAM MASTER_1_ENGINE= ENGINE=Spider MASTER_1_CHARSET= DEFAULT CHARSET=utf8 MASTER_1_ENGINE2= ENGINE=MyISAM @@ -34,11 +33,3 @@ MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/bugfix/my_2_1.cnf b/storage/spider/mysql-test/spider/bugfix/my_2_1.cnf index 24161645607..adc955ee0d9 100644 --- a/storage/spider/mysql-test/spider/bugfix/my_2_1.cnf +++ b/storage/spider/mysql-test/spider/bugfix/my_2_1.cnf @@ -34,23 +34,3 @@ CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket CHILD2_1_GM_ENGINE_TYPE= MyISAM CHILD2_1_GM_ENGINE= ENGINE=MyISAM CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/bugfix/my_2_2.cnf b/storage/spider/mysql-test/spider/bugfix/my_2_2.cnf index 2d3c2a89a7d..557b02e8e0a 100644 --- a/storage/spider/mysql-test/spider/bugfix/my_2_2.cnf +++ b/storage/spider/mysql-test/spider/bugfix/my_2_2.cnf @@ -31,8 +31,3 @@ CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket CHILD2_2_GM_ENGINE_TYPE= MyISAM CHILD2_2_GM_ENGINE= ENGINE=MyISAM CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_2_DROP_TABLES -# CHILD2_2_CREATE_TABLES -# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test b/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test index e650ef3bd3a..0fc94ce5185 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test +++ b/storage/spider/mysql-test/spider/bugfix/t/checksum_table_with_quick_mode_3.test @@ -22,7 +22,10 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -32,10 +35,10 @@ echo CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -54,10 +57,10 @@ CHECKSUM TABLE tbl_a EXTENDED; --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %'; --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test index a0f70bd9e82..6d3e105cffd 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test +++ b/storage/spider/mysql-test/spider/bugfix/t/cp932_column.test @@ -22,7 +22,12 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +txt_utf8 char(8) NOT NULL, +txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARACTER SET utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -34,12 +39,12 @@ echo CREATE TABLE tbl_a ( txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci, PRIMARY KEY (pkey) ) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, txt_utf8 char(8) NOT NULL, txt_cp932 char(8) NOT NULL COLLATE cp932_japanese_ci, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARACTER SET utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (pkey,txt_utf8,txt_cp932) VALUES (0,'',''),(1,'',''),(2,'',''),(3,'',''),(4,'',''),(5,'',''),(6,'',''),(7,'',''),(8,'',''),(9,'',''); FLUSH TABLES; @@ -61,10 +66,10 @@ SET NAMES utf8; SET NAMES cp932; --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND (argument LIKE '%insert %' OR argument LIKE '%update %'); --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey, txt_utf8, txt_cp932 FROM tbl_a ORDER BY pkey; SET NAMES utf8; --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test index d35c25534e9..7550e3791fd 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test +++ b/storage/spider/mysql-test/spider/bugfix/t/group_by_order_by_limit.test @@ -27,14 +27,24 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +skey int NOT NULL, +PRIMARY KEY (pkey), +KEY idx1 (skey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +skey int NOT NULL, +PRIMARY KEY (pkey), +KEY idx1 (skey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -46,12 +56,16 @@ echo CREATE TABLE tbl_a ( PRIMARY KEY (pkey), KEY idx1 (skey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, skey int NOT NULL, PRIMARY KEY (pkey), KEY idx1 (skey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' + PARTITION BY KEY(pkey) ( +PARTITION pt1 COMMENT='srv "s_2_1"', +PARTITION pt2 COMMENT='srv "s_2_2"' + ); --enable_query_log INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19); @@ -79,15 +93,15 @@ set spider_direct_aggregate=@old_spider_direct_aggregate; --connection child2_1 --disable_view_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey, skey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey, skey FROM tbl_a ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/insert_select.test b/storage/spider/mysql-test/spider/bugfix/t/insert_select.test index 84ebd230849..ddb3ebbc615 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/insert_select.test +++ b/storage/spider/mysql-test/spider/bugfix/t/insert_select.test @@ -22,9 +22,19 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +skey int NOT NULL, +dt date NOT NULL, +tm time NOT NULL, +KEY idx1 (skey,dt,tm) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; echo CHILD2_1_CREATE_TABLES2; -eval $CHILD2_1_CREATE_TABLES2; +CREATE TABLE tbl_b ( +pkey int NOT NULL, +dt datetime NOT NULL, +PRIMARY KEY (pkey), +KEY idx1 (dt) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -36,24 +46,24 @@ echo CREATE TABLE tbl_a ( tm time NOT NULL, KEY idx1 (skey,dt,tm) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( skey int NOT NULL, dt date NOT NULL, tm time NOT NULL, KEY idx1 (skey,dt,tm) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; echo CREATE TABLE tbl_b ( pkey int NOT NULL, dt datetime NOT NULL, PRIMARY KEY (pkey), KEY idx1 (dt) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2; -eval CREATE TABLE tbl_b ( +CREATE TABLE tbl_b ( pkey int NOT NULL, dt datetime NOT NULL, PRIMARY KEY (pkey), KEY idx1 (dt) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00'); INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(1, '2013-02-01', '13:00:00'),(2, '2013-03-01', '13:00:00'),(3, '2013-04-01', '13:00:00'),(4, '2013-05-01', '13:00:00'),(5, '2013-06-01', '13:00:00'),(6, '2013-07-01', '13:00:00'),(7, '2013-08-01', '13:00:00'),(8, '2013-09-01', '13:00:00'),(9, '2013-10-01', '13:00:00'); @@ -81,10 +91,10 @@ INSERT IGNORE INTO tbl_b (SELECT skey, CAST(CONCAT(dt, ' ', tm) AS datetime) FRO --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey, dt FROM tbl_b ORDER BY pkey; --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test index a953a250449..d73c37b40ed 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_19866.test @@ -27,14 +27,22 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val char(1) NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +val char(1) NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -45,11 +53,15 @@ echo CREATE TABLE tbl_a ( val char(1) NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, val char(1) NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' + PARTITION BY KEY(pkey) ( +PARTITION pt1 COMMENT='srv "s_2_1"', +PARTITION pt2 COMMENT='srv "s_2_2"' + ); --enable_query_log INSERT INTO tbl_a (pkey,val) VALUES (1,'1'),(2,'2'),(3,'3'),(4,'4'); @@ -72,15 +84,15 @@ SELECT * FROM tbl_a; --connection child2_1 --disable_view_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey, val FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey, val FROM tbl_a ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test index e4fd021d799..1f7914e030c 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20100.test @@ -23,7 +23,24 @@ USE auto_test_remote; --disable_query_log echo CHILD2_1_CREATE_TABLES; --disable_ps_protocol -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE ta_r2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r3 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r4 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_ps_protocol --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -36,12 +53,16 @@ echo CREATE TABLE tbl_a ( c DATETIME, PRIMARY KEY(a) ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +) ENGINE=Spider PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"', +PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"', +PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"' + ); --enable_query_log INSERT INTO tbl_a (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -79,10 +100,13 @@ SELECT a, b, c FROM tbl_a PARTITION (pt2,pt3); --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_ps2_protocol --disable_ps_protocol -eval $CHILD2_1_SELECT_TABLES; +eval +SELECT a, b, c FROM ta_r2 ORDER BY a $STR_SEMICOLON +SELECT a, b, c FROM ta_r3 ORDER BY a $STR_SEMICOLON +SELECT a, b, c FROM ta_r4 ORDER BY a; --enable_ps_protocol --enable_view_protocol diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test index 574a13c8e86..77b1f47abf7 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_20502.test @@ -22,7 +22,11 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +id int(10) unsigned NOT NULL AUTO_INCREMENT, +val int(10) unsigned DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -33,11 +37,11 @@ echo CREATE TABLE tbl_a ( val int(10) unsigned DEFAULT NULL, PRIMARY KEY(id) ) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( id int(10) unsigned NOT NULL AUTO_INCREMENT, val int(10) unsigned DEFAULT NULL, PRIMARY KEY(id) -) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1; +) ENGINE=Spider COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (val) VALUES (1); @@ -64,9 +68,9 @@ FROM tbl_a GROUP BY val; --connection child2_1 --disable_view_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT id, val FROM tbl_a ORDER BY id; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test index 3b742e37655..d2daf522774 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_21884.test @@ -23,7 +23,18 @@ USE auto_test_remote; --disable_query_log echo CHILD2_1_CREATE_TABLES; --disable_ps_protocol -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE ta_r2 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a,b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r3 ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a,b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_ps_protocol --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -36,24 +47,29 @@ echo CREATE TABLE tbl_a ( c DATETIME, PRIMARY KEY(a,b) ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a,b) -) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r2", + priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", priority "1000001"' + ); echo CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tbl_a (a, b, c) VALUES (11, 'a', '2008-08-01 10:21:39'), @@ -83,10 +99,12 @@ SELECT STRAIGHT_JOIN b.a, b.b FROM tb_l a, tbl_a b WHERE a.a = b.a; SET NAMES utf8; --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_ps2_protocol --disable_ps_protocol -eval $CHILD2_1_SELECT_TABLES; +eval +SELECT a, b, c FROM ta_r2 ORDER BY a $STR_SEMICOLON +SELECT a, b, c FROM ta_r3 ORDER BY a; --enable_ps_protocol --enable_view_protocol diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test index 9e58bc1a836..b23aa0b91ed 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_22246.test @@ -27,14 +27,22 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +id bigint NOT NULL, +node text, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_a ( +id bigint NOT NULL, +node text, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -45,11 +53,15 @@ echo CREATE TABLE tbl_a ( node text, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( id bigint NOT NULL, node text, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' + PARTITION BY HASH(id) ( +PARTITION pt1 COMMENT='srv "s_2_1"', +PARTITION pt2 COMMENT='srv "s_2_2"' + ); --enable_query_log INSERT INTO tbl_a (id,node) VALUES (1,'DB-G0'),(2,'DB-G1'); @@ -67,10 +79,10 @@ SELECT * FROM tbl_a; SELECT * FROM tbl_a WHERE id <0 || id >0; --connection child2_1 -eval $CHILD2_1_SELECT_TABLES; +SELECT * FROM tbl_a ORDER BY id; --connection child2_2 -eval $CHILD2_2_SELECT_TABLES; +SELECT * FROM tbl_a ORDER BY id; --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test index ac06d86052b..153dd2a0ae3 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24020.test @@ -21,7 +21,21 @@ USE auto_test_remote; --disable_query_log --disable_ps_protocol echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE ta_r2 ( +a INT, +b VARCHAR(30), +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r3 ( +a INT, +b VARCHAR(30), +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r4 ( +a INT, +b VARCHAR(30), +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_ps_protocol --enable_query_log @@ -32,11 +46,15 @@ echo CREATE TABLE tbl_a ( b VARCHAR(30), PRIMARY KEY(a) ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( a INT, b VARCHAR(30), PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +) ENGINE=Spider PARTITION BY LIST(a % 3) ( +PARTITION pt1 VALUES IN (0) COMMENT='srv "s_2_1", table "ta_r2"', +PARTITION pt2 VALUES IN (1) COMMENT='srv "s_2_1", table "ta_r3"', +PARTITION pt3 VALUES IN (2) COMMENT='srv "s_2_1", table "ta_r4"' + ); --enable_query_log INSERT INTO tbl_a VALUES(10000, " abcd "); INSERT INTO tbl_a VALUES(10001, " abcd "); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test index 21b9dda4f12..aa00233f1f3 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24517.test @@ -23,7 +23,21 @@ USE auto_test_remote; --disable_query_log --disable_ps_protocol echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE ta_r2 ( +i INT, +j JSON, +PRIMARY KEY(i) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r3 ( +i INT, +j JSON, +PRIMARY KEY(i) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r4 ( +i INT, +j JSON, +PRIMARY KEY(i) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_ps_protocol --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -35,11 +49,15 @@ echo CREATE TABLE tbl_a ( j JSON, PRIMARY KEY(i) ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( i INT, j JSON, PRIMARY KEY(i) -) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +) ENGINE=Spider PARTITION BY RANGE(i) ( +PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"', +PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"', +PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"' + ); --enable_query_log INSERT INTO tbl_a (i, j) VALUES (1, '{"ID": "3", "Name": "Barney", "Age": 18}'), diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_24523.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_24523.test index 00c0c873f20..77af6d12e14 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_24523.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_24523.test @@ -21,7 +21,21 @@ USE auto_test_remote; --disable_query_log --disable_ps_protocol echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE ta_r2 ( +i INT, +j JSON, +PRIMARY KEY(i) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r3 ( +i INT, +j JSON, +PRIMARY KEY(i) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE ta_r4 ( +i INT, +j JSON, +PRIMARY KEY(i) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_ps_protocol --enable_query_log @@ -32,11 +46,15 @@ echo CREATE TABLE tbl_a ( j JSON, PRIMARY KEY(i) ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( i INT, j JSON, PRIMARY KEY(i) -) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; +) ENGINE=Spider PARTITION BY RANGE(i) ( +PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1", table "ta_r2"', +PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_1", table "ta_r3"', +PARTITION pt3 VALUES LESS THAN MAXVALUE COMMENT='srv "s_2_1", table "ta_r4"' + ); --enable_query_log INSERT INTO tbl_a VALUES (1, '{ "a": 1, "b": [2, 3]}'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test index 23bfcb065db..0ad9d3b9aa5 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test +++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_0.test @@ -27,14 +27,20 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -48,14 +54,14 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_2"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -80,19 +86,19 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; +set session spider_quick_page_byte= 6; --echo --echo select test 2 @@ -109,19 +115,19 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; +set session spider_quick_page_byte= 0; --echo --echo select test 3 @@ -138,16 +144,16 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ --disable_view_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ --disable_view_protocol -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test index dd56ca135f0..773fd3a7856 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test +++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_1.test @@ -27,14 +27,20 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -48,14 +54,14 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_2"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -80,19 +86,19 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; +set session spider_quick_page_byte= 6; --echo --echo select test 2 @@ -109,19 +115,19 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; +set session spider_quick_page_byte= 0; --echo --echo select test 3 @@ -138,16 +144,16 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test index cedc4b60449..b7402fc23d2 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test +++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_2.test @@ -27,14 +27,20 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -48,14 +54,14 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_2"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -80,19 +86,19 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; +set session spider_quick_page_byte= 6; --echo --echo select test 2 @@ -109,19 +115,19 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; +set session spider_quick_page_byte= 0; --echo --echo select test 3 @@ -138,16 +144,16 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test index db3a6118743..c81a74889a2 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test +++ b/storage/spider/mysql-test/spider/bugfix/t/quick_mode_3.test @@ -28,14 +28,20 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -49,14 +55,14 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_2"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -81,19 +87,19 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; +set session spider_quick_page_byte= 6; --echo --echo select test 2 @@ -110,19 +116,19 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; +set session spider_quick_page_byte= 0; --echo --echo select test 3 @@ -139,16 +145,16 @@ SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; --connection child2_1 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test index 2921d74b1cc..e9e8ef3b82b 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test +++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_insert.test @@ -22,7 +22,12 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +skey int NOT NULL, +dt date NOT NULL, +tm time NOT NULL, +PRIMARY KEY (skey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -34,12 +39,12 @@ echo CREATE TABLE tbl_a ( tm time NOT NULL, PRIMARY KEY (skey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( skey int NOT NULL, dt date NOT NULL, tm time NOT NULL, PRIMARY KEY (skey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00'); FLUSH TABLES; @@ -58,10 +63,10 @@ exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK - --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND (argument LIKE '%insert %' OR argument LIKE '%replace %'); --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT skey, dt, tm FROM tbl_a ORDER BY skey; TRUNCATE TABLE mysql.general_log; @@ -73,10 +78,10 @@ exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK - --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND (argument LIKE '%insert %' OR argument LIKE '%replace %'); --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT skey, dt, tm FROM tbl_a ORDER BY skey; TRUNCATE TABLE mysql.general_log; @@ -88,10 +93,10 @@ exec $MYSQL -v -v -u root -h localhost -P $MASTER_1_MYPORT -S $MASTER_1_MYSOCK - --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND (argument LIKE '%insert %' OR argument LIKE '%replace %'); --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT skey, dt, tm FROM tbl_a ORDER BY skey; --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test index 64aa4d7593e..f9f55eba74f 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test +++ b/storage/spider/mysql-test/spider/bugfix/t/return_found_rows_update.test @@ -22,7 +22,12 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +skey int NOT NULL, +dt date NOT NULL, +tm time NOT NULL, +KEY idx1 (skey,dt) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -34,12 +39,12 @@ echo CREATE TABLE tbl_a ( tm time NOT NULL, KEY idx1 (skey,dt) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( skey int NOT NULL, dt date NOT NULL, tm time NOT NULL, KEY idx1 (skey,dt) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2012-01-01', '12:00:00'),(1, '2012-02-01', '12:00:00'),(2, '2012-03-01', '12:00:00'),(3, '2012-04-01', '12:00:00'),(4, '2012-05-01', '12:00:00'),(5, '2012-06-01', '12:00:00'),(6, '2012-07-01', '12:00:00'),(7, '2012-08-01', '12:00:00'),(8, '2012-09-01', '12:00:00'),(9, '2012-10-01', '12:00:00'); INSERT INTO tbl_a (skey, dt, tm) VALUES (0, '2013-01-01', '13:00:00'),(1, '2013-02-01', '13:00:00'),(2, '2013-03-01', '13:00:00'),(3, '2013-04-01', '13:00:00'),(4, '2013-05-01', '13:00:00'),(5, '2013-06-01', '13:00:00'),(6, '2013-07-01', '13:00:00'),(7, '2013-08-01', '13:00:00'),(8, '2013-09-01', '13:00:00'),(9, '2013-10-01', '13:00:00'); @@ -60,10 +65,10 @@ exec $MYSQL -v -v -u root -h localhost --default-character-set=latin1 -P $MASTER --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT skey, dt, tm FROM tbl_a ORDER BY skey; --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test index dfe8b9ec2ef..1ce9c52b745 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test +++ b/storage/spider/mysql-test/spider/bugfix/t/select_by_null.test @@ -22,7 +22,10 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -32,10 +35,10 @@ echo CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -54,10 +57,10 @@ SELECT pkey FROM tbl_a WHERE NULL; --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test index 53daaf06f68..fe7ffc6186a 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test +++ b/storage/spider/mysql-test/spider/bugfix/t/select_with_backquote.test @@ -22,7 +22,11 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +txt_utf8 char(8) NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARACTER SET utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -33,11 +37,11 @@ echo CREATE TABLE tbl_a ( txt_utf8 char(8) NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, txt_utf8 char(8) NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE DEFAULT CHARACTER SET utf8 $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARACTER SET utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (pkey,txt_utf8) VALUES (0,'01234567'),(1,'12345678'),(2,'23456789'),(3,'34567890'),(4,'45678901'),(5,'56789012'),(6,'67890123'),(7,'78901234'),(8,'89012345'),(9,'90123456'); FLUSH TABLES; @@ -56,9 +60,9 @@ SELECT `pkey`, LEFT(`txt_utf8`, 4) FROM `auto_test_local`.`tbl_a` ORDER BY LEFT( --connection child2_1 SET NAMES utf8; --disable_view_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey, txt_utf8 FROM tbl_a ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test b/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test index 66e044a5a5c..f5ba9737e13 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test +++ b/storage/spider/mysql-test/spider/bugfix/t/slave_trx_isolation.test @@ -23,7 +23,10 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -40,10 +43,10 @@ echo CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log SET SESSION sql_log_bin= 1; @@ -53,10 +56,10 @@ echo CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log --connection master_1 @@ -74,10 +77,10 @@ SET SESSION sql_log_bin= 0; --disable_view_protocol --disable_ps2_protocol --replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/ -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%set %'; --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection slave1_1 SELECT pkey FROM tbl_a ORDER BY pkey; diff --git a/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test b/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test index bc9ee2a6833..57dbc731193 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test +++ b/storage/spider/mysql-test/spider/bugfix/t/strict_group_by.test @@ -27,14 +27,24 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +skey int NOT NULL, +PRIMARY KEY (pkey), +KEY idx1 (skey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +skey int NOT NULL, +PRIMARY KEY (pkey), +KEY idx1 (skey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -46,12 +56,16 @@ echo CREATE TABLE tbl_a ( PRIMARY KEY (pkey), KEY idx1 (skey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, skey int NOT NULL, PRIMARY KEY (pkey), KEY idx1 (skey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' + PARTITION BY KEY(pkey) ( +PARTITION pt1 COMMENT='srv "s_2_1"', +PARTITION pt2 COMMENT='srv "s_2_2"' + ); --enable_query_log INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19); @@ -80,18 +94,18 @@ set spider_direct_aggregate=@old_spider_direct_aggregate; --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey, skey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey, skey FROM tbl_a ORDER BY pkey; --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test index 72502b64f78..b705fb9b2bc 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test +++ b/storage/spider/mysql-test/spider/bugfix/t/wrapper_mariadb.test @@ -22,7 +22,10 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -32,10 +35,10 @@ echo CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1", wrapper "mariadb"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); @@ -53,9 +56,9 @@ SELECT * FROM tbl_a ORDER BY pkey; --connection child2_1 --disable_view_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test index 690fe3e5b50..ec3893b18a8 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test +++ b/storage/spider/mysql-test/spider/bugfix/t/xa_cmd.test @@ -22,7 +22,10 @@ USE auto_test_remote; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -32,10 +35,10 @@ echo CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log --connection child2_1 @@ -51,10 +54,10 @@ XA COMMIT 'test'; --connection child2_1 --disable_view_protocol --disable_ps2_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; --enable_ps2_protocol --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --echo --echo deinit diff --git a/storage/spider/mysql-test/spider/feature/my_1_1.cnf b/storage/spider/mysql-test/spider/feature/my_1_1.cnf index 5f17295d895..be960747491 100644 --- a/storage/spider/mysql-test/spider/feature/my_1_1.cnf +++ b/storage/spider/mysql-test/spider/feature/my_1_1.cnf @@ -26,7 +26,6 @@ MASTER_1_HSRPORT= 20000 MASTER_1_HSWPORT= 20001 MASTER_1_MYSOCK= @mysqld.1.1.socket MASTER_1_ENGINE_TYPE= Spider -#MASTER_1_ENGINE_TYPE= MyISAM MASTER_1_ENGINE= ENGINE=Spider MASTER_1_CHARSET= DEFAULT CHARSET=utf8 MASTER_1_ENGINE2= ENGINE=MyISAM @@ -34,11 +33,3 @@ MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/feature/my_2_1.cnf b/storage/spider/mysql-test/spider/feature/my_2_1.cnf index 24161645607..adc955ee0d9 100644 --- a/storage/spider/mysql-test/spider/feature/my_2_1.cnf +++ b/storage/spider/mysql-test/spider/feature/my_2_1.cnf @@ -34,23 +34,3 @@ CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket CHILD2_1_GM_ENGINE_TYPE= MyISAM CHILD2_1_GM_ENGINE= ENGINE=MyISAM CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/feature/my_2_2.cnf b/storage/spider/mysql-test/spider/feature/my_2_2.cnf index 2d3c2a89a7d..557b02e8e0a 100644 --- a/storage/spider/mysql-test/spider/feature/my_2_2.cnf +++ b/storage/spider/mysql-test/spider/feature/my_2_2.cnf @@ -31,8 +31,3 @@ CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket CHILD2_2_GM_ENGINE_TYPE= MyISAM CHILD2_2_GM_ENGINE= ENGINE=MyISAM CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_2_DROP_TABLES -# CHILD2_2_CREATE_TABLES -# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/include/deinit_slave1_1.inc b/storage/spider/mysql-test/spider/include/deinit_slave1_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child2_1.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child2_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child2_2.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child2_2.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_child2_3.inc b/storage/spider/mysql-test/spider/include/ha_deinit_child2_3.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/include/ha_deinit_master_1.inc b/storage/spider/mysql-test/spider/include/ha_deinit_master_1.inc deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc deleted file mode 100644 index 2684829408d..00000000000 --- a/storage/spider/mysql-test/spider/include/ha_init_child2_1.inc +++ /dev/null @@ -1,8 +0,0 @@ -let $CHILD2_1_HA_AS_DROP_TABLES= - $CHILD2_1_DROP_TABLES; -let $CHILD2_1_HA_AS_CREATE_TABLES= - $CHILD2_1_CREATE_TABLES; -let $CHILD2_1_HA_AS_DROP_TABLES2= - $CHILD2_1_DROP_TABLES2; -let $CHILD2_1_HA_AS_CREATE_TABLES2= - $CHILD2_1_CREATE_TABLES2; diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc deleted file mode 100644 index 205eaa6fe35..00000000000 --- a/storage/spider/mysql-test/spider/include/ha_init_child2_2.inc +++ /dev/null @@ -1,4 +0,0 @@ -let $CHILD2_2_HA_DROP_TABLES= - $CHILD2_2_DROP_TABLES; -let $CHILD2_2_HA_CREATE_TABLES= - $CHILD2_2_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc b/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc deleted file mode 100644 index 55cb858372c..00000000000 --- a/storage/spider/mysql-test/spider/include/ha_init_child2_3.inc +++ /dev/null @@ -1,4 +0,0 @@ -let $CHILD2_3_HA_DROP_TABLES= - $CHILD2_3_DROP_TABLES; -let $CHILD2_3_HA_CREATE_TABLES= - $CHILD2_3_CREATE_TABLES; diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc index 8357f0bdbc2..adf6a04101d 100644 --- a/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc +++ b/storage/spider/mysql-test/spider/include/ha_init_child3_1.inc @@ -11,130 +11,3 @@ eval INSERT INTO mysql.spider_link_mon_servers NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_1_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_1_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_1_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_1_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_1_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_1_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_1_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_1_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_1_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_1_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_1_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_1_ENGINE $CHILD3_1_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_1_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_1_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_1_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc index 3ffcec24f51..0d2c1f9de5b 100644 --- a/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc +++ b/storage/spider/mysql-test/spider/include/ha_init_child3_2.inc @@ -11,130 +11,3 @@ eval INSERT INTO mysql.spider_link_mon_servers NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_2_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_2_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_2_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_2_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_2_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_2_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_2_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_2_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_2_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_2_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_2_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_2_ENGINE $CHILD3_2_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_2_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_2_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_2_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc b/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc index 67bd00109f5..e5fd7d1dd69 100644 --- a/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc +++ b/storage/spider/mysql-test/spider/include/ha_init_child3_3.inc @@ -11,130 +11,3 @@ eval INSERT INTO mysql.spider_link_mon_servers NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $CHILD3_3_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $CHILD3_3_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $CHILD3_3_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $CHILD3_3_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $CHILD3_3_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; - -let $CHILD3_3_DROP_TABLES_HA_2_1= - DROP TABLE IF EXISTS ta_l; -if ($VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_3_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $CHILD3_3_CREATE_TABLES_HA_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $CHILD3_3_CREATE_TABLES_HA_AS_2_1= - CREATE TABLE ta_l ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $CHILD3_3_DROP_TABLES_HA_P_2_1= - DROP TABLE IF EXISTS ta_l2; -let $CHILD3_3_CREATE_TABLES_HA_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1= - CREATE TABLE ta_l2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD3_3_ENGINE $CHILD3_3_CHARSET - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $CHILD3_3_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $CHILD3_3_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $CHILD3_3_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); diff --git a/storage/spider/mysql-test/spider/include/ha_init_master_1.inc b/storage/spider/mysql-test/spider/include/ha_init_master_1.inc index 78797d80ce7..46a47f916f0 100644 --- a/storage/spider/mysql-test/spider/include/ha_init_master_1.inc +++ b/storage/spider/mysql-test/spider/include/ha_init_master_1.inc @@ -8,98 +8,3 @@ eval INSERT INTO mysql.spider_link_mon_servers NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL), ('%auto_test_local%', '%ta_l%', '%', $CHILD3_3_SERVER_ID, 's_3_3', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL); -let $MASTER_1_CHECK_LINK_STATUS= - SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables - ORDER BY db_name, table_name, link_id; -let $MASTER_1_CHECK_LINK_FAILED_LOG= - SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; -let $MASTER_1_SET_RECOVERY_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 2"'; -let $MASTER_1_SET_OK_STATUS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2", lst "0 1"'; -let $MASTER_1_SET_OK_STATUS_AS_2_1= - ALTER TABLE ta_l - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2", lst "1 0"'; -let $MASTER_1_COPY_TABLES_2_1= - SELECT spider_copy_tables('ta_l', '0', '1'); - -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_HA_2_1= - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='port "$CHILD2_1_MYPORT $CHILD2_2_MYPORT", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_HA_2_1= - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", - database "auto_test_remote auto_test_remote2"'; - let $MASTER_1_COMMENT_HA_AS_2_1= - COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' - CONNECTION='host "localhost", user "root", password "", - msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1", - database "auto_test_remote auto_test_remote2"'; -} -let $MASTER_1_COMMENT_HA_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $MASTER_1_COMMENT_HA_AS_P_2_1= - COMMENT='msi "$CHILD3_1_SERVER_ID", mkd "2", alc "1"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001"' - ); -let $MASTER_1_SET_RECOVERY_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 2"' - ); -let $MASTER_1_SET_OK_STATUS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "0 1"' - ); -let $MASTER_1_SET_OK_STATUS_AS_P_2_1= - ALTER TABLE ta_l2 - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", - priority "1000001", lst "1 0"' - ); -let $MASTER_1_COPY_TABLES_P_2_1= - SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); -let $MASTER_1_CHECK_HA_STATUS= - SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; -let $MASTER_1_CHANGE_HA_MON= - SELECT spider_flush_table_mon_cache(); diff --git a/storage/spider/mysql-test/spider/include/init_child2_1.inc b/storage/spider/mysql-test/spider/include/init_child2_1.inc index 782f538eb43..abc64df3c08 100644 --- a/storage/spider/mysql-test/spider/include/init_child2_1.inc +++ b/storage/spider/mysql-test/spider/include/init_child2_1.inc @@ -1,192 +1,3 @@ --let $TEST_ENGINE_TYPE= $CHILD2_1_ENGINE_TYPE --source ../include/init_engine.inc --let $INIT_CHILD2_1_ENGINE= $INIT_TEST_ENGINE -let $CHILD2_1_DROP_TABLES= - DROP TABLE IF EXISTS ta_r; -let $CHILD2_1_CREATE_TABLES= - CREATE TABLE ta_r ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a), - KEY idx1(b) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; -let $CHILD2_1_DROP_TABLES2= - DROP TABLE IF EXISTS ta_r2; -let $CHILD2_1_CREATE_TABLES2= - CREATE TABLE ta_r2 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES2= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; -let $CHILD2_1_DROP_TABLES3= - DROP TABLE IF EXISTS ta_r_no_idx; -let $CHILD2_1_CREATE_TABLES3= - CREATE TABLE ta_r_no_idx ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10' - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES3= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a; -let $CHILD2_1_DROP_TABLES4= - DROP TABLE IF EXISTS ta_r_auto_inc; -let $CHILD2_1_CREATE_TABLES4= - CREATE TABLE ta_r_auto_inc ( - a INT AUTO_INCREMENT, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES4= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc - ORDER BY a; -let $CHILD2_1_DROP_TABLES5= - DROP TABLE IF EXISTS ta_r_int; -let $CHILD2_1_CREATE_TABLES5= - CREATE TABLE ta_r_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES5= - SELECT a, b, c FROM ta_r_int ORDER BY a; -let $CHILD2_1_DROP_TABLES6= - DROP TABLE IF EXISTS ta_r_3; -let $CHILD2_1_CREATE_TABLES6= - CREATE TABLE ta_r_3 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10' - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES6= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_3 ORDER BY a; -let $CHILD2_1_DROP_TABLES7= - DROP TABLE IF EXISTS ta_ob; -let $CHILD2_1_CREATE_TABLES7= - CREATE TABLE ta_ob ( - a VARCHAR(50) NOT NULL, - b VARCHAR(50) NULL DEFAULT NULL, - c VARCHAR(100) NULL DEFAULT NULL, - d DATETIME(0) NULL DEFAULT NULL, - e INT(11) NOT NULL, - f INT(10) NULL DEFAULT NULL, - PRIMARY KEY (a, e) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TABLES7= - SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 6 OFFSET 0; -let $CHILD2_1_DROP_FT_TABLES= - DROP TABLE IF EXISTS ft_r; -let $CHILD2_1_CREATE_FT_TABLES= - CREATE TABLE ft_r ( - a INT DEFAULT 0, - b TEXT, - c TEXT, - d TEXT, - PRIMARY KEY(a), - FULLTEXT INDEX ft_idx1(b), - FULLTEXT INDEX ft_idx2(c) - ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET; -let $CHILD2_1_SELECT_FT_TABLES= - SELECT a, b, c, d FROM ft_r ORDER BY a; -let $CHILD2_1_DROP_FT_TABLES2= - DROP TABLE IF EXISTS ft_r2; -let $CHILD2_1_CREATE_FT_TABLES2= - CREATE TABLE ft_r2 ( - a INT DEFAULT 0, - b TEXT, - c TEXT, - d TEXT, - PRIMARY KEY(a), - FULLTEXT INDEX ft_idx1(b), - FULLTEXT INDEX ft_idx2(c) - ) $CHILD2_1_FT_ENGINE $CHILD2_1_FT_CHARSET; -let $CHILD2_1_SELECT_FT_TABLES2= - SELECT a, b, c, d FROM ft_r2 ORDER BY a; -let $CHILD2_1_DROP_GM_TABLES= - DROP TABLE IF EXISTS gm_r; -let $CHILD2_1_CREATE_GM_TABLES= - CREATE TABLE gm_r ( - a INT DEFAULT 0, - b GEOMETRY NOT NULL, - c GEOMETRY NOT NULL, - PRIMARY KEY(a), - SPATIAL INDEX sp_idx1(b), - SPATIAL INDEX sp_idx2(c) - ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET; -let $CHILD2_1_SELECT_GM_TABLES= - SELECT a, b, c FROM gm_r ORDER BY a; -let $CHILD2_1_DROP_GM_TABLES2= - DROP TABLE IF EXISTS gm_r2; -let $CHILD2_1_CREATE_GM_TABLES2= - CREATE TABLE gm_r2 ( - a INT DEFAULT 0, - b GEOMETRY NOT NULL, - c GEOMETRY NOT NULL, - PRIMARY KEY(a), - SPATIAL INDEX sp_idx1(b), - SPATIAL INDEX sp_idx2(c) - ) $CHILD2_1_GM_ENGINE $CHILD2_1_GM_CHARSET; -let $CHILD2_1_SELECT_GM_TABLES2= - SELECT a, b, c FROM gm_r2 ORDER BY a; -let $CHILD2_1_DROP_LOCK_TABLES1= - DROP TABLE IF EXISTS t1_1; -let $CHILD2_1_CREATE_LOCK_TABLES1= - CREATE TABLE t1_1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_DROP_LOCK_TABLES2= - DROP TABLE IF EXISTS t2_2; -let $CHILD2_1_CREATE_LOCK_TABLES2= - CREATE TABLE t2_2 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_DROP_INCREMENT_TABLES1= - DROP TABLE IF EXISTS t1_1; -let $CHILD2_1_CREATE_INCREMENT_TABLES1= - CREATE TABLE t1_1 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_INCREMENT_TABLES1= - SELECT id FROM t1_1 ORDER BY id; -let $CHILD2_1_DROP_TEXT_PK_TABLES1= - DROP TABLE IF EXISTS t1; -let $CHILD2_1_CREATE_TEXT_PK_TABLES1= - CREATE TABLE t1 ( - a VARCHAR(255), - PRIMARY KEY (a) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET2; -let $CHILD2_1_SELECT_TEXT_PK_TABLES1= - SELECT a FROM t1 ORDER BY a; -let $CHILD2_1_DROP_TEXT_KEY_TABLES1= - DROP TABLE IF EXISTS t1; -let $CHILD2_1_CREATE_TEXT_KEY_TABLES1= - CREATE TABLE t1 ( - a VARCHAR(255), - b VARCHAR(255), - c VARCHAR(255), - KEY idx1(a,b), - KEY idx2(b), - PRIMARY KEY(c) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; -let $CHILD2_1_SELECT_TEXT_KEY_TABLES1= - SELECT a, b FROM t1 ORDER BY a, b; -let $CHILD2_1_AUTO_INCREMENT_INCREMENT1= - SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; -let $CHILD2_1_AUTO_INCREMENT_INCREMENT2= - SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; -let $CHILD2_1_AUTO_INCREMENT_OFFSET1= - SET GLOBAL AUTO_INCREMENT_OFFSET = 1; -let $CHILD2_1_AUTO_INCREMENT_OFFSET2= - SET GLOBAL AUTO_INCREMENT_OFFSET = 2; diff --git a/storage/spider/mysql-test/spider/include/init_child2_2.inc b/storage/spider/mysql-test/spider/include/init_child2_2.inc index 5d7227e43ad..ac8a1452c65 100644 --- a/storage/spider/mysql-test/spider/include/init_child2_2.inc +++ b/storage/spider/mysql-test/spider/include/init_child2_2.inc @@ -1,83 +1,3 @@ --let $TEST_ENGINE_TYPE= $CHILD2_2_ENGINE_TYPE --source ../include/init_engine.inc --let $INIT_CHILD2_2_ENGINE= $INIT_TEST_ENGINE -let $CHILD2_2_DROP_TABLES= - DROP TABLE IF EXISTS ta_r3; -let $CHILD2_2_CREATE_TABLES= - CREATE TABLE ta_r3 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_DROP_TABLES5= - DROP TABLE IF EXISTS ta_r_int; -let $CHILD2_2_CREATE_TABLES5= - CREATE TABLE ta_r_int ( - a INT AUTO_INCREMENT, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_SELECT_TABLES= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; -let $CHILD2_2_DROP_FT_TABLES= - DROP TABLE IF EXISTS ft_r3; -let $CHILD2_2_CREATE_FT_TABLES= - CREATE TABLE ft_r3 ( - a INT DEFAULT 0, - b TEXT, - c TEXT, - d TEXT, - PRIMARY KEY(a), - FULLTEXT INDEX ft_idx1(b), - FULLTEXT INDEX ft_idx2(c) - ) $CHILD2_2_FT_ENGINE $CHILD2_2_FT_CHARSET; -let $CHILD2_2_SELECT_FT_TABLES= - SELECT a, b, c, d FROM ft_r3 ORDER BY a; -let $CHILD2_2_DROP_GM_TABLES= - DROP TABLE IF EXISTS gm_r3; -let $CHILD2_2_CREATE_GM_TABLES= - CREATE TABLE gm_r3 ( - a INT DEFAULT 0, - b GEOMETRY NOT NULL, - c GEOMETRY NOT NULL, - PRIMARY KEY(a), - SPATIAL INDEX sp_idx1(b), - SPATIAL INDEX sp_idx2(c) - ) $CHILD2_2_GM_ENGINE $CHILD2_2_GM_CHARSET; -let $CHILD2_2_SELECT_GM_TABLES= - SELECT a, b, c FROM gm_r3 ORDER BY a; -let $CHILD2_2_DROP_LOCK_TABLES1= - DROP TABLE IF EXISTS t1_2; -let $CHILD2_2_CREATE_LOCK_TABLES1= - CREATE TABLE t1_2 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_DROP_LOCK_TABLES2= - DROP TABLE IF EXISTS t2_1; -let $CHILD2_2_CREATE_LOCK_TABLES2= - CREATE TABLE t2_1 ( - id int(11) NOT NULL, - PRIMARY KEY (id) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_DROP_INCREMENT_TABLES1= - DROP TABLE IF EXISTS t1_2; -let $CHILD2_2_CREATE_INCREMENT_TABLES1= - CREATE TABLE t1_2 ( - id int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (id) - ) $CHILD2_2_ENGINE $CHILD2_2_CHARSET; -let $CHILD2_2_SELECT_INCREMENT_TABLES1= - SELECT id FROM t1_2 ORDER BY id; -let $CHILD2_2_AUTO_INCREMENT_INCREMENT1= - SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; -let $CHILD2_2_AUTO_INCREMENT_INCREMENT2= - SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; -let $CHILD2_2_AUTO_INCREMENT_OFFSET1= - SET GLOBAL AUTO_INCREMENT_OFFSET = 1; -let $CHILD2_2_AUTO_INCREMENT_OFFSET2= - SET GLOBAL AUTO_INCREMENT_OFFSET = 3; diff --git a/storage/spider/mysql-test/spider/include/init_child2_3.inc b/storage/spider/mysql-test/spider/include/init_child2_3.inc index 0ae240626fe..af0b42e2915 100644 --- a/storage/spider/mysql-test/spider/include/init_child2_3.inc +++ b/storage/spider/mysql-test/spider/include/init_child2_3.inc @@ -1,14 +1,3 @@ --let $TEST_ENGINE_TYPE= $CHILD2_3_ENGINE_TYPE --source ../include/init_engine.inc --let $INIT_CHILD2_3_ENGINE= $INIT_TEST_ENGINE -let $CHILD2_3_DROP_TABLES= - DROP TABLE IF EXISTS ta_r4; -let $CHILD2_3_CREATE_TABLES= - CREATE TABLE ta_r4 ( - a INT DEFAULT 10, - b CHAR(1) DEFAULT 'c', - c DATETIME DEFAULT '1999-10-10 10:10:10', - PRIMARY KEY(a) - ) $CHILD2_3_ENGINE $CHILD2_3_CHARSET; -let $CHILD2_3_SELECT_TABLES= - SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; diff --git a/storage/spider/mysql-test/spider/include/init_master_1.inc b/storage/spider/mysql-test/spider/include/init_master_1.inc index 460142b9c7d..b955119a268 100644 --- a/storage/spider/mysql-test/spider/include/init_master_1.inc +++ b/storage/spider/mysql-test/spider/include/init_master_1.inc @@ -1,195 +1,3 @@ --source ../include/init_spider.inc SET spider_direct_order_limit= 10000; SET spider_init_sql_alloc_size= 1; -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_2_1= - COMMENT='database "auto_test_remote", table "ta_r"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_2_1= - COMMENT='database "auto_test_remote", table "ta_r"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT2_2_1= - COMMENT='database "auto_test_remote", table "ta_r_no_idx"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password "", prt "2000000"'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT2_2_1= - COMMENT='database "auto_test_remote", table "ta_r_no_idx"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password "", prt "2000000"'; -} -let $MASTER_1_COMMENT_P_2_1= - COMMENT='table "ta_r3"' - PARTITION BY KEY(a) ( - PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2", - priority "1000"', - PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001"' - ); -let $MASTER_1_COMMENT2_P_2_1= - COMMENT='table "ta_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "ta_r2", priority "1000"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001"' - ); -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT3_2_1= - COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT3_2_1= - COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -let $MASTER_1_COMMENT3_P_2_1= - COMMENT='table "ta_r_int"' - PARTITION BY LIST(MOD(a, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='srv "s_2_1", priority "1000"', - PARTITION pt2 VALUES IN (1) - COMMENT='srv "s_2_2", priority "1000001"' - ); -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT4_2_1= - COMMENT='database "auto_test_remote", table "ta_r_int"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT4_2_1= - COMMENT='database "auto_test_remote", table "ta_r_int"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT5_2_1= - COMMENT='database "auto_test_remote", table "ta_r_3"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT5_2_1= - COMMENT='database "auto_test_remote", table "ta_r_3"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -let $MASTER_1_COMMENT6_P_1_1= - COMMENT='database "auto_test_remote", table "ta_ob"' - PARTITION BY LIST COLUMNS (e) PARTITIONS 1 - (PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"'); -if ($VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_FT_2_1= - COMMENT='database "auto_test_remote", table "ft_r"' - CONNECTION='host "localhost", port "$CHILD2_1_MYPORT", user "root", - password ""'; -} -if (!$VERSION_COMPILE_OS_WIN) -{ - let $MASTER_1_COMMENT_FT_2_1= - COMMENT='database "auto_test_remote", table "ft_r"' - CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", - password ""'; -} -let $MASTER_1_COMMENT2_FT_P_2_1= - COMMENT='table "ft_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "ft_r2", priority "1000"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001"' - ); -let $MASTER_1_COMMENT_GM_2_1= - COMMENT='srv "s_2_1", table "gm_r"'; -let $MASTER_1_COMMENT2_GM_P_2_1= - COMMENT='table "gm_r3"' - PARTITION BY RANGE(a) ( - PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", - table "gm_r2", priority "1000"', - PARTITION pt2 VALUES LESS THAN MAXVALUE - COMMENT='srv "s_2_2", priority "1000001"' - ); -let $MASTER_1_COMMENT_LOCK1= - COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2"'; -let $MASTER_1_COMMENT_LOCK2= - COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1"'; -let $MASTER_1_COMMENT_INCREMENT1_1= - COMMENT 'aim "0", tbl "t1_1", srv "s_2_1"'; -let $MASTER_1_COMMENT_INCREMENT1_P_1= - COMMENT 'aim "0"' - PARTITION BY LIST(MOD(id, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='tbl "t1_1", srv "s_2_1"', - PARTITION pt2 VALUES IN (1) - COMMENT='tbl "t1_2", srv "s_2_2"' - ); -let $MASTER_1_COMMENT_READONLY1_1= - COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1"'; -let $MASTER_1_COMMENT_ERROR_MODE1_1= - COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1"'; -let $MASTER_1_COMMENT_TEXT_PK1_1= - COMMENT 'tbl "t1", srv "s_2_1"'; -let $MASTER_1_COMMENT_TEXT_KEY1_1= - COMMENT 'tbl "t1", srv "s_2_1"'; -let $MASTER_1_COMMENT_MDEV_25985= - COMMENT='table "t1"' - PARTITION BY LIST COLUMNS(`a`) ( - PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' - ); -let $MASTER_1_CHECK_DIRECT_UPDATE_STATUS= - SHOW STATUS LIKE 'Spider_direct_update'; -let $MASTER_1_CHECK_DIRECT_DELETE_STATUS= - SHOW STATUS LIKE 'Spider_direct_delete'; -let $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS= - SHOW STATUS LIKE 'Spider_direct_order_limit'; -let $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS= - SHOW STATUS LIKE 'Spider_direct_aggregate'; -let $MASTER_1_AUTO_INCREMENT_INCREMENT1= - SET SESSION AUTO_INCREMENT_INCREMENT = 1 $STR_SEMICOLON - SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '', - 'srv "s_2_1"') $STR_SEMICOLON - SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 1', '', - 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_INCREMENT2= - SET SESSION AUTO_INCREMENT_INCREMENT = 777 $STR_SEMICOLON - SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', - 'srv "s_2_1"') $STR_SEMICOLON - SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', - 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET1= - SET SESSION AUTO_INCREMENT_OFFSET = 1 $STR_SEMICOLON - SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '', - 'srv "s_2_1"') $STR_SEMICOLON - SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 1', '', - 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET2= - SET SESSION AUTO_INCREMENT_OFFSET = 777 $STR_SEMICOLON - SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', - 'srv "s_2_1"') $STR_SEMICOLON - SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', - 'srv "s_2_2"'); -let $MASTER_1_AUTO_INCREMENT_OFFSET3= - SET SESSION AUTO_INCREMENT_OFFSET = 1; -let $MASTER_1_AUTO_INCREMENT_OFFSET4= - SET SESSION AUTO_INCREMENT_OFFSET = 777; diff --git a/storage/spider/mysql-test/spider/include/init_slave1_1.inc b/storage/spider/mysql-test/spider/include/init_slave1_1.inc deleted file mode 100644 index 73c3c6b9ef2..00000000000 --- a/storage/spider/mysql-test/spider/include/init_slave1_1.inc +++ /dev/null @@ -1,10 +0,0 @@ -let $SLAVE1_1_COMMENT_INCREMENT1_1= - COMMENT ''; -let $SLAVE1_1_COMMENT_INCREMENT1_P_1= - COMMENT '' - PARTITION BY LIST(MOD(id, 2)) ( - PARTITION pt1 VALUES IN (0) - COMMENT='', - PARTITION pt2 VALUES IN (1) - COMMENT='' - ); diff --git a/storage/spider/mysql-test/spider/my_1_1.cnf b/storage/spider/mysql-test/spider/my_1_1.cnf index 5f17295d895..be960747491 100644 --- a/storage/spider/mysql-test/spider/my_1_1.cnf +++ b/storage/spider/mysql-test/spider/my_1_1.cnf @@ -26,7 +26,6 @@ MASTER_1_HSRPORT= 20000 MASTER_1_HSWPORT= 20001 MASTER_1_MYSOCK= @mysqld.1.1.socket MASTER_1_ENGINE_TYPE= Spider -#MASTER_1_ENGINE_TYPE= MyISAM MASTER_1_ENGINE= ENGINE=Spider MASTER_1_CHARSET= DEFAULT CHARSET=utf8 MASTER_1_ENGINE2= ENGINE=MyISAM @@ -34,11 +33,3 @@ MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/my_2_1.cnf b/storage/spider/mysql-test/spider/my_2_1.cnf index 24161645607..adc955ee0d9 100644 --- a/storage/spider/mysql-test/spider/my_2_1.cnf +++ b/storage/spider/mysql-test/spider/my_2_1.cnf @@ -34,23 +34,3 @@ CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket CHILD2_1_GM_ENGINE_TYPE= MyISAM CHILD2_1_GM_ENGINE= ENGINE=MyISAM CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/my_2_2.cnf b/storage/spider/mysql-test/spider/my_2_2.cnf index 2d3c2a89a7d..557b02e8e0a 100644 --- a/storage/spider/mysql-test/spider/my_2_2.cnf +++ b/storage/spider/mysql-test/spider/my_2_2.cnf @@ -31,8 +31,3 @@ CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket CHILD2_2_GM_ENGINE_TYPE= MyISAM CHILD2_2_GM_ENGINE= ENGINE=MyISAM CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_2_DROP_TABLES -# CHILD2_2_CREATE_TABLES -# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf b/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf index 5f17295d895..be960747491 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf +++ b/storage/spider/mysql-test/spider/regression/e1121/my_1_1.cnf @@ -26,7 +26,6 @@ MASTER_1_HSRPORT= 20000 MASTER_1_HSWPORT= 20001 MASTER_1_MYSOCK= @mysqld.1.1.socket MASTER_1_ENGINE_TYPE= Spider -#MASTER_1_ENGINE_TYPE= MyISAM MASTER_1_ENGINE= ENGINE=Spider MASTER_1_CHARSET= DEFAULT CHARSET=utf8 MASTER_1_ENGINE2= ENGINE=MyISAM @@ -34,11 +33,3 @@ MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf b/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf index 24161645607..adc955ee0d9 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf +++ b/storage/spider/mysql-test/spider/regression/e1121/my_2_1.cnf @@ -34,23 +34,3 @@ CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket CHILD2_1_GM_ENGINE_TYPE= MyISAM CHILD2_1_GM_ENGINE= ENGINE=MyISAM CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test index 7c7c1dc69ce..89f65e96514 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test +++ b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_key.test @@ -23,7 +23,16 @@ USE auto_test_remote; --disable_query_log --disable_ps_protocol echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +akey int NOT NULL, +val int NOT NULL, +KEY idx1 (akey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE tbl_b ( +bkey int NOT NULL, +akey int NOT NULL, +PRIMARY KEY (bkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_ps_protocol --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -35,21 +44,21 @@ echo CREATE TABLE tbl_a ( val int NOT NULL, KEY idx1 (akey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( akey int NOT NULL, val int NOT NULL, KEY idx1 (akey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; echo CREATE TABLE tbl_b ( bkey int NOT NULL, akey int NOT NULL, PRIMARY KEY (bkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2; -eval CREATE TABLE tbl_b ( +CREATE TABLE tbl_b ( bkey int NOT NULL, akey int NOT NULL, PRIMARY KEY (bkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0); @@ -68,8 +77,12 @@ SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; --connection child2_1 --disable_ps_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; -eval $CHILD2_1_SELECT_TABLES; +eval +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' $STR_SEMICOLON +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%'; +eval +SELECT akey, val FROM tbl_a ORDER BY akey $STR_SEMICOLON +SELECT bkey, akey FROM tbl_b ORDER BY bkey; --enable_ps_protocol --enable_view_protocol diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test index dd442272996..a81de5cd890 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test +++ b/storage/spider/mysql-test/spider/regression/e1121/t/direct_join_by_pkey_pkey.test @@ -23,7 +23,16 @@ USE auto_test_remote; --disable_query_log echo CHILD2_1_CREATE_TABLES; --disable_ps_protocol -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +akey int NOT NULL, +val int NOT NULL, +PRIMARY KEY (akey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE tbl_b ( +bkey int NOT NULL, +akey int NOT NULL, +PRIMARY KEY (bkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_ps_protocol --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -35,21 +44,21 @@ echo CREATE TABLE tbl_a ( val int NOT NULL, PRIMARY KEY (akey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( akey int NOT NULL, val int NOT NULL, PRIMARY KEY (akey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; echo CREATE TABLE tbl_b ( bkey int NOT NULL, akey int NOT NULL, PRIMARY KEY (bkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1_2; -eval CREATE TABLE tbl_b ( +CREATE TABLE tbl_b ( bkey int NOT NULL, akey int NOT NULL, PRIMARY KEY (bkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (akey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); INSERT INTO tbl_b (bkey,akey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,4),(6,3),(7,2),(8,1),(9,0); @@ -68,8 +77,12 @@ SELECT a.val, a.akey FROM tbl_a a, tbl_b b WHERE a.akey = b.akey AND b.bkey = 5; --connection child2_1 --disable_ps_protocol --disable_view_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; -eval $CHILD2_1_SELECT_TABLES; +eval +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_a`%' $STR_SEMICOLON +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%`tbl_b`%'; +eval +SELECT akey, val FROM tbl_a ORDER BY akey $STR_SEMICOLON +SELECT bkey, akey FROM tbl_b ORDER BY bkey; --enable_view_protocol --enable_ps_protocol diff --git a/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf index 5f17295d895..be960747491 100644 --- a/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf +++ b/storage/spider/mysql-test/spider/regression/e112122/my_1_1.cnf @@ -26,7 +26,6 @@ MASTER_1_HSRPORT= 20000 MASTER_1_HSWPORT= 20001 MASTER_1_MYSOCK= @mysqld.1.1.socket MASTER_1_ENGINE_TYPE= Spider -#MASTER_1_ENGINE_TYPE= MyISAM MASTER_1_ENGINE= ENGINE=Spider MASTER_1_CHARSET= DEFAULT CHARSET=utf8 MASTER_1_ENGINE2= ENGINE=MyISAM @@ -34,11 +33,3 @@ MASTER_1_CHARSET2= DEFAULT CHARSET=utf8 MASTER_1_CHARSET3= DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci STR_SEMICOLON= ; - -#The followings are set in include/init_xxx.inc files -# MASTER_1_COMMENT_2_1 -# MASTER_1_COMMENT2_2_1 -# MASTER_1_COMMENT3_2_1 -# MASTER_1_COMMENT4_2_1 -# MASTER_1_COMMENT5_2_1 -# MASTER_1_COMMENT_P_2_1 diff --git a/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf index 24161645607..adc955ee0d9 100644 --- a/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf +++ b/storage/spider/mysql-test/spider/regression/e112122/my_2_1.cnf @@ -34,23 +34,3 @@ CHILD2_1_GM_MYSOCK= @mysqld.2.1.socket CHILD2_1_GM_ENGINE_TYPE= MyISAM CHILD2_1_GM_ENGINE= ENGINE=MyISAM CHILD2_1_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_1_DROP_TABLES -# CHILD2_1_CREATE_TABLES -# CHILD2_1_SELECT_TABLES -# CHILD2_1_DROP_TABLES2 -# CHILD2_1_CREATE_TABLES2 -# CHILD2_1_SELECT_TABLES2 -# CHILD2_1_DROP_TABLES3 -# CHILD2_1_CREATE_TABLES3 -# CHILD2_1_SELECT_TABLES3 -# CHILD2_1_DROP_TABLES4 -# CHILD2_1_CREATE_TABLES4 -# CHILD2_1_SELECT_TABLES4 -# CHILD2_1_DROP_TABLES5 -# CHILD2_1_CREATE_TABLES5 -# CHILD2_1_SELECT_TABLES5 -# CHILD2_1_DROP_TABLES6 -# CHILD2_1_CREATE_TABLES6 -# CHILD2_1_SELECT_TABLES6 diff --git a/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf b/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf index 2d3c2a89a7d..557b02e8e0a 100644 --- a/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf +++ b/storage/spider/mysql-test/spider/regression/e112122/my_2_2.cnf @@ -31,8 +31,3 @@ CHILD2_2_GM_MYSOCK= @mysqld.2.2.socket CHILD2_2_GM_ENGINE_TYPE= MyISAM CHILD2_2_GM_ENGINE= ENGINE=MyISAM CHILD2_2_GM_CHARSET= DEFAULT CHARSET=utf8 - -#The followings are set in include/init_xxx.inc files -# CHILD2_2_DROP_TABLES -# CHILD2_2_CREATE_TABLES -# CHILD2_2_SELECT_TABLES diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test b/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test index 007fef77b62..a2b595d70f2 100644 --- a/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test +++ b/storage/spider/mysql-test/spider/regression/e112122/t/group_by_order_by_limit_ok.test @@ -27,14 +27,24 @@ USE auto_test_remote2; --connection child2_1 --disable_query_log echo CHILD2_1_CREATE_TABLES; -eval $CHILD2_1_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +skey int NOT NULL, +KEY idx1 (pkey), +KEY idx2 (skey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; --connection child2_2 --disable_query_log echo CHILD2_2_CREATE_TABLES; -eval $CHILD2_2_CREATE_TABLES; +CREATE TABLE tbl_a ( +pkey int NOT NULL, +skey int NOT NULL, +KEY idx1 (pkey), +KEY idx2 (skey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log TRUNCATE TABLE mysql.general_log; @@ -46,12 +56,16 @@ echo CREATE TABLE tbl_a ( KEY idx1 (pkey), KEY idx2 (skey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, skey int NOT NULL, KEY idx1 (pkey), KEY idx2 (skey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' + PARTITION BY KEY(skey) ( +PARTITION pt1 COMMENT='srv "s_2_1"', +PARTITION pt2 COMMENT='srv "s_2_2"' + ); --enable_query_log INSERT INTO tbl_a (pkey,skey) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); INSERT INTO tbl_a (pkey,skey) VALUES (10,10),(11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17),(18,18),(19,19); @@ -79,15 +93,15 @@ set spider_direct_aggregate=@old_spider_direct_aggregate; --connection child2_1 --disable_view_protocol -eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_1_SELECT_TABLES; +SELECT pkey, skey FROM tbl_a ORDER BY pkey; --connection child2_2 --disable_view_protocol -eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol -eval $CHILD2_2_SELECT_TABLES; +SELECT pkey, skey FROM tbl_a ORDER BY pkey; --enable_ps2_protocol --echo diff --git a/storage/spider/mysql-test/spider/t/auto_increment.test b/storage/spider/mysql-test/spider/t/auto_increment.test index b4f0610fa58..b23453d68bc 100644 --- a/storage/spider/mysql-test/spider/t/auto_increment.test +++ b/storage/spider/mysql-test/spider/t/auto_increment.test @@ -7,74 +7,38 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +col_a INT NOT NULL AUTO_INCREMENT, +col_b VARCHAR(20) DEFAULT 'def', +col_c INT NOT NULL DEFAULT 10, +PRIMARY KEY(col_a) +) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -86,12 +50,12 @@ echo CREATE TABLE tbl_a ( col_c INT NOT NULL DEFAULT 100, PRIMARY KEY(col_a) ) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( col_a INT NOT NULL AUTO_INCREMENT, col_b VARCHAR(20) DEFAULT 'defg', col_c INT NOT NULL DEFAULT 100, PRIMARY KEY(col_a) -) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1; +) ENGINE=Spider AUTO_INCREMENT=20 COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'; --enable_query_log SHOW CREATE TABLE tbl_a; INSERT INTO tbl_a () VALUES (); @@ -108,7 +72,7 @@ INSERT INTO tbl_a () VALUES (); SHOW CREATE TABLE tbl_a; --disable_query_log echo MASTER_1_AUTO_INCREMENT1; -eval $MASTER_1_AUTO_INCREMENT1; +ALTER TABLE tbl_a AUTO_INCREMENT=30; --enable_query_log SHOW CREATE TABLE tbl_a; INSERT INTO tbl_a () VALUES (); @@ -116,7 +80,7 @@ INSERT INTO tbl_a () VALUES (); SHOW CREATE TABLE tbl_a; --disable_query_log echo MASTER_1_AUTO_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT2; +ALTER TABLE tbl_a AUTO_INCREMENT=10; --enable_query_log SHOW CREATE TABLE tbl_a; INSERT INTO tbl_a () VALUES (); @@ -125,50 +89,18 @@ SHOW CREATE TABLE tbl_a; --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol SELECT * FROM tbl_a; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a; --enable_ps2_protocol --echo @@ -176,15 +108,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source auto_increment_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc b/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc index 52be67a1d09..ecb5622af14 100644 --- a/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc +++ b/storage/spider/mysql-test/spider/t/auto_increment_deinit.inc @@ -1,9 +1,3 @@ ---let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP ---let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP ---let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP ---let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP ---let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP ---let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP --disable_warnings --disable_query_log --disable_result_log diff --git a/storage/spider/mysql-test/spider/t/auto_increment_init.inc b/storage/spider/mysql-test/spider/t/auto_increment_init.inc index 52245bdd02e..6cf6b0c1f41 100644 --- a/storage/spider/mysql-test/spider/t/auto_increment_init.inc +++ b/storage/spider/mysql-test/spider/t/auto_increment_init.inc @@ -5,34 +5,3 @@ --enable_result_log --enable_query_log --enable_warnings ---let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 -let $MASTER_1_COMMENT_2_1= - COMMENT='database "auto_test_remote", table "tbl_a", srv "s_2_1", aim "0"'; -let $MASTER_1_AUTO_INCREMENT_2_1= - AUTO_INCREMENT=20; -let $MASTER_1_AUTO_INCREMENT1= - ALTER TABLE tbl_a AUTO_INCREMENT=30; -let $MASTER_1_AUTO_INCREMENT2= - ALTER TABLE tbl_a AUTO_INCREMENT=10; -let $CHILD2_1_CHARSET_AUTO_INCREMENT= - AUTO_INCREMENT=20; ---let $CHILD2_1_DROP_TABLES_BACKUP= $CHILD2_1_DROP_TABLES -let $CHILD2_1_DROP_TABLES= - DROP TABLE IF EXISTS tbl_a; ---let $CHILD2_1_CREATE_TABLES_BACKUP= $CHILD2_1_CREATE_TABLES -let $CHILD2_1_CREATE_TABLES= - CREATE TABLE tbl_a ( - col_a INT NOT NULL AUTO_INCREMENT, - col_b VARCHAR(20) DEFAULT 'def', - col_c INT NOT NULL DEFAULT 10, - PRIMARY KEY(col_a) - ) $CHILD2_1_ENGINE $CHILD2_1_CHARSET_AUTO_INCREMENT $CHILD2_1_CHARSET; ---let $CHILD2_1_SELECT_TABLES_BACKUP= $CHILD2_1_SELECT_TABLES -let $CHILD2_1_SELECT_TABLES= - SELECT col_a, col_b, col_c FROM tbl_a ORDER BY col_a; -let $CHILD2_1_SELECT_ARGUMENT1= - SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; ---let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2 ---let $OUTPUT_CHILD_GROUP2= 1 ---let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG ---let $USE_GENERAL_LOG= 1 diff --git a/storage/spider/mysql-test/spider/t/basic_sql.test b/storage/spider/mysql-test/spider/t/basic_sql.test index 9439d01d9d9..7877a4e9525 100644 --- a/storage/spider/mysql-test/spider/t/basic_sql.test +++ b/storage/spider/mysql-test/spider/t/basic_sql.test @@ -12,8 +12,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -22,65 +20,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tb_l; @@ -92,12 +64,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -113,71 +85,32 @@ echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""' SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - INSERT INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - SELECT a, b, c FROM tb_l; -} --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo create table ignore select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -190,12 +123,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'f', '2008-07-01 10:21:39'), @@ -208,71 +141,32 @@ echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 IGNORE SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""' IGNORE SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - INSERT IGNORE INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - IGNORE SELECT a, b, c FROM tb_l; -} --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo create table ignore select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -282,85 +176,40 @@ echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 REPLACE SELECT a, b, c FROM tb_l; -if ($MASTER_1_MERGE) -{ - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""' REPLACE SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; - REPLACE INTO ta_l SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_MERGE) -{ - eval CREATE TABLE ta_l ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1 - REPLACE SELECT a, b, c FROM tb_l; -} --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%replace %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo create no index table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES3; - echo CHILD2_1_CREATE_TABLES3; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES3; +DROP TABLE IF EXISTS ta_r_no_idx; --enable_warnings - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r_no_idx ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l_no_idx; @@ -369,778 +218,328 @@ DROP TABLE IF EXISTS ta_l_no_idx; echo CREATE TABLE ta_l_no_idx MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1 SELECT a, b, c FROM tb_l; -if ($MASTER_1_NEEDPK) -{ - --error ER_REQUIRES_PRIMARY_KEY - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l_no_idx ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; - INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; -} -if (!$MASTER_1_NEEDPK) -{ - if ($MASTER_1_MERGE) - { - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 +eval +CREATE TABLE ta_l_no_idx +ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_no_idx"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password "", prt "2000000"' SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l_no_idx ( - a INT, - b CHAR(1), - c DATETIME - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; - INSERT INTO ta_l_no_idx SELECT a, b, c FROM tb_l; - } - if (!$MASTER_1_MERGE) - { - eval CREATE TABLE ta_l_no_idx - $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1 - SELECT a, b, c FROM tb_l; - } -} --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES3; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_no_idx ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l_no_idx ORDER BY a; --echo --echo select table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table shared mode -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a LOCK IN SHARE MODE; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table for update -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a FOR UPDATE; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table straight_join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT STRAIGHT_JOIN a.a, a.b, date_format(b.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a, tb_l b WHERE a.a = b.a ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_small_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_SMALL_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_big_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_BIG_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_buffer_result -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_BUFFER_RESULT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_cache -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select sql_no_cache -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT SQL_NO_CACHE a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select high_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT HIGH_PRIORITY a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select distinct -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT DISTINCT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select count -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT count(*) FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table join not use index -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select using pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE a.b = 'g' ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select using index and pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l a WHERE a.a > 0 AND a.b = 'g' ORDER BY a.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo insert --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1148,45 +547,21 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert select --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1194,46 +569,22 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert select a --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1241,45 +592,21 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert low_priority --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT LOW_PRIORITY INTO ta_l (a, b, c) values (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1287,90 +614,42 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert high_priority --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT HIGH_PRIORITY INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo insert ignore -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT IGNORE INTO ta_l (a, b, c) VALUES (2, 'd', '2009-02-02 01:01:01'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1378,97 +657,49 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo insert update (insert) --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo insert update (update) -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59') ON DUPLICATE KEY UPDATE b = 'f', c = '2005-08-08 11:11:11'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1477,191 +708,95 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --connection master_1 TRUNCATE TABLE ta_l; INSERT INTO ta_l (a, b, c) VALUES (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 REPLACE INTO ta_l (a, b, c) VALUES (2, 'f', '2008-02-02 02:02:02'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo replace select -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 REPLACE INTO ta_l (a, b, c) SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo replace select a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 REPLACE INTO ta_l (a, b, c) VALUES ((SELECT a FROM tb_l ORDER BY a LIMIT 1), 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo replace low_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 REPLACE LOW_PRIORITY INTO ta_l (a, b, c) VALUES (3, 'g', '2009-03-03 03:03:03'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'replace %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -1670,409 +805,193 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; TRUNCATE TABLE ta_l; INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (2, 'e', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update select -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update select a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET b = 'h', c = '2010-04-04 04:04:04' WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update join -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l a, tb_l b SET a.b = b.b, a.c = b.c WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update join a -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l a, tb_l b SET a.b = 'g', a.c = '2009-03-03 03:03:03' WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update low_priority -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE LOW_PRIORITY ta_l SET b = 'f', c = '2008-02-02 02:02:02' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update ignore -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE IGNORE ta_l SET a = 1, b = 'g', c = '2009-03-03 03:03:03' WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 update ta_l set b = 'j', c = '2009-03-03 03:03:03' where b = 'f'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo update index pushdown -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET b = 'g', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'j'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2085,91 +1004,43 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo delete all -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2182,46 +1053,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2234,46 +1081,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE a = (SELECT a FROM tb_l ORDER BY a LIMIT 1); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2286,46 +1109,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE a FROM ta_l a, (SELECT a FROM tb_l ORDER BY a) b WHERE a.a = b.a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2338,46 +1137,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE LOW_PRIORITY FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2390,46 +1165,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE IGNORE FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2442,46 +1193,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE QUICK FROM ta_l WHERE a = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2494,46 +1221,22 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE b = 'e'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2546,90 +1249,42 @@ INSERT INTO ta_l (a, b, c) VALUES (1, 'e', '2008-01-01 23:59:59'), (6, 'e', '2008-01-01 23:59:59'), (7, 'e', '2008-01-01 23:59:59'), (8, 'e', '2008-01-01 23:59:59'), (9, 'e', '2008-01-01 23:59:59'), (10, 'j', '2008-01-01 23:59:59'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 DELETE FROM ta_l WHERE a > 0 AND b = 'e'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo --echo truncate -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 TRUNCATE TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'truncate %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -2650,13 +1305,10 @@ drop table mdev_26139; --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log diff --git a/storage/spider/mysql-test/spider/t/basic_sql_part.test b/storage/spider/mysql-test/spider/t/basic_sql_part.test index 1bb18358d5d..b1a8499251c 100644 --- a/storage/spider/mysql-test/spider/t/basic_sql_part.test +++ b/storage/spider/mysql-test/spider/t/basic_sql_part.test @@ -5,16 +5,6 @@ --source test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -22,8 +12,6 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -32,30 +20,20 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings @@ -68,12 +46,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'f', '2008-07-01 10:21:39'), @@ -84,483 +62,226 @@ INSERT INTO tb_l (a, b, c) VALUES --echo --echo create table with partition and select test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT_P_2_1 SELECT a, b, c FROM tb_l; - if ($MASTER_1_MERGE) - { - --error ER_WRONG_OBJECT - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1", table "ta_r2", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_2", priority "1000001"' + ) SELECT a, b, c FROM tb_l; - eval CREATE TABLE ta_l2 ( - a INT, - b CHAR(1), - c DATETIME, - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1; - INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - } - if (!$MASTER_1_MERGE) - { - eval CREATE TABLE ta_l2 ( - PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT_P_2_1 - SELECT a, b, c FROM tb_l; - } --enable_query_log - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo select partition using pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE a.b = 'g' ORDER BY a.a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } -} --echo --echo select partition using index pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 a WHERE a.a > 0 AND a.b = 'g' ORDER BY a.a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } -} --echo --echo update partition pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 UPDATE ta_l2 SET b = 'e', c = '2009-03-03 03:03:03' WHERE b = 'j'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo update partition index pushdown -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 UPDATE ta_l2 SET b = 'j', c = '2009-03-03 03:03:03' WHERE a > 0 AND b = 'e'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'update %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo delete partition pushdown -if ($HAVE_PARTITION) -{ TRUNCATE TABLE ta_l2; INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 DELETE FROM ta_l2 WHERE b = 'g'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo delete partition index pushdown -if ($HAVE_PARTITION) -{ TRUNCATE TABLE ta_l2; INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 DELETE FROM ta_l2 WHERE a > 0 AND b = 'g'; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE 'delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test b/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test index 44d2878cd08..8432d0fe8d2 100644 --- a/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test +++ b/storage/spider/mysql-test/spider/t/checksum_table_with_quick_mode_3.test @@ -5,59 +5,34 @@ --disable_warnings CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_CREATE_TABLES; - } - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -66,64 +41,26 @@ FLUSH TABLES; --echo --echo select test 1 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 CHECKSUM TABLE tbl_a EXTENDED; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --disable_ps2_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%checksum %'; --enable_ps2_protocol --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_a ORDER BY pkey; --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/checksum_table_with_quick_mode_3_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_aggregate.test b/storage/spider/mysql-test/spider/t/direct_aggregate.test index 0acff3f655d..dd2690c197f 100644 --- a/storage/spider/mysql-test/spider/t/direct_aggregate.test +++ b/storage/spider/mysql-test/spider/t/direct_aggregate.test @@ -11,8 +11,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -21,65 +19,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -91,12 +63,15 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -107,37 +82,25 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo direct_aggregating test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT COUNT(*) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MAX(a) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MIN(a) FROM ta_l; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MAX(a) FROM ta_l WHERE a < 5; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MIN(a) FROM ta_l WHERE a > 1; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; --enable_ps2_protocol SET spider_direct_aggregate=0; @@ -146,41 +109,26 @@ SELECT MAX(a) FROM ta_l; SELECT MIN(a) FROM ta_l; SELECT MAX(a) FROM ta_l WHERE a < 5; SELECT MIN(a) FROM ta_l WHERE a > 1; -eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SET spider_direct_aggregate=1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/direct_aggregate_part.test b/storage/spider/mysql-test/spider/t/direct_aggregate_part.test index 8f4c72dca64..4c1803d3917 100644 --- a/storage/spider/mysql-test/spider/t/direct_aggregate_part.test +++ b/storage/spider/mysql-test/spider/t/direct_aggregate_part.test @@ -4,16 +4,6 @@ --source test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -21,8 +11,6 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -31,86 +19,49 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo with partition test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( @@ -119,12 +70,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -136,21 +93,20 @@ if ($HAVE_PARTITION) set @old_spider_direct_aggregate=@@session.spider_direct_aggregate; set spider_direct_aggregate=1; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT COUNT(*) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT SUM(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MAX(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MIN(a) FROM ta_l2; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MAX(a) FROM ta_l2 WHERE a < 5; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; SELECT MIN(a) FROM ta_l2 WHERE a > 1; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; --enable_ps2_protocol - SET spider_direct_aggregate=0; SELECT COUNT(*) FROM ta_l2; SELECT SUM(a) FROM ta_l2; @@ -158,49 +114,30 @@ if ($HAVE_PARTITION) SELECT MIN(a) FROM ta_l2; SELECT MAX(a) FROM ta_l2 WHERE a < 5; SELECT MIN(a) FROM ta_l2 WHERE a > 1; - eval $MASTER_1_CHECK_DIRECT_AGGREGATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_aggregate'; set spider_direct_aggregate=@old_spider_direct_aggregate; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/direct_join.test b/storage/spider/mysql-test/spider/t/direct_join.test index 23cfbb197c9..38e555c248d 100644 --- a/storage/spider/mysql-test/spider/t/direct_join.test +++ b/storage/spider/mysql-test/spider/t/direct_join.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -60,29 +32,33 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES; echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES5; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -95,23 +71,29 @@ echo CREATE TABLE tbl_a ( PRIMARY KEY(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b INT DEFAULT 10, @@ -120,14 +102,17 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b INT DEFAULT 10, c INT DEFAULT 11, PRIMARY KEY(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); @@ -135,92 +120,50 @@ insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500); --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.a, c.b, c.c FROM tbl_a a, tbl_b b, tbl_c c WHERE a.a = b.a and a.a = c.a ORDER BY a.b DESC LIMIT 1,2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo --echo Test JOIN on a constant table. --echo Spider should NOT push down the join because the tbl_person table --echo is optimized as a constant table. -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_CONST_TABLE_JOIN; echo CHILD2_1_DROP_CONST_TABLE2_JOIN; echo CHILD2_1_CREATE_CONST_TABLE_JOIN; echo CHILD2_1_CREATE_CONST_TABLE2_JOIN; - } --disable_warnings - eval $CHILD2_1_DROP_CONST_TABLE_JOIN; - eval $CHILD2_1_DROP_CONST_TABLE2_JOIN; +DROP TABLE IF EXISTS tbl_person; +DROP TABLE IF EXISTS tbl_ncd_cm_person; --enable_warnings - eval $CHILD2_1_CREATE_CONST_TABLE_JOIN; - eval $CHILD2_1_CREATE_CONST_TABLE2_JOIN; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_person ( +id VARCHAR(50) NOT NULL, +hr_status VARCHAR(50) NULL DEFAULT NULL, +region_code VARCHAR(50) NULL DEFAULT NULL, +region INT(11) NOT NULL, +PRIMARY KEY (id, region) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT = Dynamic; +CREATE TABLE tbl_ncd_cm_person ( +id VARCHAR(50) NOT NULL, +person_id VARCHAR(50) NULL DEFAULT '', +diseaseKind_id VARCHAR(50) NULL DEFAULT NULL, +region INT(11) NOT NULL, +PRIMARY KEY (id, region) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT = Dynamic; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_person; @@ -235,14 +178,16 @@ echo CREATE TABLE tbl_person ( PRIMARY KEY (id, region) USING BTREE ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_CONST_TABLE_JOIN MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN MASTER_1_PART_CONST_TABLE_JOIN; -eval CREATE TABLE tbl_person ( +CREATE TABLE tbl_person ( id VARCHAR(50) NOT NULL, hr_status VARCHAR(50) NULL DEFAULT NULL, region_code VARCHAR(50) NULL DEFAULT NULL, region INT(11) NOT NULL, PRIMARY KEY (id, region) USING BTREE - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_CONST_TABLE_JOIN - $MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN $MASTER_1_PART_CONST_TABLE_JOIN; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'table "tbl_ncd_cm_person"' +ROW_FORMAT = Dynamic PARTITION BY LIST COLUMNS (region) PARTITIONS 1 +(PARTITION pt1 values in (510411) +COMMENT = 'tbl "tbl_person", srv "s_2_1"' MAX_ROWS = 0 MIN_ROWS = 0); echo SHOW CREATE TABLE tbl_person; SHOW CREATE TABLE tbl_person; echo CREATE TABLE tbl_ncd_cm_person ( @@ -253,14 +198,16 @@ echo CREATE TABLE tbl_ncd_cm_person ( PRIMARY KEY (id, region) USING BTREE ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_CONST_TABLE2_JOIN MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN MASTER_1_PART_CONST_TABLE2_JOIN; -eval CREATE TABLE tbl_ncd_cm_person ( +CREATE TABLE tbl_ncd_cm_person ( id VARCHAR(50) NOT NULL, person_id VARCHAR(50) NULL DEFAULT '', diseaseKind_id VARCHAR(50) NULL DEFAULT NULL, region INT(11) NOT NULL, PRIMARY KEY (id, region) USING BTREE - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_CONST_TABLE2_JOIN - $MASTER_1_ROW_FORMAT_CONST_TABLE_JOIN $MASTER_1_PART_CONST_TABLE2_JOIN; +) ENGINE=Spider DEFAULT CHARSET=utf8 +ROW_FORMAT = Dynamic PARTITION BY LIST COLUMNS (region) PARTITIONS 1 +(PARTITION pt1 values in (510411) +COMMENT = 'tbl "tbl_ncd_cm_person", srv "s_2_1"' MAX_ROWS = 0 MIN_ROWS = 0); echo SHOW CREATE TABLE tbl_ncd_cm_person; SHOW CREATE TABLE tbl_ncd_cm_person; --enable_query_log @@ -285,50 +232,18 @@ INSERT INTO tbl_ncd_cm_person VALUES ('123456789AB', '123456789012345678901234567890AB', '52A0328740914BCE86ED10A4D2521816', 510411); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT count(0) FROM tbl_person tp INNER JOIN tbl_ncd_cm_person tncp ON tp.id = tncp.person_id WHERE 1 = 1 AND tp.hr_status != "99" AND tp.hr_status != "2" AND tp.region_code LIKE CONCAT(CONCAT('%', '51041110620301', '%')) AND tp.id = '24FC3F0A5119432BAE13DD65AABAA39C' AND tncp.diseaseKind_id = '52A0328740914BCE86ED10A4D2521816' AND tp.region = 510411; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_CONST_TABLE_JOIN; - eval $CHILD2_1_SELECT_CONST_TABLE2_JOIN; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT * FROM tbl_person; +SELECT * FROM tbl_ncd_cm_person; --enable_ps2_protocol --echo @@ -336,15 +251,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_join_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_join_using.test b/storage/spider/mysql-test/spider/t/direct_join_using.test index 44d563b27ca..059990e874a 100644 --- a/storage/spider/mysql-test/spider/t/direct_join_using.test +++ b/storage/spider/mysql-test/spider/t/direct_join_using.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -60,29 +32,33 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES; echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES5; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -95,23 +71,29 @@ echo CREATE TABLE tbl_a ( PRIMARY KEY(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b INT DEFAULT 10, @@ -120,14 +102,17 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b INT DEFAULT 10, c INT DEFAULT 11, PRIMARY KEY(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); @@ -135,52 +120,19 @@ insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500); --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol SELECT a.a, c.b, c.c FROM tbl_a a join tbl_b b using(a) join tbl_c c using(a) ORDER BY a.b DESC; --enable_view_protocol - -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -188,15 +140,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_join_using_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_left_join.test b/storage/spider/mysql-test/spider/t/direct_left_join.test index ed36f580a52..73a37af2b61 100644 --- a/storage/spider/mysql-test/spider/t/direct_left_join.test +++ b/storage/spider/mysql-test/spider/t/direct_left_join.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -60,29 +32,33 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES; echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES5; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -95,23 +71,29 @@ echo CREATE TABLE tbl_a ( PRIMARY KEY(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b INT DEFAULT 10, @@ -120,14 +102,17 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b INT DEFAULT 10, c INT DEFAULT 11, PRIMARY KEY(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); @@ -135,52 +120,19 @@ insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500); --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol SELECT a.a, c.b, c.c FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on a.a = c.a ORDER BY a.b DESC; --enable_view_protocol - -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -188,15 +140,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_left_join_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test index 949a1ecf5c7..0dbf36e0034 100644 --- a/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test +++ b/storage/spider/mysql-test/spider/t/direct_left_join_nullable.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -62,31 +34,37 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES4; echo CHILD2_1_CREATE_TABLES3; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES4; - eval $CHILD2_1_DROP_TABLES3; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_auto_inc; +DROP TABLE IF EXISTS ta_r_no_idx; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES4; - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_no_idx ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -99,23 +77,29 @@ echo CREATE TABLE tbl_a ( KEY idx0(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', @@ -124,24 +108,30 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; -eval CREATE TABLE tbl_d ( +eval +CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_no_idx"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password "", prt "2000000"'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); @@ -150,50 +140,18 @@ insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/ --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.a, c.b, c.c, d.a FROM tbl_d a left join tbl_c b on a.a = b.a left join tbl_b c on b.c = c.c left join tbl_a d on c.b = d.b ORDER BY a.a DESC; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -201,15 +159,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_left_join_nullable_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test index e81dbbcccad..c0d6548a57a 100644 --- a/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test +++ b/storage/spider/mysql-test/spider/t/direct_left_right_join_nullable.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -62,31 +34,37 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES4; echo CHILD2_1_CREATE_TABLES3; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES4; - eval $CHILD2_1_DROP_TABLES3; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_auto_inc; +DROP TABLE IF EXISTS ta_r_no_idx; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES4; - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_no_idx ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -99,23 +77,29 @@ echo CREATE TABLE tbl_a ( KEY idx0(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', @@ -124,24 +108,30 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; -eval CREATE TABLE tbl_d ( +eval +CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_no_idx"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password "", prt "2000000"'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); @@ -150,50 +140,18 @@ insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/ --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -201,15 +159,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_left_right_join_nullable_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test index 480ac8dcd1c..c9539d9938c 100644 --- a/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test +++ b/storage/spider/mysql-test/spider/t/direct_left_right_left_join_nullable.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -62,31 +34,37 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES4; echo CHILD2_1_CREATE_TABLES3; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES4; - eval $CHILD2_1_DROP_TABLES3; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_auto_inc; +DROP TABLE IF EXISTS ta_r_no_idx; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES4; - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_no_idx ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -99,23 +77,29 @@ echo CREATE TABLE tbl_a ( KEY idx0(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', @@ -124,24 +108,30 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; -eval CREATE TABLE tbl_d ( +eval +CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_no_idx"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password "", prt "2000000"'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); @@ -150,50 +140,18 @@ insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/ --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.a, c.b, c.c, d.a FROM tbl_a a left join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -201,15 +159,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_left_right_left_join_nullable_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_right_join.test b/storage/spider/mysql-test/spider/t/direct_right_join.test index effa1121c8b..dadcbba1509 100644 --- a/storage/spider/mysql-test/spider/t/direct_right_join.test +++ b/storage/spider/mysql-test/spider/t/direct_right_join.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -60,29 +32,33 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES; echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES5; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -95,23 +71,29 @@ echo CREATE TABLE tbl_a ( PRIMARY KEY(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b INT DEFAULT 10, @@ -120,14 +102,17 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b INT DEFAULT 10, c INT DEFAULT 11, PRIMARY KEY(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'),(4,'d','2000/01/04'),(5,'e','2000/01/05'); @@ -135,52 +120,19 @@ insert into tbl_c values (1,10,100),(2,20,200),(3,30,300),(4,40,400),(5,50,500); --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol SELECT a.a, c.b, c.c FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on a.a = c.a ORDER BY a.b DESC; --enable_view_protocol - -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -188,15 +140,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_right_join_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test index 0f0f614a03a..8a479c6676b 100644 --- a/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test +++ b/storage/spider/mysql-test/spider/t/direct_right_join_nullable.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -62,31 +34,37 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES4; echo CHILD2_1_CREATE_TABLES3; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES4; - eval $CHILD2_1_DROP_TABLES3; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_auto_inc; +DROP TABLE IF EXISTS ta_r_no_idx; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES4; - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_no_idx ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -99,23 +77,29 @@ echo CREATE TABLE tbl_a ( KEY idx0(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', @@ -124,24 +108,30 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; -eval CREATE TABLE tbl_d ( +eval +CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_no_idx"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password "", prt "2000000"'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); @@ -150,50 +140,18 @@ insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/ --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -201,15 +159,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_right_join_nullable_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test index 75e1551bcbb..ff853461854 100644 --- a/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test +++ b/storage/spider/mysql-test/spider/t/direct_right_left_join_nullable.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -62,31 +34,37 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES4; echo CHILD2_1_CREATE_TABLES3; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES4; - eval $CHILD2_1_DROP_TABLES3; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_auto_inc; +DROP TABLE IF EXISTS ta_r_no_idx; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES4; - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_no_idx ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -99,23 +77,29 @@ echo CREATE TABLE tbl_a ( KEY idx0(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', @@ -124,24 +108,30 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; -eval CREATE TABLE tbl_d ( +eval +CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_no_idx"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password "", prt "2000000"'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); @@ -150,50 +140,18 @@ insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/ --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a right join tbl_c c on b.c = c.c left join tbl_d d on c.b = d.b ORDER BY d.a DESC; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -201,15 +159,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_right_left_join_nullable_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test index 017a8174df7..8722b2d416d 100644 --- a/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test +++ b/storage/spider/mysql-test/spider/t/direct_right_left_right_join_nullable.test @@ -7,52 +7,24 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES6; @@ -62,31 +34,37 @@ if ($USE_CHILD_GROUP2) echo CHILD2_1_CREATE_TABLES6; echo CHILD2_1_CREATE_TABLES4; echo CHILD2_1_CREATE_TABLES3; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES6; - eval $CHILD2_1_DROP_TABLES4; - eval $CHILD2_1_DROP_TABLES3; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r_3; +DROP TABLE IF EXISTS ta_r_auto_inc; +DROP TABLE IF EXISTS ta_r_no_idx; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES6; - eval $CHILD2_1_CREATE_TABLES4; - eval $CHILD2_1_CREATE_TABLES3; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r_no_idx ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -99,23 +77,29 @@ echo CREATE TABLE tbl_a ( KEY idx0(a), KEY idx1(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +eval +CREATE TABLE tbl_a ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE tbl_b ( +eval +CREATE TABLE tbl_b ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', @@ -124,24 +108,30 @@ echo CREATE TABLE tbl_c ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; -eval CREATE TABLE tbl_c ( +eval +CREATE TABLE tbl_c ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', KEY idx0(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT2_2_1; -eval CREATE TABLE tbl_d ( +eval +CREATE TABLE tbl_d ( a INT DEFAULT 10, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10' -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT2_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_no_idx"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password "", prt "2000000"'; --enable_query_log insert into tbl_a values (1,'a','2000/01/01'),(2,'b','2000/01/02'); insert into tbl_b values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/01/03'); @@ -150,50 +140,18 @@ insert into tbl_d values (1,'a','2000/01/01'),(2,'b','2000/01/02'),(3,'c','2000/ --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.a, c.b, c.c, d.a FROM tbl_a a right join tbl_b b on a.a = b.a left join tbl_c c on b.c = c.c right join tbl_d d on c.b = d.b ORDER BY d.a DESC; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_ps2_protocol --echo @@ -201,15 +159,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/direct_right_left_right_join_nullable_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/direct_update.test b/storage/spider/mysql-test/spider/t/direct_update.test index 94f27e2859c..3ae3db391ec 100644 --- a/storage/spider/mysql-test/spider/t/direct_update.test +++ b/storage/spider/mysql-test/spider/t/direct_update.test @@ -11,8 +11,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -21,65 +19,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -91,12 +63,15 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -107,87 +82,60 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo direct_updating test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo update all rows with function UPDATE ta_l SET c = ADDDATE(c, 1); -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo update by primary key UPDATE ta_l SET b = 'x' WHERE a = 3; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo update by a column without index UPDATE ta_l SET c = '2011-10-17' WHERE b = 'x'; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo update by primary key with order and limit UPDATE ta_l SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; -eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo delete by primary key with order and limit DELETE FROM ta_l WHERE a < 4 ORDER BY c LIMIT 1; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo delete by a column without index DELETE FROM ta_l WHERE b = 'c'; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --echo delete by primary key DELETE FROM ta_l WHERE a = 3; -eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/direct_update_part.test b/storage/spider/mysql-test/spider/t/direct_update_part.test index e8f1882594c..d24bc0c24ac 100644 --- a/storage/spider/mysql-test/spider/t/direct_update_part.test +++ b/storage/spider/mysql-test/spider/t/direct_update_part.test @@ -4,16 +4,6 @@ --source test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -21,8 +11,6 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -31,86 +19,49 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo with partition test -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( @@ -119,12 +70,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), (2, 'b', '2000-01-01 00:00:00'), @@ -132,75 +89,56 @@ if ($HAVE_PARTITION) (4, 'd', '2003-11-30 05:01:03'), (5, 'c', '2001-12-31 23:59:59'); --enable_query_log - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo update all rows with function UPDATE ta_l2 SET c = ADDDATE(c, 1); - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo update by primary key UPDATE ta_l2 SET b = 'x' WHERE a = 3; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo update by a column without index UPDATE ta_l2 SET c = '2011-10-17' WHERE b = 'x'; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo update by primary key with order and limit UPDATE ta_l2 SET c = ADDDATE(c, 1) WHERE a < 4 ORDER BY b DESC LIMIT 1; - eval $MASTER_1_CHECK_DIRECT_UPDATE_STATUS; +SHOW STATUS LIKE 'Spider_direct_update'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo delete by primary key with order and limit DELETE FROM ta_l2 WHERE a < 4 ORDER BY c LIMIT 1; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo delete by a column without index DELETE FROM ta_l2 WHERE b = 'c'; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; --echo delete by primary key DELETE FROM ta_l2 WHERE a = 3; - eval $MASTER_1_CHECK_DIRECT_DELETE_STATUS; +SHOW STATUS LIKE 'Spider_direct_delete'; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%handler %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/error_row_number.test b/storage/spider/mysql-test/spider/t/error_row_number.test index 408e739656a..2774b221bae 100644 --- a/storage/spider/mysql-test/spider/t/error_row_number.test +++ b/storage/spider/mysql-test/spider/t/error_row_number.test @@ -5,6 +5,10 @@ --disable_query_log --disable_result_log --source test_init.inc +let $MASTER_1_COMMENT_2_1= + COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_result_log --enable_query_log diff --git a/storage/spider/mysql-test/spider/t/function.test b/storage/spider/mysql-test/spider/t/function.test index 2472e774782..f2fb4e550fb 100644 --- a/storage/spider/mysql-test/spider/t/function.test +++ b/storage/spider/mysql-test/spider/t/function.test @@ -12,8 +12,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -22,66 +20,45 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo in() -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TEXT_PK_TABLES1; - echo CHILD2_1_CREATE_TEXT_PK_TABLES1; - } --disable_warnings - eval $CHILD2_1_DROP_TEXT_PK_TABLES1; +DROP TABLE IF EXISTS t1; --enable_warnings - eval $CHILD2_1_CREATE_TEXT_PK_TABLES1; +CREATE TABLE t1 ( +a VARCHAR(255), +PRIMARY KEY (a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE t1 ( a VARCHAR(255), PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET3 MASTER_1_COMMENT_TEXT_PK1_1; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( a VARCHAR(255), PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET3 $MASTER_1_COMMENT_TEXT_PK1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT 'tbl "t1", srv "s_2_1"'; --enable_query_log insert into t1 values ('1'); insert into t1 select a + 1 from t1; @@ -95,80 +72,40 @@ insert into t1 select a + 128 from t1; insert into t1 select a + 256 from t1; insert into t1 select a + 512 from t1; flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 select a from t1 where a in ('15', '120'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a FROM t1 ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo date_sub() -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -180,12 +117,15 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -209,25 +149,13 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; UPDATE ta_l SET c = DATE_SUB(c, INTERVAL 1 MINUTE); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; UPDATE ta_l SET c = DATE_ADD(c, INTERVAL 1 SECOND); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -236,13 +164,10 @@ SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/ha.test b/storage/spider/mysql-test/spider/t/ha.test index 4e734a87cc2..9fa0eeb95fa 100644 --- a/storage/spider/mysql-test/spider/t/ha.test +++ b/storage/spider/mysql-test/spider/t/ha.test @@ -1,6 +1,4 @@ # This test tests for ha features -if ($USE_HA_TEST) -{ --disable_warnings --disable_query_log --disable_result_log @@ -15,8 +13,6 @@ if ($USE_HA_TEST) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -29,9 +25,6 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ --connection child3_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; @@ -44,133 +37,111 @@ if ($USE_CHILD_GROUP3) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; --connection child2_3 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 SELECT 1; --connection child3_2 SELECT 1; --connection child3_3 SELECT 1; - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } -} --echo --echo create table test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_2_1; +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2"'; --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_2_1; +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2"'; --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2"'; --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -182,12 +153,16 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2"'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -198,373 +173,273 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo fail-over test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_HA_DROP_TABLES; - } --disable_warnings - eval $CHILD2_2_HA_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_CHECK_HA_STATUS; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; --error 12511 INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_CHECK_LINK_FAILED_LOG; -eval $MASTER_1_CHECK_HA_STATUS; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --enable_query_log --enable_result_log - } -} --echo --echo recovery test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_HA_CREATE_TABLES; - } - eval $CHILD2_2_HA_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_RECOVERY_STATUS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_SET_RECOVERY_STATUS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 2"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --disable_view_protocol -eval $MASTER_1_COPY_TABLES_2_1; +SELECT spider_copy_tables('ta_l', '0', '1'); --enable_view_protocol -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_SET_OK_STATUS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", + database "auto_test_remote auto_test_remote2", lst "0 1"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; INSERT INTO ta_l (a, b, c) VALUES (8, 'g', '2011-05-05 21:33:30'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; DROP TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol -eval $MASTER_1_CHANGE_HA_MON; +SELECT spider_flush_table_mon_cache(); --enable_ps2_protocol --echo --echo active standby test --echo create table test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_AS_2_1; +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2"'; --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_AS_2_1; +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2"'; --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_AS_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { +eval +CREATE TABLE ta_l ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2"'; --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l; @@ -576,12 +451,16 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='socket "$CHILD2_1_MYSOCK $CHILD2_2_MYSOCK", table "ta_r ta_r3"' + CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2"'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -592,261 +471,158 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo fail-over test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_DROP_TABLES; - } --disable_warnings - eval $CHILD2_1_HA_AS_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_CHECK_HA_STATUS; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; --error 12511 INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); -eval $MASTER_1_CHECK_LINK_STATUS; -eval $MASTER_1_CHECK_LINK_FAILED_LOG; -eval $MASTER_1_CHECK_HA_STATUS; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; INSERT INTO ta_l (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --enable_query_log --enable_result_log - } -} --echo --echo recovery test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_CREATE_TABLES; - } - eval $CHILD2_1_HA_AS_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_AS_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_AS_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_AS_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } -} --connection master_1 -eval $MASTER_1_SET_OK_STATUS_AS_2_1; -eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l +CONNECTION='host "localhost", user "root", password "", + msi "5", mkd "2", alc "1", + database "auto_test_remote auto_test_remote2", lst "1 0"'; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; INSERT INTO ta_l (a, b, c) VALUES (8, 'g', '2011-05-05 21:33:30'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; DROP TABLE ta_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_2_1; +DROP TABLE IF EXISTS ta_l; --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol -eval $MASTER_1_CHANGE_HA_MON; +SELECT spider_flush_table_mon_cache(); --enable_ps2_protocol --echo @@ -854,24 +630,18 @@ eval $MASTER_1_CHANGE_HA_MON; --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; --connection child2_3 DROP DATABASE IF EXISTS auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ --connection child3_1 DROP DATABASE IF EXISTS auto_test_local; --connection child3_2 DROP DATABASE IF EXISTS auto_test_local; --connection child3_3 DROP DATABASE IF EXISTS auto_test_local; -} --disable_query_log --disable_result_log --source ha_test_deinit.inc @@ -879,6 +649,5 @@ if ($USE_CHILD_GROUP3) --enable_result_log --enable_query_log --enable_warnings -} --echo --echo end of test diff --git a/storage/spider/mysql-test/spider/t/ha_part.test b/storage/spider/mysql-test/spider/t/ha_part.test index c875ccfc80d..4a7361f2979 100644 --- a/storage/spider/mysql-test/spider/t/ha_part.test +++ b/storage/spider/mysql-test/spider/t/ha_part.test @@ -1,6 +1,4 @@ # This test tests for ha features -if ($USE_HA_TEST) -{ --disable_warnings --disable_query_log --disable_result_log @@ -8,17 +6,6 @@ if ($USE_HA_TEST) --source ha_test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source ha_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -26,8 +13,6 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -40,9 +25,6 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ --connection child3_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; @@ -55,158 +37,135 @@ if ($USE_CHILD_GROUP3) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; --connection child2_3 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} -if ($USE_CHILD_GROUP3) -{ - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 SELECT 1; --connection child3_2 SELECT 1; --connection child3_3 SELECT 1; - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } -} -if ($HAVE_PARTITION) -{ --echo --echo create table with partition test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_DROP_TABLES; - echo CHILD2_3_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_3_DROP_TABLES; +DROP TABLE IF EXISTS ta_r4; --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r4 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_P_2_1; +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_P_2_1; +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_P_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --enable_query_log --enable_result_log - } - } --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l2; @@ -218,12 +177,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_P_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='msi "5", mkd "2"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -234,430 +199,334 @@ if ($HAVE_PARTITION) --echo --echo select test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } --echo --echo fail-over test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_HA_DROP_TABLES; - } --disable_warnings - eval $CHILD2_3_HA_DROP_TABLES; +DROP TABLE IF EXISTS ta_r4; --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_CHECK_HA_STATUS; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; --error 12511 INSERT INTO ta_l2 (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_CHECK_LINK_FAILED_LOG; - eval $MASTER_1_CHECK_HA_STATUS; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; INSERT INTO ta_l2 (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --enable_query_log --enable_result_log - } - } --echo --echo recovery test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_HA_CREATE_TABLES; - } - eval $CHILD2_3_HA_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r4 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_RECOVERY_STATUS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 2"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --disable_view_protocol - eval $MASTER_1_COPY_TABLES_P_2_1; +SELECT spider_copy_tables('ta_l2#P#pt2', '0', '1'); --enable_view_protocol - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_SET_OK_STATUS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "0 1"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; INSERT INTO ta_l2 (a, b, c) VALUES (8, 'g', '2011-05-05 21:33:30'), (9, 'h', '2011-05-05 22:32:10'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; DROP TABLE ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } - } -} -if ($HAVE_PARTITION) -{ --echo --echo create table with partition test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_3_DROP_TABLES; - echo CHILD2_3_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_3_DROP_TABLES; +DROP TABLE IF EXISTS ta_r4; --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r4 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_1_CREATE_TABLES_HA_AS_P_2_1; +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2", alc "1"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_2_CREATE_TABLES_HA_AS_P_2_1; +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2", alc "1"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - eval $CHILD3_3_CREATE_TABLES_HA_AS_P_2_1; - if (!$OUTPUT_CHILD_GROUP3) - { +CREATE TABLE ta_l2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=Spider DEFAULT CHARSET=utf8 +COMMENT='msi "5", mkd "2", alc "1"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --enable_query_log --enable_result_log - } - } --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l2; @@ -669,12 +538,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_HA_AS_P_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='msi "5", mkd "2", alc "1"' + PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -685,307 +560,189 @@ if ($HAVE_PARTITION) --echo --echo select test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } --echo --echo fail-over test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_DROP_TABLES2; - } --disable_warnings - eval $CHILD2_1_HA_AS_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_CHECK_HA_STATUS; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; --error 12511 INSERT INTO ta_l2 (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); - eval $MASTER_1_CHECK_LINK_STATUS; - eval $MASTER_1_CHECK_LINK_FAILED_LOG; - eval $MASTER_1_CHECK_HA_STATUS; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; +SHOW STATUS LIKE 'Spider_mon_table_cache_version%'; INSERT INTO ta_l2 (a, b, c) VALUES (6, 'e', '2011-05-05 20:04:05'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_CHECK_LINK_STATUS; - eval $CHILD3_1_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_2 - eval $CHILD3_2_CHECK_LINK_STATUS; - eval $CHILD3_2_CHECK_LINK_FAILED_LOG; +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --connection child3_3 - eval $CHILD3_3_CHECK_LINK_STATUS; - eval $CHILD3_3_CHECK_LINK_FAILED_LOG; - if (!$OUTPUT_CHILD_GROUP3) - { +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; +SELECT db_name, table_name, link_id FROM mysql.spider_link_failed_log; --enable_query_log --enable_result_log - } - } --echo --echo recovery test - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_HA_AS_CREATE_TABLES2; - } - eval $CHILD2_1_HA_AS_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 - eval $CHILD3_1_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_2 - eval $CHILD3_2_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_2_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --connection child3_3 - eval $CHILD3_3_SET_OK_STATUS_AS_P_2_1; - eval $CHILD3_3_CHECK_LINK_STATUS; - if (!$OUTPUT_CHILD_GROUP3) - { +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; --enable_query_log --enable_result_log - } - } --connection master_1 - eval $MASTER_1_SET_OK_STATUS_AS_P_2_1; - eval $MASTER_1_CHECK_LINK_STATUS; +ALTER TABLE ta_l2 +PARTITION BY KEY(a) ( +PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3", + priority "1000"', +PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4", + priority "1000001", lst "1 0"' + ); +SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables +ORDER BY db_name, table_name, link_id; INSERT INTO ta_l2 (a, b, c) VALUES (8, 'g', '2011-05-05 21:33:30'), (9, 'h', '2011-05-05 22:32:10'); SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 ORDER BY a; DROP TABLE ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES; - eval $CHILD2_1_SELECT_TABLES2; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_3 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r4 ORDER BY a; --enable_query_log --enable_result_log - } - } - if ($USE_CHILD_GROUP3) - { - if (!$OUTPUT_CHILD_GROUP3) - { --disable_query_log --disable_result_log - } --connection child3_1 --disable_warnings - eval $CHILD3_1_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings --connection child3_2 --disable_warnings - eval $CHILD3_2_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings --connection child3_3 --disable_warnings - eval $CHILD3_3_DROP_TABLES_HA_P_2_1; +DROP TABLE IF EXISTS ta_l2; --enable_warnings - if (!$OUTPUT_CHILD_GROUP3) - { --enable_query_log --enable_result_log - } - } -} --connection master_1 - CREATE TABLE t (c INT) PARTITION BY LIST COLUMNS (c) (PARTITION p DEFAULT ENGINE=SPIDER); SHOW FIELDS FROM t; SHOW FIELDS FROM t; @@ -996,24 +753,18 @@ DROP TABLE t; --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; --connection child2_3 DROP DATABASE IF EXISTS auto_test_remote3; -} -if ($USE_CHILD_GROUP3) -{ --connection child3_1 DROP DATABASE IF EXISTS auto_test_local; --connection child3_2 DROP DATABASE IF EXISTS auto_test_local; --connection child3_3 DROP DATABASE IF EXISTS auto_test_local; -} --disable_query_log --disable_result_log --source ha_test_deinit.inc @@ -1021,6 +772,5 @@ if ($USE_CHILD_GROUP3) --enable_result_log --enable_query_log --enable_warnings -} --echo --echo end of test diff --git a/storage/spider/mysql-test/spider/t/ha_test_deinit.inc b/storage/spider/mysql-test/spider/t/ha_test_deinit.inc index 53d0409d066..1ea64a434a5 100644 --- a/storage/spider/mysql-test/spider/t/ha_test_deinit.inc +++ b/storage/spider/mysql-test/spider/t/ha_test_deinit.inc @@ -1,19 +1,12 @@ # get connection and exist engine test --echo for master_1 --connection master_1 ---source ../include/ha_deinit_master_1.inc --echo for child2 if ($USE_CHILD_GROUP2) { --echo child2_1 - --connection child2_1 - --source ../include/ha_deinit_child2_1.inc --echo child2_2 - --connection child2_2 - --source ../include/ha_deinit_child2_2.inc --echo child2_3 - --connection child2_3 - --source ../include/ha_deinit_child2_3.inc } --echo for child3 if ($USE_CHILD_GROUP3) diff --git a/storage/spider/mysql-test/spider/t/ha_test_init.inc b/storage/spider/mysql-test/spider/t/ha_test_init.inc index 70576ab16dc..4b836b03919 100644 --- a/storage/spider/mysql-test/spider/t/ha_test_init.inc +++ b/storage/spider/mysql-test/spider/t/ha_test_init.inc @@ -6,14 +6,8 @@ if ($USE_CHILD_GROUP2) { --echo child2_1 - --connection child2_1 - --source ../include/ha_init_child2_1.inc --echo child2_2 - --connection child2_2 - --source ../include/ha_init_child2_2.inc --echo child2_3 - --connection child2_3 - --source ../include/ha_init_child2_3.inc } --echo for child3 if ($USE_CHILD_GROUP3) diff --git a/storage/spider/mysql-test/spider/t/partition_cond_push.test b/storage/spider/mysql-test/spider/t/partition_cond_push.test index b5eceead130..3bfc20d4672 100644 --- a/storage/spider/mysql-test/spider/t/partition_cond_push.test +++ b/storage/spider/mysql-test/spider/t/partition_cond_push.test @@ -1,9 +1,4 @@ --source ../include/partition_cond_push_init.inc -if (!$HAVE_PARTITION) -{ - --source ../include/partition_cond_push_deinit.inc - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -12,110 +7,64 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; --connection child2_2 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; --connection child2_3 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +value int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_2_DROP_TABLES; echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +value int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_3_DROP_TABLES; echo CHILD2_3_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_3_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a; --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +value int NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -125,9 +74,14 @@ DROP TABLE IF EXISTS tbl_b; echo CREATE TABLE tbl_a ( value int NOT NULL ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( value int NOT NULL -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' + PARTITION BY KEY(value) ( +PARTITION pt1 COMMENT='srv "s_2_1"', +PARTITION pt2 COMMENT='srv "s_2_2"', +PARTITION pt3 COMMENT='srv "s_2_3"' + ); --enable_query_log INSERT INTO tbl_a (value) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (value) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -135,64 +89,26 @@ INSERT INTO tbl_a (value) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(2 --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT value FROM tbl_a WHERE value < 100; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT value FROM tbl_a ORDER BY value; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; +SELECT value FROM tbl_a ORDER BY value; --connection child2_3 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_3_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT value FROM tbl_a ORDER BY value; --enable_ps2_protocol --echo @@ -200,27 +116,15 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_3 DROP DATABASE IF EXISTS auto_test_remote3; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/partition_cond_push_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/partition_fulltext.test b/storage/spider/mysql-test/spider/t/partition_fulltext.test index 664617d2451..2dcf14cb8f2 100644 --- a/storage/spider/mysql-test/spider/t/partition_fulltext.test +++ b/storage/spider/mysql-test/spider/t/partition_fulltext.test @@ -1,9 +1,4 @@ --source ../include/partition_fulltext_init.inc -if (!$HAVE_PARTITION) -{ - --source ../include/partition_fulltext_deinit.inc - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -12,110 +7,73 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; --connection child2_2 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; --connection child2_3 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +words text NOT NULL, +PRIMARY KEY (pkey), +FULLTEXT (words) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_2_DROP_TABLES; echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +words text NOT NULL, +PRIMARY KEY (pkey), +FULLTEXT (words) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_3_DROP_TABLES; echo CHILD2_3_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_3_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a; --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +words text NOT NULL, +PRIMARY KEY (pkey), +FULLTEXT (words) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -128,75 +86,42 @@ echo CREATE TABLE tbl_a ( PRIMARY KEY (pkey), FULLTEXT (words) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, words text NOT NULL, PRIMARY KEY (pkey), FULLTEXT (words) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", bka_mode "1"' + PARTITION BY KEY(pkey) ( +PARTITION pt1 COMMENT='srv "s_2_1"', +PARTITION pt2 COMMENT='srv "s_2_2"', +PARTITION pt3 COMMENT='srv "s_2_3"' + ); --enable_query_log INSERT INTO tbl_a (pkey, words) VALUES (0, 'abc'),(1, 'def'),(2, 'ghi'),(3, 'jkl'),(4, 'mno'),(5, 'pqr'),(6, 'stu'),(7, 'vwx'); --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT pkey, words FROM tbl_a WHERE match(words) against('+ghi' in boolean mode); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_3 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_3_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_a ORDER BY pkey; --enable_ps2_protocol --echo @@ -204,27 +129,15 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_3 DROP DATABASE IF EXISTS auto_test_remote3; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/partition_fulltext_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test b/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test index e1916e1d9b0..d11b519b78b 100644 --- a/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test +++ b/storage/spider/mysql-test/spider/t/partition_join_pushdown_for_single_partition.test @@ -1,9 +1,4 @@ --source ../include/partition_join_pushdown_for_single_partition_init.inc -if (!$HAVE_PARTITION) -{ - --source ../include/partition_join_pushdown_for_single_partition_deinit.inc - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -12,122 +7,88 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; --connection child2_2 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; --connection child2_3 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_DROP_TABLES2; echo CHILD2_1_CREATE_TABLES; echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS tbl_a; +DROP TABLE IF EXISTS tbl_b; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +value int NOT NULL, +PRIMARY KEY(value) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE tbl_b ( +value2 int NOT NULL, +PRIMARY KEY(value2) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_2_DROP_TABLES; echo CHILD2_2_DROP_TABLES2; echo CHILD2_2_CREATE_TABLES; echo CHILD2_2_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; - eval $CHILD2_2_DROP_TABLES2; +DROP TABLE IF EXISTS tbl_a; +DROP TABLE IF EXISTS tbl_b; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - eval $CHILD2_2_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +value int NOT NULL, +PRIMARY KEY(value) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE tbl_b ( +value2 int NOT NULL, +PRIMARY KEY(value2) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_3_DROP_TABLES; echo CHILD2_3_DROP_TABLES2; echo CHILD2_3_CREATE_TABLES; echo CHILD2_3_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_3_DROP_TABLES; - eval $CHILD2_3_DROP_TABLES2; +DROP TABLE IF EXISTS tbl_a; +DROP TABLE IF EXISTS tbl_b; --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - eval $CHILD2_3_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +value int NOT NULL, +PRIMARY KEY(value) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE tbl_b ( +value2 int NOT NULL, +PRIMARY KEY(value2) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -138,18 +99,28 @@ echo CREATE TABLE tbl_a ( value int NOT NULL, PRIMARY KEY(value) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( value int NOT NULL, PRIMARY KEY(value) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' + PARTITION BY RANGE(value) ( +PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1"', +PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_2"', +PARTITION pt3 VALUES LESS THAN (15) COMMENT='srv "s_2_3"' + ); echo CREATE TABLE tbl_b ( value2 int NOT NULL, PRIMARY KEY(value2) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_b ( +CREATE TABLE tbl_b ( value2 int NOT NULL, PRIMARY KEY(value2) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b"' + PARTITION BY RANGE(value2) ( +PARTITION pt1 VALUES LESS THAN (5) COMMENT='srv "s_2_1"', +PARTITION pt2 VALUES LESS THAN (10) COMMENT='srv "s_2_2"', +PARTITION pt3 VALUES LESS THAN (15) COMMENT='srv "s_2_3"' + ); --enable_query_log insert into tbl_a values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); @@ -159,43 +130,21 @@ insert into tbl_b values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); --disable_ps2_protocol SELECT sum(a.value), count(b.value2) FROM tbl_a a, tbl_b b WHERE a.value = b.value2 AND a.value = 5; SELECT sum(a.value), count(b.value2) FROM tbl_a a, tbl_b b WHERE a.value = 5 and b.value2 = 5; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT value FROM tbl_a ORDER BY value; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; +SELECT value FROM tbl_a ORDER BY value; --connection child2_3 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_3_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT value FROM tbl_a ORDER BY value; --enable_ps2_protocol --echo @@ -203,27 +152,15 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_3 DROP DATABASE IF EXISTS auto_test_remote3; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/partition_join_pushdown_for_single_partition_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/partition_mrr.test b/storage/spider/mysql-test/spider/t/partition_mrr.test index 840c19d2104..636e60db47e 100644 --- a/storage/spider/mysql-test/spider/t/partition_mrr.test +++ b/storage/spider/mysql-test/spider/t/partition_mrr.test @@ -1,10 +1,5 @@ --source include/no_protocol.inc --source ../include/partition_mrr_init.inc -if (!$HAVE_PARTITION) -{ - --source ../include/partition_mrr_deinit.inc - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -13,110 +8,82 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; --connection child2_2 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; --connection child2_3 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS auto_test_remote3; CREATE DATABASE auto_test_remote3; USE auto_test_remote3; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLES; echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a ; +DROP TABLE IF EXISTS tbl_b; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_2_DROP_TABLES; echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a ; +DROP TABLE IF EXISTS tbl_b; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_3 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_3_DROP_TABLES; echo CHILD2_3_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_3_DROP_TABLES; +DROP TABLE IF EXISTS tbl_a ; +DROP TABLE IF EXISTS tbl_b; --enable_warnings - eval $CHILD2_3_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -131,14 +98,24 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", bka_mode "1"' + PARTITION BY KEY(pkey) ( +PARTITION pt1 COMMENT='srv "s_2_1"', +PARTITION pt2 COMMENT='srv "s_2_2"', +PARTITION pt3 COMMENT='srv "s_2_3"' + ); +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", bka_mode "1"' + PARTITION BY KEY(pkey) ( +PARTITION pt1 COMMENT='srv "s_2_2"', +PARTITION pt2 COMMENT='srv "s_2_3"', +PARTITION pt3 COMMENT='srv "s_2_1"' + ); --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -149,62 +126,31 @@ INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29 --echo --echo select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey+0 = b.pkey+0 ORDER BY a.pkey; # MDEV-29947 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } +SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey+0 = b.pkey+0 ORDER BY a.pkey; +# MDEV-29947 --connection child2_1 - if ($USE_GENERAL_LOG) - { --replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; +eval +SELECT pkey FROM tbl_a ORDER BY pkey $STR_SEMICOLON +SELECT pkey FROM tbl_b ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; +eval +SELECT pkey FROM tbl_a ORDER BY pkey $STR_SEMICOLON +SELECT pkey FROM tbl_b ORDER BY pkey; --connection child2_3 - if ($USE_GENERAL_LOG) - { --replace_regex /tmp_spider_bka_(0x)?[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_3_SELECT_ARGUMENT1; - } - eval $CHILD2_3_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; +eval +SELECT pkey FROM tbl_a ORDER BY pkey $STR_SEMICOLON +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --echo @@ -212,27 +158,15 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_3 DROP DATABASE IF EXISTS auto_test_remote3; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/partition_mrr_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/pushdown_not_like.test b/storage/spider/mysql-test/spider/t/pushdown_not_like.test index 61b3eb90ec2..0cb4a4292d1 100644 --- a/storage/spider/mysql-test/spider/t/pushdown_not_like.test +++ b/storage/spider/mysql-test/spider/t/pushdown_not_like.test @@ -12,52 +12,33 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo create table select test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; SET @old_log_output = @@global.log_output; TRUNCATE TABLE mysql.general_log; set global log_output = 'TABLE'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings @@ -70,12 +51,15 @@ echo CREATE TABLE ta_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l (a, b, c) VALUES (1, 'a', '2018-11-01 10:21:39'), @@ -84,40 +68,22 @@ INSERT INTO ta_l (a, b, c) VALUES --echo --echo spider not like bug fix test -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol select * from ta_l where b not like 'a%'; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select%'; --enable_view_protocol - } -} --enable_ps2_protocol --echo @@ -125,13 +91,9 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; SET GLOBAL log_output = @old_log_output; -} - --disable_query_log --disable_result_log diff --git a/storage/spider/mysql-test/spider/t/quick_mode_0.test b/storage/spider/mysql-test/spider/t/quick_mode_0.test index b7f923ac609..7665d77d14d 100644 --- a/storage/spider/mysql-test/spider/t/quick_mode_0.test +++ b/storage/spider/mysql-test/spider/t/quick_mode_0.test @@ -5,72 +5,38 @@ --disable_warnings CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote; USE auto_test_remote; --connection child2_2 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_CREATE_TABLES; - } - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_2_CREATE_TABLES; - } - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE tbl_a ( @@ -81,14 +47,14 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_2"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -99,188 +65,74 @@ INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29 --echo --echo select test 1 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; +set session spider_quick_page_byte= 6; --echo --echo select test 2 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; +set session spider_quick_page_byte= 0; --echo --echo select test 3 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_view_protocol --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; - } - eval $CHILD2_1_SELECT_TABLES; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --enable_view_protocol @@ -289,21 +141,12 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/quick_mode_0_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/quick_mode_1.test b/storage/spider/mysql-test/spider/t/quick_mode_1.test index 979679249bc..5650cc21bf3 100644 --- a/storage/spider/mysql-test/spider/t/quick_mode_1.test +++ b/storage/spider/mysql-test/spider/t/quick_mode_1.test @@ -5,72 +5,38 @@ --disable_warnings CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote; USE auto_test_remote; --connection child2_2 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_CREATE_TABLES; - } - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_2_CREATE_TABLES; - } - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE tbl_a ( @@ -81,14 +47,14 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_2"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -99,191 +65,77 @@ INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29 --echo --echo select test 1 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; +set session spider_quick_page_byte= 6; --echo --echo select test 2 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; +set session spider_quick_page_byte= 0; --echo --echo select test 3 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --echo @@ -291,21 +143,12 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/quick_mode_1_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/quick_mode_2.test b/storage/spider/mysql-test/spider/t/quick_mode_2.test index 2db2d1415bf..1194c3048e3 100644 --- a/storage/spider/mysql-test/spider/t/quick_mode_2.test +++ b/storage/spider/mysql-test/spider/t/quick_mode_2.test @@ -5,72 +5,38 @@ --disable_warnings CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote; USE auto_test_remote; --connection child2_2 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_CREATE_TABLES; - } - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_2_CREATE_TABLES; - } - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE tbl_a ( @@ -81,14 +47,14 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_2"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -99,191 +65,77 @@ INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29 --echo --echo select test 1 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; +set session spider_quick_page_byte= 6; --echo --echo select test 2 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; +set session spider_quick_page_byte= 0; --echo --echo select test 3 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --echo @@ -291,21 +143,12 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/quick_mode_2_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/quick_mode_3.test b/storage/spider/mysql-test/spider/t/quick_mode_3.test index bb9bc8c6e48..81d5e3f9d31 100644 --- a/storage/spider/mysql-test/spider/t/quick_mode_3.test +++ b/storage/spider/mysql-test/spider/t/quick_mode_3.test @@ -5,72 +5,38 @@ --disable_warnings CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote; USE auto_test_remote; --connection child2_2 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_CREATE_TABLES; - } - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_2_CREATE_TABLES; - } - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_b ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE tbl_a ( @@ -81,14 +47,14 @@ echo CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_2; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_b ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; +CREATE TABLE tbl_b ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_2"'; --enable_query_log INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); INSERT INTO tbl_a (pkey) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19); @@ -99,191 +65,77 @@ INSERT INTO tbl_b (pkey) VALUES (20),(21),(22),(23),(24),(25),(26),(27),(28),(29 --echo --echo select test 1 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_6; +set session spider_quick_page_byte= 6; --echo --echo select test 2 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --connection master_1 -eval $MASTER_1_SET_QUICK_PAGE_BYTE_0; +set session spider_quick_page_byte= 0; --echo --echo select test 3 -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a.pkey FROM tbl_a a, tbl_b b WHERE a.pkey = b.pkey; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLES; +SELECT pkey FROM tbl_a ORDER BY pkey; --connection child2_2 - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /tmp_spider_bka_0x[0-9a-f]*/tmp_spider_bka_xxxx/ - eval $CHILD2_2_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_2_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT pkey FROM tbl_b ORDER BY pkey; --enable_ps2_protocol --echo @@ -291,21 +143,12 @@ if ($USE_CHILD_GROUP2) --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/quick_mode_3_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/slave_test_deinit.inc b/storage/spider/mysql-test/spider/t/slave_test_deinit.inc index e9d99b7a960..4bbc7ec420d 100644 --- a/storage/spider/mysql-test/spider/t/slave_test_deinit.inc +++ b/storage/spider/mysql-test/spider/t/slave_test_deinit.inc @@ -2,5 +2,4 @@ --echo for slave1_1 --connection slave1_1 STOP SLAVE; ---source ../include/deinit_slave1_1.inc --disconnect slave1_1 diff --git a/storage/spider/mysql-test/spider/t/slave_test_init.inc b/storage/spider/mysql-test/spider/t/slave_test_init.inc index 84de2c7d2e6..4afbe361baf 100644 --- a/storage/spider/mysql-test/spider/t/slave_test_init.inc +++ b/storage/spider/mysql-test/spider/t/slave_test_init.inc @@ -7,7 +7,6 @@ SET SESSION sql_log_bin= 0; --let $TEST_ENGINE_TYPE= $SLAVE1_1_ENGINE_TYPE --source have_partition.inc --source have_trigger.inc ---source ../include/init_slave1_1.inc --source have_engine.inc --let $SLAVE1_1_SLAVE_STATUS=`SHOW SLAVE STATUS` if (!$SLAVE1_1_SLAVE_STATUS) diff --git a/storage/spider/mysql-test/spider/t/slave_trx_isolation.test b/storage/spider/mysql-test/spider/t/slave_trx_isolation.test index b88d038de46..fa14db7e0f1 100644 --- a/storage/spider/mysql-test/spider/t/slave_trx_isolation.test +++ b/storage/spider/mysql-test/spider/t/slave_trx_isolation.test @@ -5,76 +5,43 @@ --disable_warnings CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --enable_warnings --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_CREATE_TABLES; - } - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +pkey int NOT NULL, +PRIMARY KEY (pkey) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; --connection master_1 SET SESSION sql_log_bin= 0; -} --disable_query_log echo CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE2 MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log -if ($USE_REPLICATION) -{ SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_query_log @@ -82,71 +49,39 @@ if ($USE_REPLICATION) pkey int NOT NULL, PRIMARY KEY (pkey) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; - eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( pkey int NOT NULL, PRIMARY KEY (pkey) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"'; --enable_query_log --connection master_1 -} INSERT INTO tbl_a (pkey) VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; --connection master_1 SET SESSION sql_log_bin= 0; -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 --disable_ps2_protocol - if ($USE_GENERAL_LOG) - { --disable_view_protocol --replace_regex /-[0-9a-f]{12}-[0-9a-f]+-/-xxxxxxxxxxxx-xxxxx-/ - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%set %'; --enable_view_protocol - } --enable_ps2_protocol - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} -if ($USE_REPLICATION) -{ +SELECT pkey FROM tbl_a ORDER BY pkey; --connection slave1_1 SELECT pkey FROM tbl_a ORDER BY pkey; -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source ../include/slave_trx_isolation_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes.test b/storage/spider/mysql-test/spider/t/spider3_fixes.test index eb48b0c89a2..2482a613de3 100644 --- a/storage/spider/mysql-test/spider/t/spider3_fixes.test +++ b/storage/spider/mysql-test/spider/t/spider3_fixes.test @@ -14,15 +14,10 @@ source include/have_log_bin.inc; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -31,74 +26,40 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} - --echo --echo 3.1 --echo auto_increment -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_1; --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 2; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; @@ -106,7 +67,6 @@ if ($USE_REPLICATION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log -} --disable_warnings DROP TABLE IF EXISTS t1, t2; --enable_warnings @@ -121,20 +81,26 @@ echo CREATE TABLE t2 ( ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; echo MASTER_1_AUTO_INCREMENT_INCREMENT2; echo MASTER_1_AUTO_INCREMENT_OFFSET2; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; -eval CREATE TABLE t2 ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "0", tbl "t1_1", srv "s_2_1"'; +CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "0", tbl "t1_1", srv "s_2_1"'; --disable_ps_protocol -eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +SET SESSION AUTO_INCREMENT_INCREMENT = 777 ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"'); +SET SESSION AUTO_INCREMENT_OFFSET = 777 ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"'); --enable_ps_protocol -if ($USE_REPLICATION) -{ SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_warnings @@ -148,16 +114,15 @@ if ($USE_REPLICATION) id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t2 ( +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT ''; +CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT ''; --connection master_1 -} --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); @@ -167,28 +132,28 @@ SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 (id) VALUES (null); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 (id) VALUES (null); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); SELECT id FROM t1 ORDER BY id; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); @@ -204,14 +169,14 @@ SELECT id FROM t2 ORDER BY id; SET INSERT_ID=5000; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; -eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; -eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 () VALUES (); SELECT LAST_INSERT_ID(); @@ -222,8 +187,6 @@ SELECT MAX(id) FROM t1; INSERT INTO t2 (id) VALUES (1000); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; @@ -232,39 +195,15 @@ if ($USE_REPLICATION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT id FROM t1_1 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --enable_query_log --enable_result_log - } -} - --echo # --echo # MDEV-28225 Disallow user to create Spider temporary table @@ -281,18 +220,12 @@ CREATE TEMPORARY TABLE t1 ( --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source slave_test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/t/spider3_fixes_part.test index bcd85f42b81..ec8dd795843 100644 --- a/storage/spider/mysql-test/spider/t/spider3_fixes_part.test +++ b/storage/spider/mysql-test/spider/t/spider3_fixes_part.test @@ -7,17 +7,6 @@ source include/have_log_bin.inc; --source slave_test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source slave_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -25,15 +14,10 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -42,97 +26,49 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} - --echo auto_increment with partition -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_1; --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 2; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_INCREMENT_TABLES1; - echo CHILD2_2_CREATE_INCREMENT_TABLES1; - echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_2_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_2_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_2; --enable_warnings - eval $CHILD2_2_CREATE_INCREMENT_TABLES1; - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 3; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 - if ($USE_REPLICATION) - { save_master_pos; --connection slave1_1 sync_with_master; @@ -140,7 +76,6 @@ if ($HAVE_PARTITION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log - } --disable_warnings DROP TABLE IF EXISTS t1, t2; --enable_warnings @@ -155,20 +90,38 @@ if ($HAVE_PARTITION) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; echo MASTER_1_AUTO_INCREMENT_INCREMENT2; echo MASTER_1_AUTO_INCREMENT_OFFSET2; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t2 ( +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "0"' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='tbl "t1_1", srv "s_2_1"', +PARTITION pt2 VALUES IN (1) +COMMENT='tbl "t1_2", srv "s_2_2"' + ); +CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "0"' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='tbl "t1_1", srv "s_2_1"', +PARTITION pt2 VALUES IN (1) +COMMENT='tbl "t1_2", srv "s_2_2"' + ); --disable_ps_protocol - eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; - eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +SET SESSION AUTO_INCREMENT_INCREMENT = 777 ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"'); +SET SESSION AUTO_INCREMENT_OFFSET = 777 ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"'); --enable_ps_protocol - if ($USE_REPLICATION) - { SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_warnings @@ -182,16 +135,27 @@ if ($HAVE_PARTITION) id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t2 ( +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT '' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='', +PARTITION pt2 VALUES IN (1) +COMMENT='' + ); +CREATE TABLE t2 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT '' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='', +PARTITION pt2 VALUES IN (1) +COMMENT='' + ); --connection master_1 - } --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); @@ -201,28 +165,28 @@ if ($HAVE_PARTITION) SELECT MAX(id) FROM t2; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 (id) VALUES (null); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 (id) VALUES (null); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); SELECT id FROM t1 ORDER BY id; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 () VALUES (),(),(),(); SELECT LAST_INSERT_ID(); @@ -238,14 +202,14 @@ if ($HAVE_PARTITION) SET INSERT_ID=5000; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET3; - eval $MASTER_1_AUTO_INCREMENT_OFFSET3; +SET SESSION AUTO_INCREMENT_OFFSET = 1; --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; --disable_query_log echo MASTER_1_AUTO_INCREMENT_OFFSET4; - eval $MASTER_1_AUTO_INCREMENT_OFFSET4; +SET SESSION AUTO_INCREMENT_OFFSET = 777; --enable_query_log INSERT INTO t2 () VALUES (); SELECT LAST_INSERT_ID(); @@ -256,8 +220,6 @@ if ($HAVE_PARTITION) INSERT INTO t2 (id) VALUES (1000); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t2; - if ($USE_REPLICATION) - { save_master_pos; --connection slave1_1 sync_with_master; @@ -266,76 +228,32 @@ if ($HAVE_PARTITION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log - } - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } +SELECT id FROM t1_1 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_2_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT id FROM t1_2 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --enable_query_log --enable_result_log - } - } -} - --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source slave_test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/spider_fixes.test b/storage/spider/mysql-test/spider/t/spider_fixes.test index a5a8f228dc6..aa4f5b0802b 100644 --- a/storage/spider/mysql-test/spider/t/spider_fixes.test +++ b/storage/spider/mysql-test/spider/t/spider_fixes.test @@ -14,15 +14,10 @@ source include/have_log_bin.inc; DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -31,65 +26,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tb_l; @@ -101,12 +70,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -121,145 +90,76 @@ DROP TABLE IF EXISTS ta_l; echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l SELECT a, b, c FROM tb_l; --echo --echo 2.13 --echo select table with "order by desc" and "<" -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a < 5 ORDER BY a DESC LIMIT 3; --enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo select table with "order by desc" and "<=" -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_ps2_protocol SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a <= 5 ORDER BY a DESC LIMIT 3; --enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo 2.14 --echo update table with range scan and split_read -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l SET c = '2000-02-02 00:00:00' WHERE a > 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l ORDER BY a; @@ -270,30 +170,19 @@ TRUNCATE TABLE ta_l; --disable_warnings DROP TABLE IF EXISTS ta_l; --enable_warnings -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES6; - echo CHILD2_1_CREATE_TABLES6; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES6; +DROP TABLE IF EXISTS ta_r_3; --enable_warnings - eval $CHILD2_1_CREATE_TABLES6; +CREATE TABLE ta_r_3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10' + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE ta_l ( @@ -302,324 +191,160 @@ echo CREATE TABLE ta_l ( c datetime DEFAULT NULL, PRIMARY KEY (a, b, c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT5_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a int(11) NOT NULL DEFAULT '0', b char(1) DEFAULT NULL, c datetime DEFAULT NULL, PRIMARY KEY (a, b, c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT5_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_3"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l SELECT a, b, c FROM tb_l; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a >= 4 AND b = 'd' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a > 4 AND b = 'c' AND c = '2001-12-31 23:59:59'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b <= 'd' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b < 'e' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND b = 'b' AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND b = 'b' AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b >= 'b' AND b <= 'd' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a = 4 AND b > 'b' AND b < 'e' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a <= 4 AND a >= 1 AND b >= 'b' AND c = '2003-11-30 05:01:03'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l FORCE INDEX(PRIMARY) WHERE a < 4 AND a > 1 AND b >= 'b' AND c = '2000-01-01 00:00:00'; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo 2.16 --echo auto_increment insert with trigger -if ($HAVE_TRIGGER) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES4; - echo CHILD2_1_CREATE_TABLES4; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES4; +DROP TABLE IF EXISTS ta_r_auto_inc; --enable_warnings - eval $CHILD2_1_CREATE_TABLES4; +CREATE TABLE ta_r_auto_inc ( +a INT AUTO_INCREMENT, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l_auto_inc ( @@ -628,139 +353,87 @@ if ($HAVE_TRIGGER) c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_2_1; - eval CREATE TABLE ta_l_auto_inc ( +eval +CREATE TABLE ta_l_auto_inc ( a INT AUTO_INCREMENT, b CHAR(1) DEFAULT 'c', c DATETIME DEFAULT '1999-10-10 10:10:10', PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_auto_inc"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; echo CREATE TABLE tc_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; - eval CREATE TABLE tc_l ( +CREATE TABLE tc_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log --eval CREATE TRIGGER ins_ta_l_auto_inc AFTER INSERT ON ta_l_auto_inc FOR EACH ROW BEGIN INSERT INTO tc_l (a, b, c) VALUES (NEW.a, NEW.b, NEW.c); END; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 INSERT INTO ta_l_auto_inc (a, b, c) VALUES (NULL, 's', '2008-12-31 20:59:59'); - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES4; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r_auto_inc +ORDER BY a; --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM tc_l ORDER BY a; -} --echo --echo 2.17 --echo engine-condition-pushdown with "or" and joining -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l WHERE a = 1 OR a IN (SELECT a FROM tb_l); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo 2.23 --echo index merge -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE ta_l_int ( @@ -771,59 +444,38 @@ echo CREATE TABLE ta_l_int ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( +eval +CREATE TABLE ta_l_int ( a INT AUTO_INCREMENT, b INT DEFAULT 10, c INT DEFAULT 11, PRIMARY KEY(a), KEY idx1(b), KEY idx2(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo 2.24 @@ -840,78 +492,35 @@ echo CREATE TABLE ta_l_int ( KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -if ($MASTER_1_NEEDPK) -{ - --error ER_REQUIRES_PRIMARY_KEY - eval CREATE TABLE ta_l_int ( +eval +CREATE TABLE ta_l_int ( a INT NOT NULL, b INT DEFAULT 10, c INT DEFAULT 11, KEY idx1(b), KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - PRIMARY KEY(a), - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; -} -if (!$MASTER_1_NEEDPK) -{ - eval CREATE TABLE ta_l_int ( - a INT NOT NULL, - b INT DEFAULT 10, - c INT DEFAULT 11, - KEY idx1(b), - KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; -} +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log SELECT a, b, c FROM ta_l_int ORDER BY a; INSERT INTO ta_l_int (a, b, c) VALUES (0, 2, 3); INSERT INTO ta_l_int (a, b, c) VALUES (18, 2, 3); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 UPDATE ta_l_int SET c = 4 WHERE b = 2; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 SELECT a, b, c FROM ta_l_int ORDER BY a; @@ -920,75 +529,47 @@ SELECT a, b, c FROM ta_l_int ORDER BY a; --echo 2.25 --echo direct order limit --connection master_1 -eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; +SHOW STATUS LIKE 'Spider_direct_order_limit'; --disable_ps2_protocol SELECT a, b, c FROM ta_l_int ORDER BY a LIMIT 3; --enable_ps2_protocol -eval $MASTER_1_CHECK_DIRECT_ORDER_LIMIT_STATUS; - +SHOW STATUS LIKE 'Spider_direct_order_limit'; --echo --echo 2.26 --echo lock tables -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_LOCK_TABLES1; - echo CHILD2_1_DROP_LOCK_TABLES2; - echo CHILD2_1_CREATE_LOCK_TABLES1; - echo CHILD2_1_CREATE_LOCK_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_LOCK_TABLES1; - eval $CHILD2_1_DROP_LOCK_TABLES2; +DROP TABLE IF EXISTS t1_1; +DROP TABLE IF EXISTS t2_2; --enable_warnings - eval $CHILD2_1_CREATE_LOCK_TABLES1; - eval $CHILD2_1_CREATE_LOCK_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2_2 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_LOCK_TABLES1; - echo CHILD2_2_DROP_LOCK_TABLES2; - echo CHILD2_2_CREATE_LOCK_TABLES1; - echo CHILD2_2_CREATE_LOCK_TABLES2; - } --disable_warnings - eval $CHILD2_2_DROP_LOCK_TABLES1; - eval $CHILD2_2_DROP_LOCK_TABLES2; +DROP TABLE IF EXISTS t1_2; +DROP TABLE IF EXISTS t2_1; --enable_warnings - eval $CHILD2_2_CREATE_LOCK_TABLES1; - eval $CHILD2_2_CREATE_LOCK_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_2 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TABLE t2_1 ( +id int(11) NOT NULL, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS t1; @@ -999,18 +580,18 @@ echo CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'tbl "t1_1 t1_2", srv "s_2_1 s_2_2"'; echo CREATE TABLE t2 ( id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2; -eval CREATE TABLE t2 ( +CREATE TABLE t2 ( id int(11) NOT NULL, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_LOCK2; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'tbl "t2_1 t2_2", srv "s_2_2 s_2_1"'; --enable_query_log LOCK TABLES t1 READ, t2 READ; UNLOCK TABLES; @@ -1018,45 +599,22 @@ UNLOCK TABLES; --echo --echo auto_increment -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_1; --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 2; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; @@ -1064,7 +622,6 @@ if ($USE_REPLICATION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log -} --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -1075,16 +632,22 @@ echo CREATE TABLE t1 ( ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_1; echo MASTER_1_AUTO_INCREMENT_INCREMENT2; echo MASTER_1_AUTO_INCREMENT_OFFSET2; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "0", tbl "t1_1", srv "s_2_1"'; --disable_ps_protocol -eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; -eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +SET SESSION AUTO_INCREMENT_INCREMENT = 777 ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"'); +SET SESSION AUTO_INCREMENT_OFFSET = 777 ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"'); --enable_ps_protocol -if ($USE_REPLICATION) -{ SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_warnings @@ -1094,12 +657,11 @@ if ($USE_REPLICATION) id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT ''; --connection master_1 -} --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); @@ -1126,8 +688,6 @@ SELECT MAX(id) FROM t1; INSERT INTO t1 (id) VALUES (1000); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; -if ($USE_REPLICATION) -{ save_master_pos; --connection slave1_1 sync_with_master; @@ -1136,47 +696,21 @@ if ($USE_REPLICATION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT id FROM t1_1 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --enable_query_log --enable_result_log - } -} - --echo --echo read only let $MASTER_1_ENGINE_IS_SPIDER= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'Spider' OR '$MASTER_1_HIDDEN_ENGINE_TYPE' = 'Spider', 1, 0)`; -if ($MASTER_1_ENGINE_IS_SPIDER) -{ --connection master_1 --disable_warnings DROP TABLE IF EXISTS t1; @@ -1186,35 +720,27 @@ if ($MASTER_1_ENGINE_IS_SPIDER) id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_READONLY1_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_READONLY1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'read_only_mode "1", tbl "t1_1", srv "s_2_1"'; --let $MIN_VAL= `SELECT MIN(id) FROM t1` --enable_query_log SELECT id FROM t1 ORDER BY id; --error 12518 INSERT INTO t1 (id) VALUES (1); --error 12518 - eval UPDATE t1 SET id = 4 WHERE id = $MIN_VAL; +UPDATE t1 SET id = 4 WHERE id = 777; --error 12518 - eval DELETE FROM t1 WHERE id = $MIN_VAL; +DELETE FROM t1 WHERE id = 777; --error 12518 DELETE FROM t1; --error 12518 TRUNCATE t1; -} -if (!$MASTER_1_ENGINE_IS_SPIDER) -{ - --echo skipped -} - --echo --echo 2.27 --echo error mode -if ($MASTER_1_ENGINE_IS_SPIDER) -{ --connection master_1 --disable_warnings DROP TABLE IF EXISTS t1; @@ -1224,48 +750,35 @@ if ($MASTER_1_ENGINE_IS_SPIDER) id int(11) NOT NULL, PRIMARY KEY (id) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_ERROR_MODE1_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_ERROR_MODE1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'erm "1", ewm "1", tbl "ter1_1", srv "s_2_1"'; --enable_query_log SELECT id FROM t1 ORDER BY id; INSERT INTO t1 (id) VALUES (1); DELETE FROM t1; TRUNCATE t1; -} -if (!$MASTER_1_ENGINE_IS_SPIDER) -{ - --echo skipped -} - --echo --echo 3.0 --echo is null -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TEXT_KEY_TABLES1; - echo CHILD2_1_CREATE_TEXT_KEY_TABLES1; - } --disable_warnings - eval $CHILD2_1_DROP_TEXT_KEY_TABLES1; +DROP TABLE IF EXISTS t1; --enable_warnings - eval $CHILD2_1_CREATE_TEXT_KEY_TABLES1; +CREATE TABLE t1 ( +a VARCHAR(255), +b VARCHAR(255), +c VARCHAR(255), +KEY idx1(a,b), +KEY idx2(b), +PRIMARY KEY(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS t1; @@ -1279,14 +792,14 @@ echo CREATE TABLE t1 ( KEY idx2(b), PRIMARY KEY(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_TEXT_KEY1_1; -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( a VARCHAR(255), b VARCHAR(255), c VARCHAR(255), KEY idx1(a,b), KEY idx2(b), PRIMARY KEY(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_TEXT_KEY1_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'tbl "t1", srv "s_2_1"'; --enable_query_log insert into t1 values (null, null, '2048'); insert into t1 values ('1', '1', '1'); @@ -1301,47 +814,22 @@ insert into t1 select a + 128, b + 128, c + 128 from t1; insert into t1 select a + 256, b + 256, c + 256 from t1; insert into t1 select a + 512, b + 512, c + 512 from t1; flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 select a from t1 where a is null order by a limit 30; select b from t1 where b is null order by b limit 30; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a FROM t1 ORDER BY a; --enable_query_log --enable_result_log - } -} - --echo --echo direct_order_limit @@ -1357,66 +845,34 @@ insert into t1 select a, b + 32, c + 32 from t1; insert into t1 select a, b + 64, c + 64 from t1; insert into t1 select a, b + 128, c + 128 from t1; flush tables; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 select a, b, c from t1 where a = '10' and b <> '100' order by c desc limit 5; select a, c from t1 where a = '10' order by b desc limit 5; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TEXT_PK_TABLES1; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a FROM t1 ORDER BY a; --enable_query_log --enable_result_log - } -} - --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} - # MDEV-27039 LOCK_global_system_variables attempted to re-acquire # The test proves no assert anymore. diff --git a/storage/spider/mysql-test/spider/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/t/spider_fixes_part.test index 9604f83b283..330f48480c9 100644 --- a/storage/spider/mysql-test/spider/t/spider_fixes_part.test +++ b/storage/spider/mysql-test/spider/t/spider_fixes_part.test @@ -7,17 +7,6 @@ source include/have_log_bin.inc; --source slave_test_init.inc --enable_result_log --enable_query_log -if (!$HAVE_PARTITION) -{ - --disable_query_log - --disable_result_log - --source slave_test_deinit.inc - --source test_deinit.inc - --enable_result_log - --enable_query_log - --enable_warnings - skip Test requires partitioning; -} --echo --echo drop and create databases @@ -25,15 +14,10 @@ if (!$HAVE_PARTITION) DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -42,30 +26,20 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings @@ -78,12 +52,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -95,59 +69,32 @@ INSERT INTO tb_l (a, b, c) VALUES --echo --echo 2.17 --echo partition with sort -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( @@ -156,103 +103,66 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo --echo 2.23 --echo partition update with moving partition -if ($HAVE_PARTITION) -{ --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l2; --enable_warnings - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l2 ( @@ -261,89 +171,72 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00'); UPDATE ta_l2 SET a = 4 WHERE a = 3; SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%update %'; SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%delete %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo index merge with partition -if ($HAVE_PARTITION) -{ --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l_int; --enable_warnings - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_2_DROP_TABLES5; - echo CHILD2_2_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_2_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } - } --connection master_1 --disable_query_log echo CREATE TABLE ta_l_int ( @@ -354,163 +247,85 @@ if ($HAVE_PARTITION) KEY idx1(b), KEY idx2(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1; - eval CREATE TABLE ta_l_int ( +CREATE TABLE ta_l_int ( a INT AUTO_INCREMENT, b INT DEFAULT 10, c INT DEFAULT 11, PRIMARY KEY(a), KEY idx1(b), KEY idx2(c) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT3_P_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "ta_r_int"' + PARTITION BY LIST(MOD(a, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='srv "s_2_1", priority "1000"', +PARTITION pt2 VALUES IN (1) +COMMENT='srv "s_2_2", priority "1000001"' + ); --enable_query_log INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3); INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int; INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2) WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } -} - --echo --echo 2.26 --echo auto_increment with partition -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_INCREMENT_TABLES1; - echo CHILD2_1_CREATE_INCREMENT_TABLES1; - echo CHILD2_1_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_1_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_1_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_1; --enable_warnings - eval $CHILD2_1_CREATE_INCREMENT_TABLES1; - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_1 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 2; TRUNCATE TABLE mysql.general_log; - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_INCREMENT_TABLES1; - echo CHILD2_2_CREATE_INCREMENT_TABLES1; - echo CHILD2_2_AUTO_INCREMENT_INCREMENT2; - echo CHILD2_2_AUTO_INCREMENT_OFFSET2; - } --disable_warnings - eval $CHILD2_2_DROP_INCREMENT_TABLES1; +DROP TABLE IF EXISTS t1_2; --enable_warnings - eval $CHILD2_2_CREATE_INCREMENT_TABLES1; - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT2; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE t1_2 ( +id int(11) NOT NULL AUTO_INCREMENT, +PRIMARY KEY (id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 4; +SET GLOBAL AUTO_INCREMENT_OFFSET = 3; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 - if ($USE_REPLICATION) - { save_master_pos; --source include/save_master_pos.inc --connection slave1_1 --let $rc= `select master_pos_wait('$_master_file', $_master_pos, 300, '')` - if (`select $rc is NULL OR $rc < 0`) - { - --vertical_results - show slave status; - --horizontal_results - show global status; - show global variables; - --let $MYSQLD_DATADIR= `select @@datadir` - --exec $MYSQL_BINLOG -v $MYSQLD_DATADIR/mysqld-relay-bin.000001; - # Check that the relay-log file is fully on disk. - --exec ls -l $MYSQLD_DATADIR; - # After that try to restart the slave SQL thread - start slave sql_thread; - } sync_with_master; --connection master_1 --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log - } --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -521,16 +336,28 @@ if ($HAVE_PARTITION) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1; echo MASTER_1_AUTO_INCREMENT_INCREMENT2; echo MASTER_1_AUTO_INCREMENT_OFFSET2; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_INCREMENT1_P_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT 'aim "0"' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='tbl "t1_1", srv "s_2_1"', +PARTITION pt2 VALUES IN (1) +COMMENT='tbl "t1_2", srv "s_2_2"' + ); --disable_ps_protocol - eval $MASTER_1_AUTO_INCREMENT_INCREMENT2; - eval $MASTER_1_AUTO_INCREMENT_OFFSET2; +SET SESSION AUTO_INCREMENT_INCREMENT = 777 ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_1"') ; +SELECT spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '', +'srv "s_2_2"'); +SET SESSION AUTO_INCREMENT_OFFSET = 777 ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '', +'srv "s_2_1"') ; +SELECT spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '', +'srv "s_2_2"'); --enable_ps_protocol - if ($USE_REPLICATION) - { SET SESSION sql_log_bin= 1; --connection slave1_1 --disable_warnings @@ -540,12 +367,17 @@ if ($HAVE_PARTITION) id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) ) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1; - eval CREATE TABLE t1 ( +CREATE TABLE t1 ( id int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) - ) $SLAVE1_1_ENGINE $SLAVE1_1_CHARSET $SLAVE1_1_COMMENT_INCREMENT1_P_1; +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT '' + PARTITION BY LIST(MOD(id, 2)) ( +PARTITION pt1 VALUES IN (0) +COMMENT='', +PARTITION pt2 VALUES IN (1) +COMMENT='' + ); --connection master_1 - } --enable_query_log INSERT INTO t1 () VALUES (); SELECT LAST_INSERT_ID(); @@ -572,8 +404,6 @@ if ($HAVE_PARTITION) INSERT INTO t1 (id) VALUES (1000); SELECT LAST_INSERT_ID(); SELECT MAX(id) FROM t1; - if ($USE_REPLICATION) - { save_master_pos; --connection slave1_1 sync_with_master; @@ -582,94 +412,41 @@ if ($HAVE_PARTITION) --disable_query_log SET SESSION sql_log_bin= 0; --enable_query_log - } - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_1_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_1_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_1_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } +SELECT id FROM t1_1 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_2_SELECT_INCREMENT_TABLES1; - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_AUTO_INCREMENT_INCREMENT1; - echo CHILD2_2_AUTO_INCREMENT_OFFSET1; - } - eval $CHILD2_2_AUTO_INCREMENT_INCREMENT1; - eval $CHILD2_2_AUTO_INCREMENT_OFFSET1; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT id FROM t1_2 ORDER BY id; +SET GLOBAL AUTO_INCREMENT_INCREMENT = 1; +SET GLOBAL AUTO_INCREMENT_OFFSET = 1; --enable_query_log --enable_result_log - } - } -} --echo --echo Test ORDER BY with LIMIT and OFFSET -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES7; - echo CHILD2_1_CREATE_TABLES7; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES7; +DROP TABLE IF EXISTS ta_ob; --enable_warnings - eval $CHILD2_1_CREATE_TABLES7; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_ob ( +a VARCHAR(50) NOT NULL, +b VARCHAR(50) NULL DEFAULT NULL, +c VARCHAR(100) NULL DEFAULT NULL, +d DATETIME(0) NULL DEFAULT NULL, +e INT(11) NOT NULL, +f INT(10) NULL DEFAULT NULL, +PRIMARY KEY (a, e) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log --disable_warnings @@ -683,8 +460,10 @@ if ($HAVE_PARTITION) e INT(11) NOT NULL, f INT(10) NULL DEFAULT NULL, PRIMARY KEY (a, e) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT6_P_1_1; - eval CREATE TABLE ta_ob ( +) $MASTER_1_ENGINE COMMENT='database "auto_test_remote", table "ta_ob"' + PARTITION BY LIST COLUMNS (e) PARTITIONS 1 + (PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"'); +CREATE TABLE ta_ob ( a VARCHAR(50) NOT NULL, b VARCHAR(50) NULL DEFAULT NULL, c VARCHAR(100) NULL DEFAULT NULL, @@ -692,7 +471,9 @@ if ($HAVE_PARTITION) e INT(11) NOT NULL, f INT(10) NULL DEFAULT NULL, PRIMARY KEY (a, e) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT6_P_1_1; +) ENGINE=Spider COMMENT='database "auto_test_remote", table "ta_ob"' + PARTITION BY LIST COLUMNS (e) PARTITIONS 1 +(PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"'); --enable_query_log INSERT INTO ta_ob VALUES ('0B95CD65DF994BC9A09A6AABE53A2733', '6CFED89FF6A84C7AA55C3C432663D094', @@ -723,27 +504,13 @@ if ($HAVE_PARTITION) '51041110620310', '2018-08-02 13:48:28', 510411, 0); SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 5 OFFSET 1; - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES7; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 6 OFFSET 0; --enable_query_log --enable_result_log - } - } -} - --echo # --echo # MDEV-25985 Spider handle ">=" as ">" in some cases @@ -753,13 +520,13 @@ if ($HAVE_PARTITION) --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( a int, b int, c int, PRIMARY KEY (a), KEY (b,c) -) $CHILD2_1_ENGINE $CHILD2_1_CHARSET; +) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO t1 VALUES (1, 1, 1), (2, 2, 1); @@ -767,13 +534,16 @@ INSERT INTO t1 VALUES (1, 1, 1), (2, 2, 1); --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings -eval CREATE TABLE t1 ( +CREATE TABLE t1 ( a int, b int, c int, PRIMARY KEY (a), KEY (b,c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_MDEV_25985; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "t1"' + PARTITION BY LIST COLUMNS(`a`) ( +PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"' + ); --connection master_1 SELECT * FROM t1 WHERE c > 0 AND b >= 1 AND b <= 2; @@ -783,59 +553,32 @@ SELECT * FROM t1 WHERE c < 3 AND b <= 2; --echo Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084) --echo Fixed with 4968049799193394d442f26b4e3a8d95b185be72 --echo Spider crashed if the first partition was not used first -if ($HAVE_PARTITION) -{ - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_2_DROP_TABLES; - echo CHILD2_2_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_2_DROP_TABLES; +DROP TABLE IF EXISTS ta_r3; --enable_warnings - eval $CHILD2_2_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r3 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES2; - echo CHILD2_1_CREATE_TABLES2; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES2; +DROP TABLE IF EXISTS ta_r2; --enable_warnings - eval $CHILD2_1_CREATE_TABLES2; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r2 ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } - } --connection master_1 --disable_query_log --disable_warnings @@ -847,12 +590,18 @@ if ($HAVE_PARTITION) c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1; - eval CREATE TABLE ta_l2 ( +CREATE TABLE ta_l2 ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) - ) $MASTER_1_ENGINE $MASTER_1_COMMENT2_P_2_1; +) ENGINE=Spider COMMENT='table "ta_r3"' + PARTITION BY RANGE(a) ( +PARTITION pt1 VALUES LESS THAN (4) COMMENT='srv "s_2_1", + table "ta_r2", priority "1000"', +PARTITION pt2 VALUES LESS THAN MAXVALUE +COMMENT='srv "s_2_2", priority "1000001"' + ); --enable_query_log INSERT INTO ta_l2 SELECT a, b, c FROM tb_l; --echo Query a Spider table only using the second partition @@ -862,50 +611,28 @@ if ($HAVE_PARTITION) --echo Query a Spider table by all paritions, then the second partition SELECT min(a), max(a), min(b), max(b) FROM ta_l2; SELECT a,b,c FROM ta_l2 PARTITION (pt2); - if ($USE_CHILD_GROUP2) - { - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_2 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_2_SELECT_TABLES; +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r3 ORDER BY a; --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; - } - eval $CHILD2_1_SELECT_TABLES2; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r2 ORDER BY a; --enable_query_log --enable_result_log - } - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_REPLICATION) -{ --connection slave1_1 DROP DATABASE IF EXISTS auto_test_local; -} -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source slave_test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/timestamp.test b/storage/spider/mysql-test/spider/t/timestamp.test index 20fa69a6287..1c2280c827a 100644 --- a/storage/spider/mysql-test/spider/t/timestamp.test +++ b/storage/spider/mysql-test/spider/t/timestamp.test @@ -1,16 +1,15 @@ --source timestamp_init.inc +let $MASTER_1_COMMENT_2_1_F= + COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'; --echo --echo Initialize Time Zone --connection master_1 SET GLOBAL time_zone='MET'; SET time_zone='MET'; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 SET GLOBAL time_zone='MET'; SET time_zone='MET'; -} --echo --echo drop and create databases @@ -19,78 +18,47 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS ts_test_local; CREATE DATABASE ts_test_local; USE ts_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 - if ($USE_GENERAL_LOG) - { SET @old_log_output = @@global.log_output; SET GLOBAL log_output = 'TABLE,FILE'; - } DROP DATABASE IF EXISTS ts_test_remote; CREATE DATABASE ts_test_remote; USE ts_test_remote; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --echo --echo create table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { --disable_query_log echo CHILD2_1_DROP_TABLE; echo CHILD2_1_DROP_TABLE_F; echo CHILD2_1_CREATE_TABLE; echo CHILD2_1_CREATE_TABLE_F; - } --disable_warnings - eval $CHILD2_1_DROP_TABLE; - eval $CHILD2_1_DROP_TABLE_F; +DROP TABLE IF EXISTS tbl_a; +DROP TABLE IF EXISTS tbl_f; --enable_warnings - eval $CHILD2_1_CREATE_TABLE; - eval $CHILD2_1_CREATE_TABLE_F; - if ($OUTPUT_CHILD_GROUP2) - { +CREATE TABLE tbl_a ( +col_a INT UNSIGNED NOT NULL AUTO_INCREMENT, +col_dt DATETIME, +col_ts TIMESTAMP NOT NULL +DEFAULT current_timestamp() ON UPDATE current_timestamp(), +PRIMARY KEY(col_a), +UNIQUE INDEX i_ts (col_ts) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; +CREATE TABLE tbl_f ( +col_d DATE, +col_t TIME +) ENGINE=InnoDB; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tbl_a; @@ -104,22 +72,22 @@ echo CREATE TABLE tbl_a ( PRIMARY KEY(col_a), UNIQUE INDEX i_ts (col_ts) ) MASTER_1_ENGINE MASTER_1_AUTO_INCREMENT_2_1 MASTER_1_COMMENT_2_1; -eval CREATE TABLE tbl_a ( +CREATE TABLE tbl_a ( col_a INT UNSIGNED NOT NULL AUTO_INCREMENT, col_dt DATETIME, col_ts TIMESTAMP NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY(col_a), UNIQUE INDEX i_ts (col_ts) -) $MASTER_1_ENGINE $MASTER_1_AUTO_INCREMENT_2_1 $MASTER_1_COMMENT_2_1; +) ENGINE=Spider AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COMMENT='database "ts_test_remote", table "tbl_a", srv "s_2_1"'; echo CREATE TABLE tbl_f ( col_d DATE, col_t TIME ) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F; -eval CREATE TABLE tbl_f ( +CREATE TABLE tbl_f ( col_d DATE, col_t TIME -) $MASTER_1_ENGINE $MASTER_1_COMMENT_2_1_F; +) ENGINE=Spider COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'; --enable_query_log SHOW CREATE TABLE tbl_a; SHOW CREATE TABLE tbl_f; @@ -152,118 +120,38 @@ SET @@timestamp=0; --echo --echo SELECTs -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol SELECT *, unix_timestamp(col_ts) FROM tbl_a; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLE; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a; --enable_ps2_protocol --echo --echo DELETEs -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 DELETE FROM tbl_a WHERE col_ts='1970-01-01 01:00:01'; --disable_ps2_protocol --disable_view_protocol SELECT *, unix_timestamp(col_ts) FROM tbl_a; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLE; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a; --enable_ps2_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 SET @@timestamp=1; INSERT INTO tbl_a VALUES (1, now(), now()); @@ -272,98 +160,34 @@ SET @@timestamp=0; --disable_view_protocol SELECT *, unix_timestamp(col_ts) FROM tbl_a; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLE; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a; --enable_ps2_protocol --echo --echo UPDATEs -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 UPDATE tbl_a SET col_ts=col_dt; --disable_ps2_protocol --disable_view_protocol SELECT *, unix_timestamp(col_ts) FROM tbl_a; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLE; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a; --enable_ps2_protocol --echo --echo Lookups -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol @@ -375,79 +199,28 @@ SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts >= '2018-10-28 01:30:00 SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 180325020000; SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 19700101010001; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLE; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a; --enable_ps2_protocol --echo --echo Drop the index on the timestamp column -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - eval $CHILD2_1_DROP_INDEX; - eval $CHILD2_1_SHOW_CREATE_TABLE; - if ($OUTPUT_CHILD_GROUP2) - { +DROP INDEX i_ts ON tbl_a; +SHOW CREATE TABLE tbl_a; --enable_query_log - } - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 DROP INDEX i_ts ON tbl_a; SHOW CREATE TABLE tbl_a; --echo --echo Retry lookups on unindexed timestamp column -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol @@ -459,27 +232,11 @@ SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts >= '2018-10-28 01:30:00 SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 180325020000; SELECT *, unix_timestamp(col_ts) FROM tbl_a WHERE col_ts > 19700101010001; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLE; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a; --enable_ps2_protocol --echo @@ -488,24 +245,8 @@ if ($USE_CHILD_GROUP2) INSERT INTO tbl_f VALUES ('2018-06-24', '01:23:45'), ('2018-06-24', '01:23:45'), ('2018-08-01', '12:34:56'); -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} --connection master_1 --disable_ps2_protocol --disable_view_protocol @@ -515,27 +256,11 @@ SELECT TIMESTAMP('2018-06-25', col_t) FROM tbl_f; SELECT TIMESTAMP(col_d, '10:43:21') FROM tbl_f; SELECT TIMESTAMP('2018-06-25', '10:43:21') FROM tbl_f; --enable_view_protocol -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { - --disable_query_log - --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { --disable_view_protocol - eval $CHILD2_1_SELECT_ARGUMENT1; +SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; --enable_view_protocol - } - eval $CHILD2_1_SELECT_TABLE_F; - if (!$OUTPUT_CHILD_GROUP2) - { - --enable_query_log - --enable_result_log - } -} +SELECT col_d, col_t FROM tbl_f; --enable_ps2_protocol --echo @@ -543,27 +268,18 @@ if ($USE_CHILD_GROUP2) --connection master_1 SET GLOBAL time_zone=DEFAULT; SET time_zone=DEFAULT; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 SET GLOBAL time_zone=DEFAULT; SET time_zone=DEFAULT; -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS ts_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS ts_test_remote; - if ($USE_GENERAL_LOG) - { SET GLOBAL log_output = @old_log_output; - } -} --enable_warnings --source timestamp_deinit.inc --echo diff --git a/storage/spider/mysql-test/spider/t/timestamp_deinit.inc b/storage/spider/mysql-test/spider/t/timestamp_deinit.inc index 52be67a1d09..ecb5622af14 100644 --- a/storage/spider/mysql-test/spider/t/timestamp_deinit.inc +++ b/storage/spider/mysql-test/spider/t/timestamp_deinit.inc @@ -1,9 +1,3 @@ ---let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP ---let $CHILD2_1_DROP_TABLES= $CHILD2_1_DROP_TABLES_BACKUP ---let $CHILD2_1_CREATE_TABLES= $CHILD2_1_CREATE_TABLES_BACKUP ---let $CHILD2_1_SELECT_TABLES= $CHILD2_1_SELECT_TABLES_BACKUP ---let $OUTPUT_CHILD_GROUP2= $OUTPUT_CHILD_GROUP2_BACKUP ---let $USE_GENERAL_LOG= $USE_GENERAL_LOG_BACKUP --disable_warnings --disable_query_log --disable_result_log diff --git a/storage/spider/mysql-test/spider/t/timestamp_init.inc b/storage/spider/mysql-test/spider/t/timestamp_init.inc index 22587bcf65a..6cf6b0c1f41 100644 --- a/storage/spider/mysql-test/spider/t/timestamp_init.inc +++ b/storage/spider/mysql-test/spider/t/timestamp_init.inc @@ -5,58 +5,3 @@ --enable_result_log --enable_query_log --enable_warnings - ---let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1 ---let $MASTER_1_COMMENT_2_1_F_BACKUP= $MASTER_1_COMMENT_2_1_F -let $MASTER_1_COMMENT_2_1= - COMMENT='database "ts_test_remote", table "tbl_a", srv "s_2_1"'; -let $MASTER_1_COMMENT_2_1_F= - COMMENT='database "ts_test_remote", table "tbl_f", srv "s_2_1"'; -let $MASTER_1_AUTO_INCREMENT_2_1= - AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; -let $MASTER_1_AUTO_INCREMENT1= - AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; -let $MASTER_1_AUTO_INCREMENT2= - AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; -let $CHILD2_1_AUTO_INCREMENT= - AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4; ---let $CHILD2_1_DROP_TABLE_BACKUP= $CHILD2_1_DROP_TABLE ---let $CHILD2_1_DROP_TABLE_F_BACKUP= $CHILD2_1_DROP_TABLE_F -let $CHILD2_1_DROP_TABLE= - DROP TABLE IF EXISTS tbl_a; -let $CHILD2_1_DROP_TABLE_F= - DROP TABLE IF EXISTS tbl_f; ---let $CHILD2_1_CREATE_TABLE_BACKUP= $CHILD2_1_CREATE_TABLE ---let $CHILD2_1_CREATE_TABLE_F_BACKUP= $CHILD2_1_CREATE_TABLE_F -let $CHILD2_1_CREATE_TABLE= - CREATE TABLE tbl_a ( - col_a INT UNSIGNED NOT NULL AUTO_INCREMENT, - col_dt DATETIME, - col_ts TIMESTAMP NOT NULL - DEFAULT current_timestamp() ON UPDATE current_timestamp(), - PRIMARY KEY(col_a), - UNIQUE INDEX i_ts (col_ts) - ) $CHILD2_1_ENGINE $CHILD2_1_AUTO_INCREMENT; -let $CHILD2_1_CREATE_TABLE_F= - CREATE TABLE tbl_f ( - col_d DATE, - col_t TIME - ) $CHILD2_1_ENGINE; ---let $CHILD2_1_SELECT_TABLE_BACKUP= $CHILD2_1_SELECT_TABLE ---let $CHILD2_1_SELECT_TABLE_F_BACKUP= $CHILD2_1_SELECT_TABLE_F -let $CHILD2_1_SELECT_TABLE= - SELECT col_a, col_dt, col_ts, unix_timestamp(col_ts) FROM tbl_a ORDER BY col_a; -let $CHILD2_1_SELECT_TABLE_F= - SELECT col_d, col_t FROM tbl_f; -let $CHILD2_1_SELECT_ARGUMENT1= - SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%select %'; -let $CHILD2_1_DROP_INDEX= - DROP INDEX i_ts ON tbl_a; -let $CHILD2_1_SHOW_CREATE_TABLE= - SHOW CREATE TABLE tbl_a; -let $CHILD2_1_SHOW_CREATE_TABLE_F= - SHOW CREATE TABLE tbl_f; ---let $OUTPUT_CHILD_GROUP2_BACKUP= $OUTPUT_CHILD_GROUP2 ---let $OUTPUT_CHILD_GROUP2= 1 ---let $USE_GENERAL_LOG_BACKUP= $USE_GENERAL_LOG ---let $USE_GENERAL_LOG= 1 diff --git a/storage/spider/mysql-test/spider/t/udf_pushdown.test b/storage/spider/mysql-test/spider/t/udf_pushdown.test index 2eadbbbb40b..6fdc8039275 100644 --- a/storage/spider/mysql-test/spider/t/udf_pushdown.test +++ b/storage/spider/mysql-test/spider/t/udf_pushdown.test @@ -44,29 +44,34 @@ TRUNCATE TABLE mysql.general_log; --connection master_1 CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 CREATE DATABASE auto_test_remote; USE auto_test_remote; -} --echo --echo ##### create tables ##### -if ($USE_CHILD_GROUP2) -{ --connection child2_1 --disable_query_log echo CHILD_CREATE_TABLE; - eval $CHILD_CREATE_TABLE; +CREATE TABLE ta_r ( +id INT NOT NULL, +a INT, +PRIMARY KEY(id) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log -} --connection master_1 --disable_query_log echo MASTER_CREATE_TABLE; echo $MASTER_CREATE_TABLE_OUTPUT; -eval $MASTER_CREATE_TABLE; +eval +CREATE TABLE ta_l ( +id INT NOT NULL, +a INT, +PRIMARY KEY(id) +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l VALUES @@ -123,14 +128,11 @@ SET @@spider_use_pushdown_udf = 1; --connection master_1 DROP FUNCTION `plusone`; DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 SET @@global.general_log = @general_log_backup; SET @@global.log_output = @log_output_backup; DROP FUNCTION `plusone`; DROP DATABASE IF EXISTS auto_test_remote; -} --disable_query_log --disable_result_log --source test_deinit.inc diff --git a/storage/spider/mysql-test/spider/t/vp_fixes.test b/storage/spider/mysql-test/spider/t/vp_fixes.test index 2c3e1523611..83a13e5c935 100644 --- a/storage/spider/mysql-test/spider/t/vp_fixes.test +++ b/storage/spider/mysql-test/spider/t/vp_fixes.test @@ -12,8 +12,6 @@ DROP DATABASE IF EXISTS auto_test_local; CREATE DATABASE auto_test_local; USE auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; CREATE DATABASE auto_test_remote; @@ -22,65 +20,39 @@ if ($USE_CHILD_GROUP2) DROP DATABASE IF EXISTS auto_test_remote2; CREATE DATABASE auto_test_remote2; USE auto_test_remote2; -} --enable_warnings --echo --echo test select 1 --connection master_1 SELECT 1; -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 SELECT 1; --connection child2_2 SELECT 1; - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --echo --echo create table and insert -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - --disable_query_log - echo CHILD2_1_DROP_TABLES; - echo CHILD2_1_CREATE_TABLES; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES; +DROP TABLE IF EXISTS ta_r; --enable_warnings - eval $CHILD2_1_CREATE_TABLES; - if ($OUTPUT_CHILD_GROUP2) - { - --enable_query_log - } - if ($USE_GENERAL_LOG) - { +CREATE TABLE ta_r ( +a INT DEFAULT 10, +b CHAR(1) DEFAULT 'c', +c DATETIME DEFAULT '1999-10-10 10:10:10', +PRIMARY KEY(a), +KEY idx1(b) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --disable_warnings DROP TABLE IF EXISTS tb_l; @@ -92,12 +64,12 @@ echo CREATE TABLE tb_l ( c DATETIME, PRIMARY KEY(a) ) MASTER_1_ENGINE2 MASTER_1_CHARSET2; -eval CREATE TABLE tb_l ( +CREATE TABLE tb_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE2 $MASTER_1_CHARSET2; +) ENGINE=MyISAM DEFAULT CHARSET=utf8; --enable_query_log INSERT INTO tb_l (a, b, c) VALUES (1, 'a', '2008-08-01 10:21:39'), @@ -112,41 +84,37 @@ DROP TABLE IF EXISTS ta_l; echo CREATE TABLE ta_l ( PRIMARY KEY(a) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; -eval CREATE TABLE ta_l ( +eval +CREATE TABLE ta_l ( a INT, b CHAR(1), c DATETIME, PRIMARY KEY(a) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log INSERT INTO ta_l SELECT a, b, c FROM tb_l; --echo --echo 0.9 --echo create different primary key table -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE ta_l_int ( @@ -155,95 +123,59 @@ echo CREATE TABLE ta_l_int ( c INT DEFAULT 11, PRIMARY KEY(b) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( +eval +CREATE TABLE ta_l_int ( a INT DEFAULT 10, b INT AUTO_INCREMENT, c INT DEFAULT 11, PRIMARY KEY(b) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - if (!$OUTPUT_CHILD_GROUP2) - { --enable_query_log --enable_result_log - } -} --connection master_1 --let $MASTER_1_IS_VP= `SELECT IF('$MASTER_1_ENGINE_TYPE' = 'VP', 1, 0)` -if ($MASTER_1_IS_VP) -{ - --error 14514 - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -} -if (!$MASTER_1_IS_VP) -{ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); --disable_query_log --disable_result_log TRUNCATE TABLE ta_l_int; --enable_query_log --enable_result_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES5; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, c FROM ta_r_int ORDER BY a; --enable_query_log --enable_result_log - } -} --echo create un-correspond primary key table --connection master_1 --disable_warnings DROP TABLE IF EXISTS ta_l_int; --enable_warnings -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_result_log - } --disable_query_log --connection child2_1 - if ($OUTPUT_CHILD_GROUP2) - { - echo CHILD2_1_DROP_TABLES5; - echo CHILD2_1_CREATE_TABLES5; - } --disable_warnings - eval $CHILD2_1_DROP_TABLES5; +DROP TABLE IF EXISTS ta_r_int; --enable_warnings - eval $CHILD2_1_CREATE_TABLES5; +CREATE TABLE ta_r_int ( +a INT AUTO_INCREMENT, +b INT DEFAULT 10, +c INT DEFAULT 11, +PRIMARY KEY(a), +KEY idx1(b), +KEY idx2(c) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; --enable_query_log - if (!$OUTPUT_CHILD_GROUP2) - { --enable_result_log - } -} --connection master_1 --disable_query_log echo CREATE TABLE ta_l_int ( @@ -252,79 +184,47 @@ echo CREATE TABLE ta_l_int ( c INT DEFAULT 11, PRIMARY KEY(c) ) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT4_2_1; -eval CREATE TABLE ta_l_int ( +eval +CREATE TABLE ta_l_int ( a INT DEFAULT 10, b INT DEFAULT 12, c INT DEFAULT 11, PRIMARY KEY(c) -) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT4_2_1; +) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='database "auto_test_remote", table "ta_r_int"' + CONNECTION='host "localhost", socket "$CHILD2_1_MYSOCK", user "root", + password ""'; --enable_query_log -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { TRUNCATE TABLE mysql.general_log; - } - eval $CHILD2_1_SELECT_TABLES; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_r ORDER BY a; --enable_query_log --enable_result_log - } -} --connection master_1 -if ($MASTER_1_IS_VP) -{ - --error 14514 - INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); -} -if (!$MASTER_1_IS_VP) -{ INSERT INTO ta_l_int (a, b, c) VALUES (2, NULL, 3); --disable_query_log --disable_result_log TRUNCATE TABLE ta_l_int; --enable_query_log --enable_result_log -} -if ($USE_CHILD_GROUP2) -{ - if (!$OUTPUT_CHILD_GROUP2) - { --disable_query_log --disable_result_log - } --connection child2_1 - if ($USE_GENERAL_LOG) - { SELECT argument FROM mysql.general_log WHERE command_type != 'Execute' AND argument LIKE '%insert %'; - } - eval $CHILD2_1_SELECT_TABLES5; - if (!$OUTPUT_CHILD_GROUP2) - { +SELECT a, b, c FROM ta_r_int ORDER BY a; --enable_query_log --enable_result_log - } -} --echo --echo deinit --disable_warnings --connection master_1 DROP DATABASE IF EXISTS auto_test_local; -if ($USE_CHILD_GROUP2) -{ --connection child2_1 DROP DATABASE IF EXISTS auto_test_remote; --connection child2_2 DROP DATABASE IF EXISTS auto_test_remote2; -} --disable_query_log --disable_result_log --source test_deinit.inc From ca81bcfabf5d2aa7c0afe0c9e38f8de6c482b209 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 15 Oct 2025 15:28:28 +1100 Subject: [PATCH 24/69] Galera 26.4.24 - test update for wsrep.wsrep_provider_plugin_defaults --- .../r/wsrep_provider_plugin_defaults.result | 17 ++++++++++++++++- .../wsrep/t/wsrep_provider_plugin_defaults.test | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/wsrep/r/wsrep_provider_plugin_defaults.result b/mysql-test/suite/wsrep/r/wsrep_provider_plugin_defaults.result index 90d22d87f59..77c36da1af6 100644 --- a/mysql-test/suite/wsrep/r/wsrep_provider_plugin_defaults.result +++ b/mysql-test/suite/wsrep/r/wsrep_provider_plugin_defaults.result @@ -12,7 +12,7 @@ SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIK 'wsrep_provider_repl_proto_max', 'wsrep_provider_gmcast_listen_addr'); COUNT(*) -83 +84 SELECT * FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_provider_%' AND VARIABLE_NAME NOT IN ( 'wsrep_provider', @@ -507,6 +507,21 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED GLOBAL_VALUE_PATH NULL +VARIABLE_NAME WSREP_PROVIDER_GCS_CHECK_APPL_PROTO +SESSION_VALUE NULL +GLOBAL_VALUE ON +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE ON +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Wsrep provider option +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED +GLOBAL_VALUE_PATH NULL VARIABLE_NAME WSREP_PROVIDER_GCS_FC_DEBUG SESSION_VALUE NULL GLOBAL_VALUE 0 diff --git a/mysql-test/suite/wsrep/t/wsrep_provider_plugin_defaults.test b/mysql-test/suite/wsrep/t/wsrep_provider_plugin_defaults.test index 78198051f34..1e0b6a49efc 100644 --- a/mysql-test/suite/wsrep/t/wsrep_provider_plugin_defaults.test +++ b/mysql-test/suite/wsrep/t/wsrep_provider_plugin_defaults.test @@ -1,7 +1,7 @@ --source include/have_wsrep.inc --source include/have_innodb.inc ---let $galera_version=26.4.21 +--let $galera_version=26.4.24 source include/check_galera_version.inc; SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_provider%' AND VARIABLE_NAME NOT IN ( From 1ac22707205c433a42e60e7340299e9bbf988157 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 15 Oct 2025 13:10:21 +0530 Subject: [PATCH 25/69] MDEV-37138: Innochecksum fails to handle doublewrite buffer and multiple file tablespace - Fixing innodb.innochecksum_flags_and_skip test case failure in 11.4 --- .../suite/innodb/r/innochecksum_flags_and_skip.result | 5 ++++- .../suite/innodb/t/innochecksum_flags_and_skip.test | 10 +++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb/r/innochecksum_flags_and_skip.result b/mysql-test/suite/innodb/r/innochecksum_flags_and_skip.result index 183bb58192a..c71368129fc 100644 --- a/mysql-test/suite/innodb/r/innochecksum_flags_and_skip.result +++ b/mysql-test/suite/innodb/r/innochecksum_flags_and_skip.result @@ -11,6 +11,9 @@ Should exist when summary includes dblwr pages # restart CREATE TABLE ibd_1(f1 INT PRIMARY KEY)ENGINE=InnoDB; INSERT INTO ibd_1 VALUES(1), (2), (3), (4); +SET GLOBAL innodb_file_per_table=0; +CREATE TABLE ibd_2(f1 INT PRIMARY KEY)ENGINE=InnoDB; +INSERT INTO ibd_2 SELECT seq FROM seq_1_to_8451; # Pass wrong tablespace flag for ibdata2 FOUND 1 /Error: Page 0 checksum mismatch/ in result.log # Pass wrong tablespace flag for ibdata1 @@ -25,4 +28,4 @@ FOUND 1 /Error: First page of the tablespace file should be 0, but encountered p # Test innochecksum with the modified ibdata3 with tablespace flags FOUND 1 /Exceeded the maximum allowed checksum mismatch/ in result.log # restart -DROP TABLE t1, ibd_1; +DROP TABLE t1, ibd_1, ibd_2; diff --git a/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.test b/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.test index a8e700e13ac..f1e55017a65 100644 --- a/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.test +++ b/mysql-test/suite/innodb/t/innochecksum_flags_and_skip.test @@ -1,6 +1,7 @@ --source include/have_innodb.inc --source include/not_embedded.inc --source include/have_debug.inc +--source include/have_sequence.inc let MYSQLD_DATADIR= `SELECT @@datadir`; CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; SET GLOBAL innodb_log_checkpoint_now=ON; @@ -84,6 +85,13 @@ remove_file $resultlog_1; --source include/start_mysqld.inc CREATE TABLE ibd_1(f1 INT PRIMARY KEY)ENGINE=InnoDB; INSERT INTO ibd_1 VALUES(1), (2), (3), (4); + +disable_warnings; +SET GLOBAL innodb_file_per_table=0; +enable_warnings; +CREATE TABLE ibd_2(f1 INT PRIMARY KEY)ENGINE=InnoDB; +INSERT INTO ibd_2 SELECT seq FROM seq_1_to_8451; + let $shutdown_timeout=; --source include/shutdown_mysqld.inc --echo # Pass wrong tablespace flag for ibdata2 @@ -167,5 +175,5 @@ let SEARCH_PATTERN=Exceeded the maximum allowed checksum mismatch; remove_file $ibdata3; --source include/start_mysqld.inc -DROP TABLE t1, ibd_1; +DROP TABLE t1, ibd_1, ibd_2; remove_file $resultlog; From b2c1ba820b6cda723c58f2ba01ccf2e379b7f313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 15 Oct 2025 11:54:49 +0300 Subject: [PATCH 26/69] MDEV-37860: Assertion !waiting failed with thread-handling=pool-of-threads In commit 13076351f10f59a9bedb32e5233666d35c86f51f (MDEV-37152) some code was refactored that would break the server-side connection pool logic. Calls to thd_wait_begin() and thd_wait_end() were not balanced. buf_read_page_low(): Only invoke thd_wait_begin() and thd_wait_end() for synchronous reads, and do that also when the read operation fails. Reviewed by: Vladislav Lesin --- .../binlog/t/binlog_bug23533.combinations | 4 ++ .../suite/binlog/t/binlog_bug23533.test | 3 ++ storage/innobase/buf/buf0rea.cc | 48 +++++++++++-------- 3 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 mysql-test/suite/binlog/t/binlog_bug23533.combinations diff --git a/mysql-test/suite/binlog/t/binlog_bug23533.combinations b/mysql-test/suite/binlog/t/binlog_bug23533.combinations new file mode 100644 index 00000000000..529e5629699 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_bug23533.combinations @@ -0,0 +1,4 @@ +[thread] +--thread-handling=one-thread-per-connection +[pool] +--loose-thread-handling=pool-of-threads diff --git a/mysql-test/suite/binlog/t/binlog_bug23533.test b/mysql-test/suite/binlog/t/binlog_bug23533.test index a77497115e5..81dba16dc2f 100644 --- a/mysql-test/suite/binlog/t/binlog_bug23533.test +++ b/mysql-test/suite/binlog/t/binlog_bug23533.test @@ -7,6 +7,9 @@ --source include/have_log_bin.inc --source include/have_binlog_format_row.inc call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size.*"); +if ($MTR_COMBINATION_POOL) { +--source include/have_pool_of_threads.inc +} SET AUTOCOMMIT=0; # Create 1st table diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 21b2c32affc..5aeb5c6f19e 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -237,14 +237,6 @@ buf_read_page_low( } ut_ad(bpage->in_file()); - ulonglong mariadb_timer = 0; - trx_t *const trx= thd ? thd_to_trx(thd) : nullptr; - - thd_wait_begin(thd, THD_WAIT_DISKIO); - - if (trx && trx->active_handler_stats) { - mariadb_timer = mariadb_measure(); - } DBUG_LOG("ib_buf", "read page " << page_id << " zip_size=" << zip_size @@ -253,24 +245,40 @@ buf_read_page_low( void* dst = zip_size > 1 ? bpage->zip.data : bpage->frame; const ulint len = zip_size & ~1 ? zip_size & ~1 : srv_page_size; - auto fio = space->io(IORequest(sync - ? IORequest::READ_SYNC - : IORequest::READ_ASYNC), - os_offset_t{page_id.page_no()} * len, len, - dst, bpage); + fil_io_t fio; - if (UNIV_UNLIKELY(fio.err != DB_SUCCESS)) { - recv_sys.free_corrupted_page(page_id, *space->chain.start); - buf_pool.corrupted_evict(bpage, buf_page_t::READ_FIX); - } else if (sync) { + if (sync) { + ulonglong mariadb_timer = 0; + trx_t *const trx= thd ? thd_to_trx(thd) : nullptr; + if (trx && trx->active_handler_stats) { + mariadb_timer = mariadb_measure(); + } + + thd_wait_begin(thd, THD_WAIT_DISKIO); + fio = space->io(IORequest(IORequest::READ_SYNC), + os_offset_t{page_id.page_no()} * len, len, + dst, bpage); thd_wait_end(thd); - /* The i/o was already completed in space->io() */ - fio.err = bpage->read_complete(*fio.node); - space->release(); if (mariadb_timer) { trx->active_handler_stats->pages_read_time += mariadb_measure() - mariadb_timer; } + if (UNIV_UNLIKELY(fio.err != DB_SUCCESS)) { + goto read_fail; + } + /* The i/o was already completed in space->io() */ + fio.err = bpage->read_complete(*fio.node); + space->release(); + } else { + fio = space->io(IORequest(IORequest::READ_ASYNC), + os_offset_t{page_id.page_no()} * len, len, + dst, bpage); + if (UNIV_UNLIKELY(fio.err != DB_SUCCESS)) { + read_fail: + recv_sys.free_corrupted_page(page_id, + *space->chain.start); + buf_pool.corrupted_evict(bpage, buf_page_t::READ_FIX); + } } return fio.err; From 5bd91f6c0e801995811b3bdca45ff447ecf6f63b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 7 Aug 2025 13:15:04 +1000 Subject: [PATCH 27/69] MDEV-27898 CREATE VIEW AS SELECT FROM JSON_TABLE column requires global privileges JSON_TABLE is marked as a special "*any_db*" table. Because this special marking is processed all the way though to get_column_grant where its processed like its in database called "*any_db*". As this doesn't exist, only those users with global privileges can create views on a JSON_TABLE. Under a Prepared Statement protocol a Create_tmp_table is used for the JSON_TABLE, but it gets assigned an "" database name. We correct this to give it "*any_db*" like the SQL parser indicating that no database is needed. To commonly correct the fill_effective_table_privileges by looking explictly for the "*any_db*", those tables that have this as the database name get SELECT privileges. While correcting the database for the JSON_TABLE, lets give it a "json_table" name rather than "(temporary)" for greater clarity in warning messages. --- mysql-test/suite/json/r/json_table.result | 28 +++++++++++++++---- .../suite/json/r/json_table_mysql.result | 20 ++++++------- mysql-test/suite/json/t/json_table.test | 23 +++++++++++++++ sql/json_table.cc | 2 ++ sql/sql_acl.cc | 7 +++++ 5 files changed, 64 insertions(+), 16 deletions(-) diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index bf75cc1c682..3bee1e06abb 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -369,7 +369,7 @@ id intcol 3 5678 4 5678 Warnings: -Warning 1366 Incorrect integer value: 'asd' for column ``.`(temporary)`.`intcol` at row 1 +Warning 1366 Incorrect integer value: 'asd' for column `*any*`.`json_table`.`intcol` at row 1 SELECT COUNT(*) FROM JSON_TABLE('[1, 2]', '$[*]' COLUMNS( I INT PATH '$')) tt; COUNT(*) 2 @@ -927,7 +927,7 @@ id intcol 3 5678 4 5678 Warnings: -Warning 1366 Incorrect integer value: 'asd' for column ``.`(temporary)`.`intcol` at row 1 +Warning 1366 Incorrect integer value: 'asd' for column `*any*`.`json_table`.`intcol` at row 1 # # MDEV-25377 JSON_TABLE: Wrong value with implicit conversion. # @@ -937,7 +937,7 @@ converted original 1 1 127 1000 Warnings: -Warning 1366 Incorrect integer value: 'foo' for column ``.`(temporary)`.`converted` at row 1 +Warning 1366 Incorrect integer value: 'foo' for column `*any*`.`json_table`.`converted` at row 1 Warning 1264 Out of range value for column 'converted' at row 3 select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by converted; converted original @@ -945,9 +945,9 @@ converted original 1 1 127 1000 Warnings: -Warning 1366 Incorrect integer value: 'foo' for column ``.`(temporary)`.`converted` at row 1 +Warning 1366 Incorrect integer value: 'foo' for column `*any*`.`json_table`.`converted` at row 1 Warning 1264 Out of range value for column 'converted' at row 1 -Warning 1366 Incorrect integer value: 'foo' for column ``.`(temporary)`.`converted` at row 1 +Warning 1366 Incorrect integer value: 'foo' for column `*any*`.`json_table`.`converted` at row 1 Warning 1264 Out of range value for column 'converted' at row 3 select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by original; converted original @@ -956,7 +956,7 @@ converted original 0 foo Warnings: Warning 1264 Out of range value for column 'converted' at row 2 -Warning 1366 Incorrect integer value: 'foo' for column ``.`(temporary)`.`converted` at row 3 +Warning 1366 Incorrect integer value: 'foo' for column `*any*`.`json_table`.`converted` at row 3 select * from json_table('[{"color": "blue", "price": { "high": 10, "low": 5}}, {"color": "white", "price": "pretty low"}, @@ -1213,3 +1213,19 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp # # End of 10.9 tests # +# +# MDEV-27898 CREATE VIEW AS SELECT FROM JSON_TABLE column requires global privileges +# +create view v1 as (select * from +json_table('[{"a":"1"}]', '$[*]' columns(a int path '$.a') ) as jt); +create user u1@localhost; +grant ALL on test.* to u1@localhost; +connect con1,localhost,u1,,test; +create view v2 as +(select * from json_table('[{"a":"1"}]', '$[*]' columns(a int path '$.a') ) as jt); +disconnect con1; +connection default; +DROP VIEW v2; +DROP VIEW v1; +DROP USER u1@localhost; +# End of 10.11 tests diff --git a/mysql-test/suite/json/r/json_table_mysql.result b/mysql-test/suite/json/r/json_table_mysql.result index 533b5a91f92..8380ba07720 100644 --- a/mysql-test/suite/json/r/json_table_mysql.result +++ b/mysql-test/suite/json/r/json_table_mysql.result @@ -61,8 +61,8 @@ id jpath_i jpath_r jsn_path jexst 4 0 0.33 0.33 0 5 0 0 "asd" 0 Warnings: -Warning 1366 Incorrect integer value: 'asd' for column ``.`(temporary)`.`jpath_i` at row 5 -Warning 1366 Incorrect double value: 'asd' for column ``.`(temporary)`.`jpath_r` at row 5 +Warning 1366 Incorrect integer value: 'asd' for column `*any*`.`json_table`.`jpath_i` at row 5 +Warning 1366 Incorrect double value: 'asd' for column `*any*`.`json_table`.`jpath_r` at row 5 select * from json_table( '[{"x":"3"},{"a":2},{"b":1},{"a":0},{"a":[1,2]}]', @@ -406,7 +406,7 @@ SELECT * FROM JSON_TABLE('"asdf"', a 0 Warnings: -Warning 1366 Incorrect integer value: 'asdf' for column ``.`(temporary)`.`a` at row 1 +Warning 1366 Incorrect integer value: 'asdf' for column `*any*`.`json_table`.`a` at row 1 SELECT * FROM JSON_TABLE('[{"a":1},{"a":2}]', '$' COLUMNS (a INT PATH '$[*].a' ERROR ON ERROR)) AS jt; @@ -544,9 +544,9 @@ tm dt i f d Warnings: Warning 1265 Data truncated for column 'tm' at row 1 Warning 1265 Data truncated for column 'dt' at row 1 -Warning 1366 Incorrect integer value: 'asdf' for column ``.`(temporary)`.`i` at row 1 -Warning 1366 Incorrect double value: 'asdf' for column ``.`(temporary)`.`f` at row 1 -Warning 1366 Incorrect decimal value: 'asdf' for column ``.`(temporary)`.`d` at row 1 +Warning 1366 Incorrect integer value: 'asdf' for column `*any*`.`json_table`.`i` at row 1 +Warning 1366 Incorrect double value: 'asdf' for column `*any*`.`json_table`.`f` at row 1 +Warning 1366 Incorrect decimal value: 'asdf' for column `*any*`.`json_table`.`d` at row 1 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON EMPTY)) jt; x @@ -862,8 +862,8 @@ col18 0.000 0.000 Warnings: -Warning 1366 Incorrect decimal value: 'asdf' for column ``.`(temporary)`.`col18` at row 1 -Warning 1366 Incorrect decimal value: 'ghjk' for column ``.`(temporary)`.`col18` at row 2 +Warning 1366 Incorrect decimal value: 'asdf' for column `*any*`.`json_table`.`col18` at row 1 +Warning 1366 Incorrect decimal value: 'ghjk' for column `*any*`.`json_table`.`col18` at row 2 CREATE TABLE t1(jd JSON); INSERT INTO t1 VALUES('["asdf"]'),('["ghjk"]'); SELECT * FROM t1, @@ -875,8 +875,8 @@ jd col18 ["asdf"] 0.000 ["ghjk"] 0.000 Warnings: -Warning 1366 Incorrect decimal value: 'asdf' for column ``.`(temporary)`.`col18` at row 1 -Warning 1366 Incorrect decimal value: 'ghjk' for column ``.`(temporary)`.`col18` at row 1 +Warning 1366 Incorrect decimal value: 'asdf' for column `*any*`.`json_table`.`col18` at row 1 +Warning 1366 Incorrect decimal value: 'ghjk' for column `*any*`.`json_table`.`col18` at row 1 DROP TABLE t1; # # Bug#25540027: SIG 11 IN FIND_FIELD_IN_TABLE | SQL/SQL_BASE.CC diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index 6b2a45099b7..bbb6db9cc7b 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -1041,3 +1041,26 @@ COLUMNS --echo # --echo # End of 10.9 tests --echo # + +--echo # +--echo # MDEV-27898 CREATE VIEW AS SELECT FROM JSON_TABLE column requires global privileges +--echo # + +create view v1 as (select * from + json_table('[{"a":"1"}]', '$[*]' columns(a int path '$.a') ) as jt); + +create user u1@localhost; +grant ALL on test.* to u1@localhost; + +--connect (con1,localhost,u1,,test) + +create view v2 as + (select * from json_table('[{"a":"1"}]', '$[*]' columns(a int path '$.a') ) as jt); + +disconnect con1; +connection default; +DROP VIEW v2; +DROP VIEW v1; +DROP USER u1@localhost; + +--echo # End of 10.11 tests diff --git a/sql/json_table.cc b/sql/json_table.cc index 14c5aafdd79..bb126f36b85 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -711,6 +711,8 @@ TABLE *Create_json_table::start(THD *thd, if (!(table= Create_tmp_table::start(thd, param, table_alias))) DBUG_RETURN(0); share= table->s; + share->db= any_db; + share->table_name= { STRING_WITH_LEN("json_table") }; share->not_usable_by_query_cache= FALSE; share->db_plugin= NULL; if (!(table->file= new (&table->mem_root) ha_json_table(share, jt))) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 47b21433475..5b4a3ebb3cf 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -13053,6 +13053,13 @@ void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, DBUG_VOID_RETURN; } + /* JSON_TABLE and other db detached table */ + if (db == any_db.str) + { + grant->privilege= SELECT_ACL; + DBUG_VOID_RETURN; + } + /* global privileges */ grant->privilege= sctx->master_access; From 1c9caba770b13c64a0bb7c7f86d5d24413d568af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 16 Oct 2025 13:12:58 +0300 Subject: [PATCH 28/69] =?UTF-8?q?MDEV-37659=20CHECK=20TABLE=E2=80=A6EXTEND?= =?UTF-8?q?ED=20error=20on=20a=20column=20prefix=20index?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit trx_undo_prev_version(): Prevent unsafe BLOB access. Tested by: Saahil Alam Reviewed by: Thirunarayanan Balathandayuthapani --- storage/innobase/include/trx0purge.h | 3 +++ storage/innobase/trx/trx0rec.cc | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index fd355758eba..02221390189 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -451,6 +451,9 @@ public: /** @return purge_sys.view or purge_sys.end_view */ inline const ReadViewBase &view() const; + + /** @return whether this is part of CHECK TABLE ... EXTENDED */ + bool is_extended() const noexcept { return latch < END_VIEW; } }; struct end_view_guard diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 4cc9db0c1a3..37c64d21532 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -2229,6 +2229,21 @@ static dberr_t trx_undo_prev_version(const rec_t *rec, dict_index_t *index, byte* buf; if (row_upd_changes_field_size_or_external(index, offsets, update)) { + /* When CHECK TABLE ... EXTENDED checks for orphan + records in secondary indexes, it normally covers some + history that is already being purged. This is safe as + long as the undo log records have not been freed yet. + + However, BLOBs are only safe to access as long as the + purge_sys.view does not permit them to be freed. The + check.latch will freeze the purge_sys.view by blocking + purge_sys.clone_oldest_view() at the start of + trx_purge() or by blocking purge_sys.batch_cleanup() + at the end of trx_purge(). */ + if (check.is_extended() && purge_sys.is_purgeable(trx_id)) { + return DB_SUCCESS; + } + /* We should confirm the existence of disowned external data, if the previous version record is delete marked. If the trx_id of the previous record is seen by purge view, we should treat From 057c83a407354b41778583790d835a5b8550c77d Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 13 Apr 2023 23:10:52 +1000 Subject: [PATCH 29/69] MDEV-28363 remove #ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor --- storage/spider/ha_spider.cc | 10 ---------- storage/spider/spd_db_conn.cc | 14 -------------- storage/spider/spd_db_mysql.cc | 5 ----- storage/spider/spd_include.h | 1 - storage/spider/spd_sys_table.cc | 22 ---------------------- storage/spider/spd_sys_table.h | 22 ---------------------- 6 files changed, 74 deletions(-) diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 8363a557a44..2623e0cc057 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -10024,7 +10024,6 @@ int ha_spider::mk_bulk_tmp_table_and_bulk_start() dbton_hdl->first_link_idx >= 0 && dbton_hdl->need_copy_for_update(roop_count) ) { -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor LEX_CSTRING field_name = {STRING_WITH_LEN("a")}; if ( !tmp_table[roop_count] && @@ -10033,15 +10032,6 @@ int ha_spider::mk_bulk_tmp_table_and_bulk_start() &result_list.upd_tmp_tbl_prms[roop_count], &field_name, result_list.update_sqls[roop_count].charset())) ) -#else - if ( - !tmp_table[roop_count] && - !(tmp_table[roop_count] = spider_mk_sys_tmp_table( - wide_handler->trx->thd, table, - &result_list.upd_tmp_tbl_prms[roop_count], "a", - result_list.update_sqls[roop_count].charset())) - ) -#endif { error_num = HA_ERR_OUT_OF_MEM; goto error_2; diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index c17ddbc7eb7..f55458ab1e1 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -3396,18 +3396,12 @@ int spider_db_store_result( DBUG_PRINT("info",("spider store result to temporary table")); DBUG_ASSERT(!current->result_tmp_tbl); -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor LEX_CSTRING field_name1 = {STRING_WITH_LEN("a")}; LEX_CSTRING field_name2 = {STRING_WITH_LEN("b")}; LEX_CSTRING field_name3 = {STRING_WITH_LEN("c")}; if (!(current->result_tmp_tbl = spider_mk_sys_tmp_table_for_result( thd, table, ¤t->result_tmp_tbl_prm, &field_name1, &field_name2, &field_name3, &my_charset_bin))) -#else - if (!(current->result_tmp_tbl = spider_mk_sys_tmp_table_for_result( - thd, table, ¤t->result_tmp_tbl_prm, "a", "b", "c", - &my_charset_bin))) -#endif { DBUG_RETURN(HA_ERR_OUT_OF_MEM); } @@ -3757,21 +3751,13 @@ int spider_db_store_result_for_reuse_cursor( DBUG_PRINT("info",("spider store result to temporary table")); DBUG_ASSERT(!current->result_tmp_tbl); -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor LEX_CSTRING field_name1 = {STRING_WITH_LEN("a")}; LEX_CSTRING field_name2 = {STRING_WITH_LEN("b")}; LEX_CSTRING field_name3 = {STRING_WITH_LEN("c")}; if (!(current->result_tmp_tbl = spider_mk_sys_tmp_table_for_result( thd, table, ¤t->result_tmp_tbl_prm, &field_name1, &field_name2, &field_name3, &my_charset_bin))) -#else - if (!(current->result_tmp_tbl = spider_mk_sys_tmp_table_for_result( - thd, table, ¤t->result_tmp_tbl_prm, "a", "b", "c", - &my_charset_bin))) -#endif - { DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } current->result_tmp_tbl_thd = thd; TABLE *tmp_tbl = current->result_tmp_tbl; tmp_tbl->file->extra(HA_EXTRA_WRITE_CACHE); diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 4ea3c8fa5c1..45752efadbf 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -12022,14 +12022,9 @@ int spider_mbase_handler::mk_bulk_tmp_table_and_bulk_start() DBUG_PRINT("info",("spider this=%p", this)); if (!upd_tmp_tbl) { -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor LEX_CSTRING field_name = {STRING_WITH_LEN("a")}; if (!(upd_tmp_tbl = spider_mk_sys_tmp_table( thd, table, &upd_tmp_tbl_prm, &field_name, update_sql.charset()))) -#else - if (!(upd_tmp_tbl = spider_mk_sys_tmp_table( - thd, table, &upd_tmp_tbl_prm, "a", update_sql.charset()))) -#endif { DBUG_RETURN(HA_ERR_OUT_OF_MEM); } diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h index 9038879b8ce..6ce0919aa33 100644 --- a/storage/spider/spd_include.h +++ b/storage/spider/spd_include.h @@ -106,7 +106,6 @@ #define SPIDER_read_record_read_record(A) read_record() #define SPIDER_has_Item_with_subquery -#define SPIDER_use_LEX_CSTRING_for_Field_blob_constructor #define SPIDER_use_LEX_CSTRING_for_database_tablename_alias #define SPIDER_THD_db_str(A) (A)->db.str #define SPIDER_THD_db_length(A) (A)->db.length diff --git a/storage/spider/spd_sys_table.cc b/storage/spider/spd_sys_table.cc index 66ee45474c4..bbdbbb93f3e 100644 --- a/storage/spider/spd_sys_table.cc +++ b/storage/spider/spd_sys_table.cc @@ -3036,7 +3036,6 @@ error: DBUG_RETURN(error_num); } -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor TABLE *spider_mk_sys_tmp_table( THD *thd, TABLE *table, @@ -3044,15 +3043,6 @@ TABLE *spider_mk_sys_tmp_table( const LEX_CSTRING *field_name, CHARSET_INFO *cs ) -#else -TABLE *spider_mk_sys_tmp_table( - THD *thd, - TABLE *table, - TMP_TABLE_PARAM *tmp_tbl_prm, - const char *field_name, - CHARSET_INFO *cs -) -#endif { Field_blob *field; Item_field *i_field; @@ -3110,7 +3100,6 @@ void spider_rm_sys_tmp_table( DBUG_VOID_RETURN; } -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor TABLE *spider_mk_sys_tmp_table_for_result( THD *thd, TABLE *table, @@ -3120,17 +3109,6 @@ TABLE *spider_mk_sys_tmp_table_for_result( const LEX_CSTRING *field_name3, CHARSET_INFO *cs ) -#else -TABLE *spider_mk_sys_tmp_table_for_result( - THD *thd, - TABLE *table, - TMP_TABLE_PARAM *tmp_tbl_prm, - const char *field_name1, - const char *field_name2, - const char *field_name3, - CHARSET_INFO *cs -) -#endif { Field_blob *field1, *field2, *field3; Item_field *i_field1, *i_field2, *i_field3; diff --git a/storage/spider/spd_sys_table.h b/storage/spider/spd_sys_table.h index ce3897c7382..f6f7049c45a 100644 --- a/storage/spider/spd_sys_table.h +++ b/storage/spider/spd_sys_table.h @@ -492,7 +492,6 @@ int spider_sys_replace( bool *modified_non_trans_table ); -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor TABLE *spider_mk_sys_tmp_table( THD *thd, TABLE *table, @@ -500,15 +499,6 @@ TABLE *spider_mk_sys_tmp_table( const LEX_CSTRING *field_name, CHARSET_INFO *cs ); -#else -TABLE *spider_mk_sys_tmp_table( - THD *thd, - TABLE *table, - TMP_TABLE_PARAM *tmp_tbl_prm, - const char *field_name, - CHARSET_INFO *cs -); -#endif void spider_rm_sys_tmp_table( THD *thd, @@ -516,7 +506,6 @@ void spider_rm_sys_tmp_table( TMP_TABLE_PARAM *tmp_tbl_prm ); -#ifdef SPIDER_use_LEX_CSTRING_for_Field_blob_constructor TABLE *spider_mk_sys_tmp_table_for_result( THD *thd, TABLE *table, @@ -526,17 +515,6 @@ TABLE *spider_mk_sys_tmp_table_for_result( const LEX_CSTRING *field_name3, CHARSET_INFO *cs ); -#else -TABLE *spider_mk_sys_tmp_table_for_result( - THD *thd, - TABLE *table, - TMP_TABLE_PARAM *tmp_tbl_prm, - const char *field_name1, - const char *field_name2, - const char *field_name3, - CHARSET_INFO *cs -); -#endif void spider_rm_sys_tmp_table_for_result( THD *thd, From 30415acc33c31ebb103eb298bc4fcc22f42b4b7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Oct 2025 09:41:20 +0300 Subject: [PATCH 30/69] MDEV-37244: Adjust main.analyze_stmt_prefetch_count We previously allowed up to 25% more page reads than page accesses. For some reason, in a macOS environment we can observe 26% more page reads when the next two commits are present, and in one Microsoft Windows environment 34% more page reads. Let us allow 50% slack. Also, output the raw values in case of failure. --- mysql-test/main/analyze_stmt_prefetch_count.result | 11 +++++++++-- mysql-test/main/analyze_stmt_prefetch_count.test | 7 ++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/analyze_stmt_prefetch_count.result b/mysql-test/main/analyze_stmt_prefetch_count.result index e6f4ce1f714..57491ac3190 100644 --- a/mysql-test/main/analyze_stmt_prefetch_count.result +++ b/mysql-test/main/analyze_stmt_prefetch_count.result @@ -33,9 +33,16 @@ select @pages_accessed > 1000 and @pages_accessed < 1500; @pages_accessed > 1000 and @pages_accessed < 1500 1 set @total_read = (@pages_read_count + @pages_prefetch_read_count); -select @pages_accessed*0.75 < @total_read, @total_read < @pages_accessed*1.25; -@pages_accessed*0.75 < @total_read @total_read < @pages_accessed*1.25 +set @low_ok= @pages_accessed*0.75 < @total_read; +set @high_ok= @total_read < @pages_accessed*1.50; +select @low_ok, @high_ok; +@low_ok @high_ok 1 1 +select +if(@low_ok and @high_ok,0,@pages_accessed) unexpected_accessed, +if(@low_ok and @high_ok,0,@total_read) unexpected_read; +unexpected_accessed unexpected_read +0 0 set @innodb_pages_read1= (select variable_value from information_schema.session_status diff --git a/mysql-test/main/analyze_stmt_prefetch_count.test b/mysql-test/main/analyze_stmt_prefetch_count.test index 6859b15150b..822d45b368a 100644 --- a/mysql-test/main/analyze_stmt_prefetch_count.test +++ b/mysql-test/main/analyze_stmt_prefetch_count.test @@ -48,8 +48,13 @@ set @pages_prefetch_read_count= cast(json_value(@js,'$.pages_prefetch_read_count select @pages_accessed > 1000 and @pages_accessed < 1500; set @total_read = (@pages_read_count + @pages_prefetch_read_count); +set @low_ok= @pages_accessed*0.75 < @total_read; +set @high_ok= @total_read < @pages_accessed*1.50; -select @pages_accessed*0.75 < @total_read, @total_read < @pages_accessed*1.25; +select @low_ok, @high_ok; +select +if(@low_ok and @high_ok,0,@pages_accessed) unexpected_accessed, +if(@low_ok and @high_ok,0,@total_read) unexpected_read; set @innodb_pages_read1= (select variable_value From 81f25fdc743b486a93bcb192545753931a4212cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Oct 2025 09:41:50 +0300 Subject: [PATCH 31/69] MDEV-37244: Avoid spin loop on page I/O waits While waiting for for I/O completion, let us skip spin loops. Even on fast storage, reading a page into the buffer pool takes so long that a spin loop would only end up wasting CPU time. block_lock::s_lock_nospin(): A no-spin variant of acquiring a shared buffer page latch. Regular s_lock() always involveis a spin loop. ssux_lock_impl::rd_lock_spin(), ssux_lock_impl::rd_lock_nospin(): Split from rd_wait(). ssux_lock_impl::rd_lock(): Invoke either rd_lock_nospin() or rd_lock_try() and rd_lock_spin(). buf_page_get_low(): After acquiring a page latch on an io-fixed block, try to optimize operations on the page latch. Reviewed by: Thirunarayanan Balathandayuthapani --- storage/innobase/buf/buf0buf.cc | 43 +++++++++++++++++++++++++---- storage/innobase/include/srw_lock.h | 14 ++++++++-- storage/innobase/include/sux_lock.h | 9 ++++++ storage/innobase/sync/srw_lock.cc | 22 ++++++++++----- 4 files changed, 72 insertions(+), 16 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 46c5d17213a..daabdf74847 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2582,7 +2582,7 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, std::this_thread::sleep_for(std::chrono::microseconds(100)); continue; } - b->lock.s_lock(); + b->lock.s_lock_nospin(); state= b->state(); ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); @@ -2836,15 +2836,16 @@ ignore_unfixed: in buf_page_t::read_complete() or buf_pool_t::corrupted_evict(), or after buf_zip_decompress() in this function. */ - block->page.lock.s_lock(); + block->page.lock.s_lock_nospin(); state = block->page.state(); ut_ad(state < buf_page_t::READ_FIX - || state >= buf_page_t::WRITE_FIX); + || state > buf_page_t::WRITE_FIX); const page_id_t id{block->page.id()}; - block->page.lock.s_unlock(); if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { block->page.unfix(); + block->page.lock.s_unlock(); + if (UNIV_UNLIKELY(id == page_id)) { /* The page read was completed, and another thread marked the page as free @@ -2865,8 +2866,36 @@ ignore_unfixed: return nullptr; } ut_ad(id == page_id); - } else if (mode != BUF_PEEK_IF_IN_POOL) { - } else if (UNIV_UNLIKELY(!block->page.frame)) { + + if (UNIV_LIKELY(state > buf_page_t::UNFIXED + && block->page.frame)) { + switch (rw_latch) { + bool nowait; + case RW_NO_LATCH: + break; + default: + nowait = block->page.lock.s_x_upgrade(); + if (rw_latch == RW_SX_LATCH) { + block->page.lock.x_u_downgrade(); + } else { + ut_ad(rw_latch == RW_X_LATCH); + } + if (!nowait) { + goto latch_waited; + } else { + ut_ad(state < buf_page_t::READ_FIX); + } + /* fall through */ + case RW_S_LATCH: + mtr->memo_push(block, + mtr_memo_type_t(rw_latch)); + goto latched; + } + } + + block->page.lock.s_unlock(); + } else if (UNIV_UNLIKELY(!block->page.frame) + && mode == BUF_PEEK_IF_IN_POOL) { /* The BUF_PEEK_IF_IN_POOL mode is mainly used for dropping an adaptive hash index. There cannot be an adaptive hash index for a compressed-only page. */ @@ -2936,6 +2965,7 @@ wait_for_unzip: } } +latch_waited: mtr->memo_push(block, mtr_memo_type_t(rw_latch)); state = block->page.state(); @@ -2944,6 +2974,7 @@ wait_for_unzip: goto ignore_unfixed; } +latched: ut_ad(state < buf_page_t::READ_FIX || state > buf_page_t::WRITE_FIX); #ifdef BTR_CUR_HASH_ADAPT diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index 79a3e7c42a7..53328666ed8 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -202,9 +202,12 @@ class ssux_lock_impl void wr_wait(uint32_t lk) noexcept; /** Wake up wait() on the last rd_unlock() */ void wake() noexcept; - /** Acquire a read lock */ - void rd_wait() noexcept; public: + /** Acquire a read lock, with a spin loop */ + void rd_lock_spin() noexcept; + /** Acquire a read lock, without a spin loop */ + void rd_lock_nospin() noexcept; + void init() noexcept { writer.init(); @@ -261,7 +264,7 @@ public: return false; } - void rd_lock() noexcept { if (!rd_lock_try()) rd_wait(); } + inline void rd_lock() noexcept; void u_lock() noexcept { writer.wr_lock(); @@ -344,6 +347,11 @@ public: void unlock() noexcept { wr_unlock(); } }; +template<> inline void ssux_lock_impl::rd_lock() noexcept +{ rd_lock_nospin(); } +template<> inline void ssux_lock_impl::rd_lock() noexcept +{ if (!rd_lock_try()) rd_lock_spin(); } + #if defined _WIN32 || defined SUX_LOCK_GENERIC /** Slim read-write lock */ template diff --git a/storage/innobase/include/sux_lock.h b/storage/innobase/include/sux_lock.h index a5b09693107..7ef750ff8ae 100644 --- a/storage/innobase/include/sux_lock.h +++ b/storage/innobase/include/sux_lock.h @@ -185,6 +185,8 @@ public: /** Acquire a shared lock */ inline void s_lock(); inline void s_lock(const char *file, unsigned line); + /** Acquire a shared lock, skipping any spin loop */ + inline void s_lock_nospin() noexcept; /** Acquire an update lock */ inline void u_lock(); inline void u_lock(const char *file, unsigned line); @@ -387,6 +389,13 @@ template<> inline void index_lock::operator=(const sux_lock&) memset((void*) this, 0, sizeof *this); } +template<> inline void block_lock::s_lock_nospin() noexcept +{ + ut_ad(!have_any()); + lock.rd_lock_nospin(); + ut_d(s_lock_register()); +} + template inline void sux_lock::s_lock() { ut_ad(!have_x()); diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index 28b586de5df..74c09b8d0a3 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -378,12 +378,12 @@ template void ssux_lock_impl::wr_wait(uint32_t) noexcept; template void ssux_lock_impl::wr_wait(uint32_t) noexcept; template -void ssux_lock_impl::rd_wait() noexcept +void ssux_lock_impl::rd_lock_spin() noexcept { - const unsigned delay= srw_pause_delay(); - if (spinloop) { + const unsigned delay= srw_pause_delay(); + for (auto spin= srv_n_spin_wait_rounds; spin; spin--) { srw_pause(delay); @@ -392,14 +392,21 @@ void ssux_lock_impl::rd_wait() noexcept } } - /* Subscribe to writer.wake() or write.wake_all() calls by + rd_lock_nospin(); +} + +template +void ssux_lock_impl::rd_lock_nospin() noexcept +{ + const unsigned delay= srw_pause_delay(); + /* Subscribe to writer.wake() or write.wake_all() calls of concurrently executing rd_wait() or writer.wr_unlock(). */ uint32_t wl= writer.WAITER + writer.lock.fetch_add(writer.WAITER, std::memory_order_acquire); for (;;) { - if (UNIV_LIKELY(writer.HOLDER & wl)) + if (writer.HOLDER & wl) writer.wait(wl); uint32_t lk= rd_lock_try_low(); if (!lk) @@ -429,8 +436,9 @@ void ssux_lock_impl::rd_wait() noexcept writer.wake_all(); } -template void ssux_lock_impl::rd_wait() noexcept; -template void ssux_lock_impl::rd_wait() noexcept; +template void ssux_lock_impl::rd_lock_spin() noexcept; +template void ssux_lock_impl::rd_lock_nospin() noexcept; +template void ssux_lock_impl::rd_lock_nospin() noexcept; #if defined _WIN32 || defined SUX_LOCK_GENERIC template<> void srw_lock_::rd_wait() noexcept From 6087bdae8ce30614b9933c258238c80d440bccad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Oct 2025 12:35:34 +0300 Subject: [PATCH 32/69] MDEV-37244: Avoid page lookup after read buf_read_page(): Return a pointer to a buffer-fixed, non-read-fixed page, or nullptr in case of an error. IORequest::read_complete(): Assert that the page is both read-fixed and buffer-fixed. Sample recv_sys.recovery_on only once. Buffer-unfix the page when the asynchronous read completes. buf_page_t::read_complete(): Assert that the page is both read-fixed and buffer-fixed. Remove a hard-to-test condition on innodb_force_recovery that made a difference when the page number in the read frame did not match. It makes no sense to ignore such corruption. buf_page_t::read_wait(): Wait for a read-fixed and buffer-fixed page to be only buffer-fixed, by acquiring a shared latch. buf_page_init_for_read(): Return a pointer to a buffer-fixed block descriptor pointer, bitwise-ORed with 1 in case the block already exists in the buffer pool. buf_page_create_low(): Before invoking buf_relocate() on a compressed-only ROW_FORMAT=COMPRESSED page, wait for any concurrent IORequest::read_complete() to release its buffer-fix. This is similar to what buf_pool_t::unzip() already did. buf_read_release_count(): Common code for freeing a spare block if needed as well as updating some statistics counters. buf_read_page_low(): Replace the parameter sync with err, which will return an error code to a synchronous caller. Return the pointer to the block, or the special values nullptr (read failure) or -1 or -2 for asynchronous reads. Increment the statistics when a synchronous read was requested. In a synchronous read, if the page has already been allocated in the buffer pool but it is read-fixed, wait for the read to complete. buf_page_get_zip(): Get a buffer-fixed page from buf_read_page(), and unfix() it. Our caller is relying solely on a page latch. buf_read_page_background(): Update the statistics if supplied. --- storage/innobase/btr/btr0cur.cc | 33 +-- storage/innobase/buf/buf0buf.cc | 237 +++++++++-------- storage/innobase/buf/buf0dump.cc | 9 +- storage/innobase/buf/buf0rea.cc | 408 +++++++++++++++++------------ storage/innobase/fil/fil0fil.cc | 12 +- storage/innobase/include/buf0buf.h | 11 +- storage/innobase/include/buf0rea.h | 35 ++- 7 files changed, 412 insertions(+), 333 deletions(-) diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 28f4109ae95..cfadab84fe7 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -2255,26 +2255,27 @@ btr_cur_ins_lock_and_undo( /** Prefetch siblings of the leaf for the pessimistic operation. @param block leaf page -@param index index of the page */ +@param index index of the page +@param trx transaction */ static void btr_cur_prefetch_siblings(const buf_block_t *block, - const dict_index_t *index) + const dict_index_t *index, + trx_t *trx) noexcept { ut_ad(page_is_leaf(block->page.frame)); const page_t *page= block->page.frame; - uint32_t prev= mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_PREV)); uint32_t next= mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_NEXT)); - fil_space_t *space= index->table->space; + page_id_t id{space->id, + mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_PREV))}; - if (prev == FIL_NULL); - else if (space->acquire()) - buf_read_page_background(space, page_id_t(space->id, prev), - block->zip_size()); - if (next == FIL_NULL); - else if (space->acquire()) - buf_read_page_background(space, page_id_t(space->id, next), - block->zip_size()); + if (id.page_no() != FIL_NULL && space->acquire()) + buf_read_page_background(id, space, trx); + + id.set_page_no(next); + + if (next != FIL_NULL && space->acquire()) + buf_read_page_background(id, space, trx); } /*************************************************************//** @@ -2392,7 +2393,7 @@ fail: /* prefetch siblings of the leaf for the pessimistic operation, if the page is leaf. */ if (leaf) { - btr_cur_prefetch_siblings(block, index); + btr_cur_prefetch_siblings(block, index, mtr->trx); } fail_err: @@ -3524,7 +3525,7 @@ any_extern: /* prefetch siblings of the leaf for the pessimistic operation. */ - btr_cur_prefetch_siblings(block, index); + btr_cur_prefetch_siblings(block, index, mtr->trx); return(DB_OVERFLOW); } @@ -3696,7 +3697,7 @@ corrupted: func_exit: /* prefetch siblings of the leaf for the pessimistic operation. */ - btr_cur_prefetch_siblings(block, index); + btr_cur_prefetch_siblings(block, index, mtr->trx); } return(err); @@ -4372,7 +4373,7 @@ btr_cur_optimistic_delete( mtr)) { /* prefetch siblings of the leaf for the pessimistic operation. */ - btr_cur_prefetch_siblings(block, cursor->index()); + btr_cur_prefetch_siblings(block, cursor->index(), mtr->trx); err = DB_FAIL; goto func_exit; } diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index daabdf74847..8ce7446b936 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -338,12 +338,6 @@ void buf_inc_get() noexcept buf_inc_get(trx); } -static ATTRIBUTE_NOINLINE void buf_inc_read(trx_t *trx) noexcept -{ - if (ha_handler_stats *stats= trx->active_handler_stats) - stats->pages_read_count++; -} - # ifdef SUX_LOCK_GENERIC void page_hash_latch::read_lock_wait() noexcept { @@ -634,7 +628,8 @@ bool buf_is_zeroes(span buf) noexcept @param fsp_flags contents of FIL_SPACE_FLAGS @return whether the page is corrupted */ buf_page_is_corrupted_reason -buf_page_is_corrupted(bool check_lsn, const byte *read_buf, uint32_t fsp_flags) noexcept +buf_page_is_corrupted(bool check_lsn, const byte *read_buf, uint32_t fsp_flags) + noexcept { if (fil_space_t::full_crc32(fsp_flags)) { bool compressed = false, corrupted = false; @@ -2283,20 +2278,20 @@ buf_page_t *buf_page_get_zip(const page_id_t page_id) noexcept if (!bpage) { hash_lock.unlock_shared(); - switch (dberr_t err= buf_read_page(page_id, chain, false)) { - case DB_SUCCESS: - case DB_SUCCESS_LOCKED_REC: - if (trx) buf_inc_read(trx); - continue; - case DB_TABLESPACE_DELETED: - return nullptr; - default: - sql_print_error("InnoDB: Reading compressed page " - "[page id: space=" UINT32PF ", page number=" UINT32PF - "] failed with error: %s", - page_id.space(), page_id.page_no(), ut_strerr(err)); + dberr_t err; + bpage= reinterpret_cast + (buf_read_page(page_id, &err, chain, false)); + if (!bpage) + { + if (err != DB_TABLESPACE_DELETED) + sql_print_error("InnoDB: Reading compressed page " + "[page id: space=" UINT32PF ", page number=" UINT32PF + "] failed with error: %s", + page_id.space(), page_id.page_no(), ut_strerr(err)); return nullptr; } + hash_lock.lock_shared(); + bpage->unfix(); } ut_ad(bpage->in_file()); @@ -2305,7 +2300,11 @@ buf_page_t *buf_page_get_zip(const page_id_t page_id) noexcept const bool got_s_latch= bpage->lock.s_lock_try(); hash_lock.unlock_shared(); if (UNIV_LIKELY(got_s_latch)) + { + ut_ad(!bpage->is_read_fixed()); break; + } + /* We may fail to acquire bpage->lock because a read is holding an exclusive latch on this block and either in progress or invoking buf_pool_t::corrupted_evict(). @@ -2541,17 +2540,18 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, { hash_lock.lock_shared(); buf_page_t *b= page_hash.get(id, chain); + uint32_t state_1; if (b) { - uint32_t state= b->fix() + 1; + state_1= b->fix(); hash_lock.unlock_shared(); - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) + if (UNIV_UNLIKELY(state_1 < buf_page_t::UNFIXED)) { - ut_ad(state > buf_page_t::FREED); + ut_ad(state_1 >= buf_page_t::FREED); if (c == FIX_ALSO_FREED && b->id() == id) { - ut_ad(state == buf_page_t::FREED + 1); + ut_ad(state_1 == buf_page_t::FREED); return reinterpret_cast(b); } /* The page was marked as freed or corrupted. */ @@ -2562,7 +2562,7 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, return nullptr; } - if (state >= buf_page_t::READ_FIX && state < buf_page_t::WRITE_FIX) + if (state_1 >= buf_page_t::READ_FIX && state_1 < buf_page_t::WRITE_FIX) { if (c == FIX_NOWAIT) { @@ -2573,7 +2573,7 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, if (UNIV_LIKELY(b->frame != nullptr)) ut_ad(b->frame==reinterpret_cast(b)->frame_address()); - else if (state < buf_page_t::READ_FIX) + else if (state_1 < buf_page_t::READ_FIX) goto unzip; else { @@ -2582,10 +2582,8 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, std::this_thread::sleep_for(std::chrono::microseconds(100)); continue; } - b->lock.s_lock_nospin(); - state= b->state(); - ut_ad(state < buf_page_t::READ_FIX || state >= buf_page_t::WRITE_FIX); + b->read_wait(trx); b->lock.s_unlock(); } @@ -2603,7 +2601,6 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, goto corrupted; b= &block->page; - state= b->state(); b->lock.x_unlock(); } @@ -2614,17 +2611,21 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, if (c == FIX_NOWAIT) return reinterpret_cast(-1); - - switch (dberr_t local_err= buf_read_page(id, chain)) { - default: - if (err) - *err= local_err; + buf_block_t *block= buf_read_page(id, err, chain); + if (!block) return nullptr; - case DB_SUCCESS: - case DB_SUCCESS_LOCKED_REC: - if (trx) buf_inc_read(trx); - buf_read_ahead_random(id); + buf_read_ahead_random(id); + if (err) + { + ut_ad(*err == DB_SUCCESS || *err == DB_SUCCESS_LOCKED_REC); + *err= DB_SUCCESS; } + if (UNIV_UNLIKELY(!block->page.frame)) + { + b= &block->page; + goto unzip; + } + return block; } } @@ -2775,47 +2776,25 @@ loop: switch (mode) { case BUF_GET_IF_IN_POOL: case BUF_PEEK_IF_IN_POOL: - return nullptr; - } - - /* The call path is buf_read_page() -> - buf_read_page_low() (fil_space_t::io()) -> - buf_page_t::read_complete() -> - buf_decrypt_after_read(). Here fil_space_t* is used - and we decrypt -> buf_page_check_corrupt() where page - checksums are compared. Decryption, decompression as - well as error handling takes place at a lower level. - Here we only need to know whether the page really is - corrupted, or if an encrypted page with a valid - checksum cannot be decypted. */ - - switch (dberr_t local_err = buf_read_page(page_id, chain)) { - case DB_SUCCESS: - case DB_SUCCESS_LOCKED_REC: - if (trx) buf_inc_read(trx); - buf_read_ahead_random(page_id); break; default: - if (mode != BUF_GET_POSSIBLY_FREED - && retries++ < BUF_PAGE_READ_MAX_RETRIES) { - DBUG_EXECUTE_IF("intermittent_read_failure", - retries = BUF_PAGE_READ_MAX_RETRIES;); + block = buf_read_page(page_id, err, chain); + if (!block) { + break; + } else if (err) { + *err = DB_SUCCESS; } - /* fall through */ - case DB_PAGE_CORRUPTED: - if (err) { - *err = local_err; - } - return nullptr; + + ut_d(if (!(++buf_dbg_counter % 5771)) buf_pool.validate()); + buf_read_ahead_random(page_id); + state = block->page.state(); + goto not_read_fixed; } - ut_d(if (!(++buf_dbg_counter % 5771)) buf_pool.validate()); - goto loop; + return nullptr; got_block: state++; - ut_ad(state > buf_page_t::FREED); - if (state > buf_page_t::READ_FIX && state < buf_page_t::WRITE_FIX) { if (mode == BUF_PEEK_IF_IN_POOL) { ignore_block: @@ -2836,13 +2815,12 @@ ignore_unfixed: in buf_page_t::read_complete() or buf_pool_t::corrupted_evict(), or after buf_zip_decompress() in this function. */ - block->page.lock.s_lock_nospin(); + block->page.read_wait(trx); state = block->page.state(); - ut_ad(state < buf_page_t::READ_FIX - || state > buf_page_t::WRITE_FIX); - const page_id_t id{block->page.id()}; if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) { + const page_id_t id{block->page.id()}; + block->page.unfix(); block->page.lock.s_unlock(); @@ -2865,7 +2843,8 @@ ignore_unfixed: return nullptr; } - ut_ad(id == page_id); + + ut_ad(block->page.id() == page_id); if (UNIV_LIKELY(state > buf_page_t::UNFIXED && block->page.frame)) { @@ -2894,12 +2873,19 @@ ignore_unfixed: } block->page.lock.s_unlock(); - } else if (UNIV_UNLIKELY(!block->page.frame) - && mode == BUF_PEEK_IF_IN_POOL) { - /* The BUF_PEEK_IF_IN_POOL mode is mainly used for dropping an - adaptive hash index. There cannot be an - adaptive hash index for a compressed-only page. */ - goto ignore_block; + } else { +not_read_fixed: + ut_ad(state > buf_page_t::FREED); + ut_ad(state < buf_page_t::READ_FIX + || state > buf_page_t::WRITE_FIX); + if (UNIV_UNLIKELY(!block->page.frame + && mode == BUF_PEEK_IF_IN_POOL)) { + /* The BUF_PEEK_IF_IN_POOL mode is mainly used + for dropping an adaptive hash index. There + cannot be an adaptive hash index for a + compressed-only page. */ + goto ignore_block; + } } ut_ad(mode == BUF_GET_IF_IN_POOL || mode == BUF_PEEK_IF_IN_POOL @@ -3218,8 +3204,15 @@ retry: else state= bpage->state(); - ut_ad(state >= buf_page_t::FREED); + ut_ad(state > buf_page_t::FREED); ut_ad(state < buf_page_t::READ_FIX); + /* In addition to our buffer-fix, there may be another that is + held by a concurrent IORequest::read_complete() that had + released the bpage->lock in bpage->read_complete(...) but not + yet invoked bpage->unfix(). This should only be due to an + asynchronous read-ahead for a page that was actually marked as + freed in the underlying data file. */ + ut_ad(bpage->buf_fix_count(state) <= 2); if (state < buf_page_t::UNFIXED) bpage->set_reinit(buf_page_t::FREED); @@ -3239,10 +3232,18 @@ retry: else { page_hash_latch &hash_lock= buf_pool.page_hash.lock_get(chain); - /* It does not make sense to use transactional_lock_guard here, - because buf_relocate() would likely make the memory transaction - too large. */ - hash_lock.lock(); + for (;;) + { + hash_lock.lock(); + state= bpage->state(); + if ((state & ~buf_page_t::LRU_MASK) == 1) + break; + /* Wait for a concurrent IORequest::read_complete() to + invoke bpage->unfix(), for an unnecessary read-ahead of + a freed page. */ + ut_ad((state & ~buf_page_t::LRU_MASK) == 2); + hash_lock.unlock(); + } mysql_mutex_lock(&buf_pool.flush_list_mutex); buf_relocate(bpage, &free_block->page); @@ -3539,17 +3540,26 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, /** Complete a read of a page. @param node data file +@param recovery recv_recovery_is_on() @return whether the operation succeeded +@retval DB_SUCCESS if the read succeeded; caller must unfix() @retval DB_PAGE_CORRUPTED if the checksum or the page ID is incorrect @retval DB_DECRYPTION_FAILED if the page cannot be decrypted */ -dberr_t buf_page_t::read_complete(const fil_node_t &node) noexcept +dberr_t buf_page_t::read_complete(const fil_node_t &node, + bool recovery) noexcept { const page_id_t expected_id{id()}; - ut_ad(is_read_fixed()); + { + /* The block must be read-fixed and buffer-fixed. */ + ut_d(const auto s= state()); + ut_ad(s > READ_FIX); + ut_ad(s < WRITE_FIX); + } ut_ad(!buf_dblwr.is_inside(id())); ut_ad(id().space() == node.space->id); ut_ad(zip_size() == node.space->zip_size()); ut_ad(!!zip.ssize == !!zip.data); + ut_ad(recovery == recv_sys.recovery_on); const byte *read_frame= zip.data ? zip.data : frame; ut_ad(read_frame); @@ -3617,29 +3627,22 @@ dberr_t buf_page_t::read_complete(const fil_node_t &node) noexcept err= buf_page_check_corrupt(this, node); if (UNIV_UNLIKELY(err != DB_SUCCESS)) { -database_corrupted: + database_corrupted: if (belongs_to_unzip_LRU()) -database_corrupted_compressed: + database_corrupted_compressed: memset_aligned(frame, 0, srv_page_size); - if (!srv_force_recovery) - goto release_page; - - if (err == DB_PAGE_CORRUPTED || err == DB_DECRYPTION_FAILED) + release_page: + if (recovery && node.space->full_crc32() && node.space->crypt_data && + recv_sys.dblwr.find_deferred_page(node, id().page_no(), + const_cast(read_frame))) + /* Recovered from the doublewrite buffer */ + err= DB_SUCCESS; + else { -release_page: - if (node.space->full_crc32() && node.space->crypt_data && - recv_recovery_is_on() && - recv_sys.dblwr.find_deferred_page(node, id().page_no(), - const_cast(read_frame))) - { - /* Recover from doublewrite buffer */ - err= DB_SUCCESS; - goto success_page; - } - - if (recv_sys.free_corrupted_page(expected_id, node)); + if (recovery && recv_sys.free_corrupted_page(expected_id, node)); else if (err == DB_FAIL) + /* We already output a more specific message. */ err= DB_PAGE_CORRUPTED; else { @@ -3656,28 +3659,24 @@ release_page: FORCE_RECOVERY_MSG); } - buf_pool.corrupted_evict(this, buf_page_t::READ_FIX); + buf_pool.corrupted_evict(this, buf_page_t::READ_FIX + 1); return err; } } -success_page: - const bool recovery= frame && recv_recovery_is_on(); - - if (recovery && !recv_recover_page(node.space, this)) + if (!recovery || !frame) + { + ut_d(auto f=) zip.fix.fetch_sub(READ_FIX - UNFIXED); + ut_ad(f > READ_FIX); + ut_ad(f < WRITE_FIX); + } + else if (!recv_recover_page(node.space, this)) return DB_PAGE_CORRUPTED; if (UNIV_UNLIKELY(MONITOR_IS_ON(MONITOR_MODULE_BUF_PAGE))) buf_page_monitor(*this, true); DBUG_PRINT("ib_buf", ("read page %u:%u", id().space(), id().page_no())); - if (!recovery) - { - ut_d(auto f=) zip.fix.fetch_sub(READ_FIX - UNFIXED); - ut_ad(f >= READ_FIX); - ut_ad(f < WRITE_FIX); - } - lock.x_unlock(true); return DB_SUCCESS; diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index d13e0d0c82c..1003e9a5235 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -585,7 +585,6 @@ buf_load() so all pages from a given tablespace are consecutive. */ uint32_t cur_space_id = dump[0].space(); fil_space_t* space = fil_space_t::get(cur_space_id); - ulint zip_size = space ? space->zip_size() : 0; PSI_stage_progress* pfs_stage_progress __attribute__((unused)) = mysql_set_stage(srv_stage_buffer_pool_load.m_key); @@ -608,12 +607,6 @@ buf_load() cur_space_id = this_space_id; space = fil_space_t::get(cur_space_id); - - if (!space) { - continue; - } - - zip_size = space->zip_size(); } /* JAN: TODO: As we use background page read below, @@ -632,7 +625,7 @@ buf_load() } space->reacquire(); - buf_read_page_background(space, dump[i], zip_size); + buf_read_page_background(dump[i], space, nullptr); if (buf_load_abort_flag) { if (space) { diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 5aeb5c6f19e..59bb3c5c232 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -70,21 +70,26 @@ and the lock released later. @param chain buf_pool.page_hash cell for page_id @param block preallocated buffer block (set to nullptr if consumed) @return pointer to the block -@retval nullptr in case of an error */ +@retval nullptr in case of an error +@retval pointer to block | 1 if the page already exists in buf_pool */ static buf_page_t *buf_page_init_for_read(const page_id_t page_id, ulint zip_size, buf_pool_t::hash_chain &chain, buf_block_t *&block) noexcept { buf_page_t *bpage= !zip_size || (zip_size & 1) ? &block->page : nullptr; + constexpr uint32_t READ_BUF_FIX{buf_page_t::READ_FIX + 1}; page_hash_latch &hash_lock= buf_pool.page_hash.lock_get(chain); hash_lock.lock(); - if (buf_pool.page_hash.get(page_id, chain)) + buf_page_t *hash_page= buf_pool.page_hash.get(page_id, chain); + if (hash_page) { -page_exists: - hash_lock.unlock(); + page_exists: /* The page is already in the buffer pool. */ - return nullptr; + ut_d(const uint32_t state=) hash_page->fix(); + ut_ad(state >= buf_page_t::FREED); + hash_lock.unlock(); + return reinterpret_cast(uintptr_t(hash_page) | 1); } if (UNIV_UNLIKELY(mysql_mutex_trylock(&buf_pool.mutex))) @@ -92,7 +97,8 @@ page_exists: hash_lock.unlock(); mysql_mutex_lock(&buf_pool.mutex); hash_lock.lock(); - if (buf_pool.page_hash.get(page_id, chain)) + hash_page= buf_pool.page_hash.get(page_id, chain); + if (hash_page) { mysql_mutex_unlock(&buf_pool.mutex); goto page_exists; @@ -105,7 +111,7 @@ page_exists: { block= nullptr; reinterpret_cast(bpage)-> - initialise(page_id, zip_size & ~1, buf_page_t::READ_FIX); + initialise(page_id, zip_size & ~1, READ_BUF_FIX); /* x_unlock() will be invoked in buf_page_t::read_complete() by the io-handler thread. */ bpage->lock.x_lock(true); @@ -147,11 +153,15 @@ page_exists: check the page_hash again, as it may have been modified. */ if (UNIV_UNLIKELY(lru)) { - if (UNIV_LIKELY_NULL(buf_pool.page_hash.get(page_id, chain))) + hash_page= buf_pool.page_hash.get(page_id, chain); + if (UNIV_LIKELY_NULL(hash_page)) { /* The block was added by some other thread. */ + ut_d(const uint32_t state=) hash_page->fix(); + ut_ad(state >= buf_page_t::FREED); buf_buddy_free(data, zip_size); - goto func_exit; + mysql_mutex_unlock(&buf_pool.mutex); + return reinterpret_cast(uintptr_t(hash_page) | 1); } } @@ -166,7 +176,7 @@ page_exists: a false match. Therefore, we can safely initialize bpage before acquiring hash_lock. */ bpage->lock.init(); - bpage->init(buf_page_t::READ_FIX, page_id); + bpage->init(READ_BUF_FIX, page_id); bpage->lock.x_lock(true); hash_lock.lock(); @@ -179,10 +189,8 @@ page_exists: } buf_pool.stat.n_pages_read++; -func_exit: - mysql_mutex_unlock(&buf_pool.mutex); ut_ad(!bpage || bpage->in_file()); - + mysql_mutex_unlock(&buf_pool.mutex); return bpage; } @@ -195,6 +203,33 @@ inline ulonglong mariadb_measure() noexcept #endif } +void buf_page_t::read_wait(trx_t *trx) noexcept +{ + ulonglong start= 0, *stats= nullptr; + if (trx) + { + tpool::tpool_wait_begin(); + thd_wait_begin(trx->mysql_thd, THD_WAIT_DISKIO); + if (ha_handler_stats *active= trx->active_handler_stats) + { + active->pages_read_count++; + stats= &active->pages_read_time; + start= mariadb_measure(); + } + } + lock.s_lock_nospin(); + ut_d(const uint32_t latched_state{state()}); + ut_ad(latched_state > FREED); + ut_ad(latched_state < READ_FIX || latched_state > WRITE_FIX); + if (trx) + { + tpool::tpool_wait_end(); + thd_wait_end(trx->mysql_thd); + if (stats) + *stats+= mariadb_measure() - start; + } +} + /** Low-level function which reads a page asynchronously from a file to the buffer buf_pool if it is not already there, in which case does nothing. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The @@ -203,85 +238,126 @@ flag is cleared and the x-lock released by an i/o-handler thread. @param[in] page_id page id @param[in] zip_size 0 or ROW_FORMAT=COMPRESSED page size bitwise-ORed with 1 to allocate an uncompressed frame +@param[out] err nullptr for asynchronous; error code for synchronous: + DB_SUCCESS if the page was successfully read, + DB_SUCCESS_LOCKED_REC if the exists in the pool, + DB_PAGE_CORRUPTED on page checksum mismatch, + DB_DECRYPTION_FAILED if page post encryption checksum + matches but after decryption normal page checksum + does not match @param[in,out] chain buf_pool.page_hash cell for page_id @param[in,out] space tablespace @param[in,out] block preallocated buffer block @param[in] thd current_thd if sync -@param[in] sync whether synchronous aio is desired -@return error code -@retval DB_SUCCESS if the page was read -@retval DB_SUCCESS_LOCKED_REC if the page exists in the buffer pool already */ +@return buffer-fixed block (*err may be set to DB_SUCCESS_LOCKED_REC) +@retval -1 if err==nullptr and an asynchronous read was submitted +@retval -2 if err==nullptr and the page exists in the buffer pool +@retval nullptr if the page was not successfully read (*err will be set) */ static -dberr_t +buf_page_t* buf_read_page_low( const page_id_t page_id, ulint zip_size, + dberr_t* err, buf_pool_t::hash_chain& chain, fil_space_t* space, buf_block_t*& block, - THD* thd = nullptr, - bool sync = false) noexcept + THD* thd = nullptr) noexcept { - buf_page_t* bpage; + if (buf_dblwr.is_inside(page_id)) + { + fail: + space->release(); + if (err) + *err= DB_PAGE_CORRUPTED; + return nullptr; + } - if (buf_dblwr.is_inside(page_id)) { - space->release(); - return DB_PAGE_CORRUPTED; - } + buf_page_t *bpage= buf_page_init_for_read(page_id, zip_size, chain, block); + if (UNIV_UNLIKELY(!bpage)) + goto fail; + const bool exist(uintptr_t(bpage) & 1); + bpage= reinterpret_cast(uintptr_t(bpage) & ~uintptr_t{1}); + trx_t *const trx= thd ? thd_to_trx(thd) : nullptr; + if (exist) + { + if (!err) + { + bpage->unfix(); + bpage= reinterpret_cast(-2); + } + else + { + uint32_t state{bpage->state()}; + ut_d(page_id_t id{bpage->id()}); + ut_ad(state > buf_page_t::FREED); + if (state < buf_page_t::UNFIXED) + { + corrupted: + ut_ad(id == page_id || id == page_id_t{~0ULL}); + bpage->unfix(); + bpage= nullptr; + *err= DB_PAGE_CORRUPTED; + } + else if (!bpage->is_read_fixed(state)) + *err= DB_SUCCESS_LOCKED_REC; + else + { + bpage->read_wait(trx); + state= bpage->state(); + ut_d(id= bpage->id()); + bpage->lock.s_unlock(); + if (state < buf_page_t::UNFIXED) + goto corrupted; + } + } - bpage = buf_page_init_for_read(page_id, zip_size, chain, block); + space->release(); + return bpage; + } - if (!bpage) { - space->release(); - return DB_SUCCESS_LOCKED_REC; - } + ut_ad(bpage->in_file()); - ut_ad(bpage->in_file()); + void* dst= zip_size > 1 ? bpage->zip.data : bpage->frame; + const size_t len= zip_size & ~1 ? zip_size & ~1 : srv_page_size; - DBUG_LOG("ib_buf", - "read page " << page_id << " zip_size=" << zip_size - << (sync ? " sync" : " async")); + if (err != nullptr) + { + thd_wait_begin(thd, THD_WAIT_DISKIO); + ha_handler_stats *const stats= trx ? trx->active_handler_stats : nullptr; + const ulonglong start= stats ? mariadb_measure() : 0; + auto fio= space->io(IORequest(IORequest::READ_SYNC), + os_offset_t{page_id.page_no()} * len, len, dst, bpage); + *err= fio.err; + thd_wait_end(thd); + if (stats) + { + stats->pages_read_count++; + if (start) + stats->pages_read_time+= mariadb_measure() - start; + } + if (UNIV_LIKELY(*err == DB_SUCCESS)) + { + *err= bpage->read_complete(*fio.node, recv_sys.recovery_on); + if (*err) + bpage= nullptr; + space->release(); - void* dst = zip_size > 1 ? bpage->zip.data : bpage->frame; - const ulint len = zip_size & ~1 ? zip_size & ~1 : srv_page_size; + /* FIXME: Remove this, and accumulate stats->pages_read_count to + global statistics somewhere! */ + buf_LRU_stat_inc_io(); + return bpage; + } + } + else if (UNIV_LIKELY(DB_SUCCESS == + space->io(IORequest(IORequest::READ_ASYNC), + os_offset_t{page_id.page_no()} * len, len, + dst, bpage).err)) + return reinterpret_cast(-1); - fil_io_t fio; - - if (sync) { - ulonglong mariadb_timer = 0; - trx_t *const trx= thd ? thd_to_trx(thd) : nullptr; - if (trx && trx->active_handler_stats) { - mariadb_timer = mariadb_measure(); - } - - thd_wait_begin(thd, THD_WAIT_DISKIO); - fio = space->io(IORequest(IORequest::READ_SYNC), - os_offset_t{page_id.page_no()} * len, len, - dst, bpage); - thd_wait_end(thd); - if (mariadb_timer) { - trx->active_handler_stats->pages_read_time - += mariadb_measure() - mariadb_timer; - } - if (UNIV_UNLIKELY(fio.err != DB_SUCCESS)) { - goto read_fail; - } - /* The i/o was already completed in space->io() */ - fio.err = bpage->read_complete(*fio.node); - space->release(); - } else { - fio = space->io(IORequest(IORequest::READ_ASYNC), - os_offset_t{page_id.page_no()} * len, len, - dst, bpage); - if (UNIV_UNLIKELY(fio.err != DB_SUCCESS)) { - read_fail: - recv_sys.free_corrupted_page(page_id, - *space->chain.start); - buf_pool.corrupted_evict(bpage, buf_page_t::READ_FIX); - } - } - - return fio.err; + recv_sys.free_corrupted_page(page_id, *space->chain.start); + buf_pool.corrupted_evict(bpage, buf_page_t::READ_FIX + 1); + return nullptr; } /** Acquire a buffer block. */ @@ -290,8 +366,9 @@ static buf_block_t *buf_read_acquire() return buf_LRU_get_free_block(have_no_mutex_soft); } -/** Free a buffer block if needed. */ -static void buf_read_release(buf_block_t *block) +/** Free a buffer block if needed. +@param block block to be freed */ +static void buf_read_release(buf_block_t *block) noexcept { if (block) { @@ -301,22 +378,34 @@ static void buf_read_release(buf_block_t *block) } } -/** Report a completed read-ahead batch. -@param space tablespace -@param count number of pages submitted for reading */ -static ATTRIBUTE_NOINLINE -void buf_read_ahead_report(const fil_space_t &space, size_t count) noexcept +ATTRIBUTE_NOINLINE +/** Free a buffer block if needed, and update the read-ahead count. +@param block block to be freed +@param count number of blocks that were read ahead +@return count*/ +static size_t buf_read_release_count(buf_block_t *block, size_t count) noexcept { - if (THD *thd= current_thd) - if (trx_t *trx= thd_to_trx(thd)) - if (ha_handler_stats *stats= trx->active_handler_stats) - stats->pages_prefetched+= count; - mysql_mutex_lock(&buf_pool.mutex); - /* Read ahead is considered one I/O operation for the purpose of - LRU policy decision. */ - buf_LRU_stat_inc_io(); - buf_pool.stat.n_ra_pages_read_rnd+= count; - mysql_mutex_unlock(&buf_pool.mutex); + if (block || count) + { + mysql_mutex_lock(&buf_pool.mutex); + if (block) + buf_LRU_block_free_non_file_page(block); + if (count) + { + /* Read ahead is considered one I/O operation for the purpose of + LRU policy decision. */ + buf_LRU_stat_inc_io(); + buf_pool.stat.n_ra_pages_read+= count; + } + mysql_mutex_unlock(&buf_pool.mutex); + } + + if (count) + if (THD *thd= current_thd) + if (trx_t *trx= thd_to_trx(thd)) + if (ha_handler_stats *stats= trx->active_handler_stats) + stats->pages_prefetched+= count; + return count; } /** Applies a random read-ahead in buf_pool if there are at least a threshold @@ -389,13 +478,15 @@ read_ahead: goto allocate_block; } + /* Read all the suitable blocks within the area */ for (page_id_t i= low; i < high; ++i) { if (space->is_stopping()) break; buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(i.fold()); space->reacquire(); - if (buf_read_page_low(i, zip_size, chain, space, block) == DB_SUCCESS) + if (reinterpret_cast(-1) == + buf_read_page_low(i, zip_size, nullptr, chain, space, block, nullptr)) { count++; ut_ad(!block); @@ -405,18 +496,18 @@ read_ahead: } } - if (count) - buf_read_ahead_report(*space, count); - space->release(); - buf_read_release(block); - return count; + + return buf_read_release_count(block, count); } -dberr_t buf_read_page(const page_id_t page_id, - buf_pool_t::hash_chain &chain, bool unzip) noexcept +buf_block_t *buf_read_page(const page_id_t page_id, dberr_t *err, + buf_pool_t::hash_chain &chain, bool unzip) noexcept { fil_space_t *space= fil_space_t::get(page_id.space()); + dberr_t local_err; + if (!err) + err= &local_err; if (UNIV_UNLIKELY(!space)) { sql_print_information("InnoDB: trying to read page " @@ -424,7 +515,8 @@ dberr_t buf_read_page(const page_id_t page_id, ", page number=" UINT32PF "]" " in nonexisting or being-dropped tablespace", page_id.space(), page_id.page_no()); - return DB_TABLESPACE_DELETED; + *err= DB_TABLESPACE_DELETED; + return nullptr; } /* Our caller should already have ensured that the page does not @@ -436,7 +528,6 @@ dberr_t buf_read_page(const page_id_t page_id, { allocate_block: mysql_mutex_lock(&buf_pool.mutex); - buf_LRU_stat_inc_io(); block= buf_LRU_get_free_block(have_mutex); mysql_mutex_unlock(&buf_pool.mutex); } @@ -446,55 +537,47 @@ dberr_t buf_read_page(const page_id_t page_id, goto allocate_block; } - dberr_t err= buf_read_page_low(page_id, zip_size, chain, space, block, - current_thd, true); + buf_page_t *b= buf_read_page_low(page_id, zip_size, err, chain, space, + block, current_thd); buf_read_release(block); - return err; + return reinterpret_cast(b); } -/** High-level function which reads a page asynchronously from a file to the -buffer buf_pool if it is not already there. Sets the io_fix flag and sets -an exclusive lock on the buffer frame. The flag is cleared and the x-lock -released by the i/o-handler thread. -@param[in,out] space tablespace -@param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 */ -void buf_read_page_background(fil_space_t *space, const page_id_t page_id, - ulint zip_size) noexcept +void buf_read_page_background(const page_id_t page_id, fil_space_t *space, + trx_t *trx) noexcept { + ut_ad(!recv_recovery_is_on()); buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(page_id.fold()); if (buf_pool.page_hash_contains(page_id, chain)) - { skip: space->release(); - return; - } - - buf_block_t *block= nullptr; - if (UNIV_LIKELY(!zip_size)) - { - allocate_block: - if (UNIV_UNLIKELY(!(block= buf_read_acquire()))) - goto skip; - } - else if (recv_recovery_is_on()) - { - zip_size|= 1; - goto allocate_block; - } - - if (buf_read_page_low(page_id, zip_size, chain, space, block) == - DB_SUCCESS) - ut_ad(!block); else - buf_read_release(block); - - /* We do not increment number of I/O operations used for LRU policy - here (buf_LRU_stat_inc_io()). We use this in heuristics to decide - about evicting uncompressed version of ROW_FORMAT=COMPRESSED pages - from the buffer pool. Since this function is called from buffer pool - load these IOs are deliberate and are not part of normal workload we - can ignore these in our heuristics. */ + { + buf_block_t *b= nullptr; + ulint zip_size{space->zip_size()}; + if (UNIV_LIKELY(!zip_size) && UNIV_UNLIKELY(!(b= buf_read_acquire()))) + goto skip; + buf_read_page_low(page_id, zip_size, nullptr, chain, space, b, nullptr); + if (b || trx) + { + mysql_mutex_lock(&buf_pool.mutex); + if (b) + buf_LRU_block_free_non_file_page(b); + if (UNIV_LIKELY(trx != nullptr)) + { + buf_LRU_stat_inc_io(); + buf_pool.stat.n_ra_pages_read++; + } + mysql_mutex_unlock(&buf_pool.mutex); + } + if (!trx); + else if (ha_handler_stats *stats= trx->active_handler_stats) + stats->pages_prefetched++; + /* buf_load() invokes this with trx=nullptr. In that case, we will + not update any statistics; these deliberate page reads are not + part of a normal workload and therefore should not affect the + unzip_LRU heuristics. */ + } } /** Applies linear read-ahead if in the buf_pool the page is a border page of @@ -676,8 +759,9 @@ failed: break; buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(new_low.fold()); space->reacquire(); - if (buf_read_page_low(new_low, zip_size, chain, space, block) == - DB_SUCCESS) + if (reinterpret_cast(-1) == + buf_read_page_low(new_low, zip_size, nullptr, + chain, space, block, nullptr)) { count++; ut_ad(!block); @@ -687,12 +771,8 @@ failed: } } - if (count) - buf_read_ahead_report(*space, count); - space->release(); - buf_read_release(block); - return count; + return buf_read_release_count(block, count); } /** Schedule a page for recovery. @@ -711,29 +791,23 @@ void buf_read_recover(fil_space_t *space, const page_id_t page_id, if (init_lsn) { - if (buf_page_t *bpage= - buf_page_init_for_read(page_id, zip_size, chain, block)) - { - ut_ad(bpage->in_file()); + buf_page_t *bpage= buf_page_init_for_read(page_id, zip_size, chain, block); + if (UNIV_UNLIKELY(!bpage)) + goto fail; + const bool exist(uintptr_t(bpage) & 1); + bpage= reinterpret_cast(uintptr_t(bpage) & ~uintptr_t{1}); + bpage->unfix(); + + if (!exist) os_fake_read(IORequest{bpage, (buf_tmp_buffer_t*) &recs, UT_LIST_GET_FIRST(space->chain), IORequest::READ_ASYNC}, init_lsn); - return; - } - } - else if (dberr_t err= - buf_read_page_low(page_id, zip_size, chain, space, block)) - { - if (err != DB_SUCCESS_LOCKED_REC) - sql_print_error("InnoDB: Recovery failed to read page " - UINT32PF " from %s", - page_id.page_no(), space->chain.start->name); - } - else - { - ut_ad(!block); - return; } + else if (!buf_read_page_low(page_id, zip_size, nullptr, chain, space, block, + nullptr)) + fail: + sql_print_error("InnoDB: Recovery failed to read page %" PRIu32 " from %s", + page_id.page_no(), space->chain.start->name); - buf_LRU_block_free_non_file_page(block); + buf_read_release(block); } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 821e1aab2e6..5ad1c75af22 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2928,25 +2928,31 @@ void IORequest::read_complete(int io_error) const noexcept ut_ad(node); ut_ad(is_read()); ut_ad(bpage); + ut_d(auto s= bpage->state()); + ut_ad(s > buf_page_t::READ_FIX); + ut_ad(s <= buf_page_t::WRITE_FIX); const page_id_t id(bpage->id()); + const bool in_recovery{recv_sys.recovery_on}; if (UNIV_UNLIKELY(io_error != 0)) { sql_print_error("InnoDB: Read error %d of page " UINT32PF " in file %s", io_error, id.page_no(), node->name); recv_sys.free_corrupted_page(id, *node); - buf_pool.corrupted_evict(bpage, buf_page_t::READ_FIX); + buf_pool.corrupted_evict(bpage, buf_page_t::READ_FIX + 1); corrupted: - if (recv_recovery_is_on() && !srv_force_recovery) + if (in_recovery && !srv_force_recovery) { mysql_mutex_lock(&recv_sys.mutex); recv_sys.set_corrupt_fs(); mysql_mutex_unlock(&recv_sys.mutex); } } - else if (bpage->read_complete(*node)) + else if (bpage->read_complete(*node, in_recovery)) goto corrupted; + else + bpage->unfix(); node->space->release(); } diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index a8361410cb2..fd36370d7f4 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -39,6 +39,7 @@ Created 11/5/1995 Heikki Tuuri #include "log0log.h" #include "srv0srv.h" #include "transactional_lock_guard.h" +#include "ha_handler_stats.h" #include /** The allocation granularity of innodb_buffer_pool_size */ @@ -706,10 +707,16 @@ public: /** Complete a read of a page. @param node data file + @param recovery recv_recovery_is_on() @return whether the operation succeeded + @retval DB_SUCCESS if the read succeeded; caller must unfix() @retval DB_PAGE_CORRUPTED if the checksum or the page ID is incorrect @retval DB_DECRYPTION_FAILED if the page cannot be decrypted */ - dberr_t read_complete(const fil_node_t &node) noexcept; + dberr_t read_complete(const fil_node_t &node, bool recovery) noexcept; + + /** Wait for read_complete() by invoking lock.s_lock_nospin(). + @param trx transaction (for updating trx->active_handler_stats) */ + void read_wait(trx_t *trx) noexcept; /** Release a write fix after a page write was completed. @param persistent whether the page belongs to a persistent tablespace @@ -1810,7 +1817,7 @@ inline void buf_page_t::set_state(uint32_t s) noexcept mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(s <= REMOVE_HASH || s >= UNFIXED); ut_ad(s < WRITE_FIX); - ut_ad(s <= READ_FIX || zip.fix == READ_FIX); + ut_ad(s <= READ_FIX + 1 || zip.fix == READ_FIX + 1); zip.fix= s; } diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index b11feed36ce..bc50a7d52a2 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -32,27 +32,26 @@ Created 11/5/1995 Heikki Tuuri will be invoked on read completion. @param page_id page identifier @param chain buf_pool.page_hash cell for page_id +@param err error code: DB_SUCCESS if the page was successfully read, +DB_SUCCESS_LOCKED_REC if the page was not read, +DB_PAGE_CORRUPTED on page checksum mismatch, +DB_DECRYPTION_FAILED if page post encryption checksum matches but +after decryption normal page checksum does not match, +DB_TABLESPACE_DELETED if tablespace .ibd file is missing @param unzip whether to decompress ROW_FORMAT=COMPRESSED pages -@retval DB_SUCCESS if the page was read and is not corrupted -@retval DB_SUCCESS_LOCKED_REC if the page was not read -@retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted, -@retval DB_DECRYPTION_FAILED if page post encryption checksum matches but -after decryption normal page checksum does not match. -@retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ -dberr_t buf_read_page(const page_id_t page_id, - buf_pool_t::hash_chain &chain, bool unzip= true) +@return buffer-fixed block (*err may be set to DB_SUCCESS_LOCKED_REC) +@retval nullptr if the page is not available (*err will be set) */ +buf_block_t *buf_read_page(const page_id_t page_id, dberr_t *err, + buf_pool_t::hash_chain &chain, bool unzip= true) noexcept; -/** High-level function which reads a page asynchronously from a file to the -buffer buf_pool if it is not already there. Sets the io_fix flag and sets -an exclusive lock on the buffer frame. The flag is cleared and the x-lock -released by the i/o-handler thread. -@param[in,out] space tablespace -@param[in] page_id page id -@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 */ -void buf_read_page_background(fil_space_t *space, const page_id_t page_id, - ulint zip_size) noexcept - MY_ATTRIBUTE((nonnull)); +/** Read a page asynchronously into buf_pool if it is not already there. +@param page_id page identifier +@param space tablespace +@param trx transaction */ +void buf_read_page_background(const page_id_t page_id, fil_space_t *space, + trx_t *trx) noexcept + MY_ATTRIBUTE((nonnull(2))); /** Applies a random read-ahead in buf_pool if there are at least a threshold value of accessed pages from the random read-ahead area. Does not read any From 11b6a059058f8ae3973210a8feb903be007ed9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 17 Oct 2025 13:50:56 +0300 Subject: [PATCH 33/69] MDEV-34529 fixup: Improve a test Before attempting to start the actual shrinking, merely check that the system tablespace is large enough, and do not look for an exact size. --- mysql-test/suite/innodb/r/undo_leak_fail.result | 7 ++++--- mysql-test/suite/innodb/t/undo_leak_fail.test | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/innodb/r/undo_leak_fail.result b/mysql-test/suite/innodb/r/undo_leak_fail.result index 83b976f785c..9ad5c29e6d8 100644 --- a/mysql-test/suite/innodb/r/undo_leak_fail.result +++ b/mysql-test/suite/innodb/r/undo_leak_fail.result @@ -44,9 +44,10 @@ innodb_system 77594624 # restart: --debug_dbug=d,unused_undo_free_fail_1 # Fail to free the segment due to previous shutdown FOUND 1 /InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0.*/ in mysqld.1.err -SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0; -NAME FILE_SIZE -innodb_system 15728640 +SELECT NAME, IF(file_size>=14680064,'ok',file_size) +FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0; +NAME IF(file_size>=14680064,'ok',file_size) +innodb_system ok SET GLOBAL innodb_fast_shutdown= 0; # Fail to free the segment while finding the used segments # restart: --debug_dbug=d,unused_undo_free_fail_2 diff --git a/mysql-test/suite/innodb/t/undo_leak_fail.test b/mysql-test/suite/innodb/t/undo_leak_fail.test index 30ca437025d..6c9dd86c498 100644 --- a/mysql-test/suite/innodb/t/undo_leak_fail.test +++ b/mysql-test/suite/innodb/t/undo_leak_fail.test @@ -54,7 +54,8 @@ let $shutdown_timeout=; let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; --source include/search_pattern_in_file.inc -SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0; +SELECT NAME, IF(file_size>=14680064,'ok',file_size) +FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0; SET GLOBAL innodb_fast_shutdown= 0; --echo # Fail to free the segment while finding the used segments From a1bc50e18af64cbcf16f109c5e0053bd4bfd4229 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Wed, 8 Oct 2025 14:11:52 +0300 Subject: [PATCH 34/69] MDEV-37453 Parallel slave worker crashes during Backup at retrying In the BASE of this patch when a slave parallel worker proceeds from the wait-for-prior-commit stage into retrying it may have its backup-lock related sub-state, specifically `THD::backup_commit_lock`, not reset, that is the pointer dangling. That caused segfault at the pointer's dereferencing in the worker retrying. The reason THD::backup_commit_lock is left dangling was unexpected state of THD having non-NULL of `THD::backup_commit_lock` and NULL of `mdl_backup.ticket`. This combination turns out possible when the slave worker is killed for retry *and* few instruction later it does not succeed to (re-)acquire the Backup MDL at exiting from `MYSQL_BIN_LOG::queue_for_group_commit()`. While it did not succeed it also did not expose that fact with timing out from `MDL_context::acquire_lock` and it did not have to, as it before to start waiting it found itself killed. The bug is fixed with amendment of `backup_commit_lock` reset condition at the end of `ha_commit_trans()`. The amended reset remains careful to affect only the stack allocated lock. A test is added to confirm the fixes with reproducing all stages described above. In the patch BASE it causes the segfault. --- .../r/rpl_parallel_backup_worker_retry.result | 49 +++++++++ .../t/rpl_parallel_backup_worker_retry.test | 99 +++++++++++++++++++ sql/handler.cc | 8 +- 3 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_parallel_backup_worker_retry.result create mode 100644 mysql-test/suite/rpl/t/rpl_parallel_backup_worker_retry.test diff --git a/mysql-test/suite/rpl/r/rpl_parallel_backup_worker_retry.result b/mysql-test/suite/rpl/r/rpl_parallel_backup_worker_retry.result new file mode 100644 index 00000000000..a07f8dd68fb --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_parallel_backup_worker_retry.result @@ -0,0 +1,49 @@ +include/master-slave.inc +[connection master] +# +# MDEV-37453 Parallel Replication Crash During Backup +# +connection master; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE = innodb; +INSERT INTO t1 VALUES (1, 0); +INSERT INTO t1 VALUES (2, 0); +connection slave; +include/stop_slave.inc +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +SET @old_parallel_threads = @@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; +SET @@global.slave_parallel_threads= 2; +SET @@global.slave_parallel_mode = 'optimistic'; +connection master; +begin /* trx1 */; +delete from t1 where a = 1; +update t1 set b = 1 where a = 2; +commit; +begin /* trx2 */; +delete from t1 where a = 2; +commit; +connect aux_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BEGIN; +DELETE FROM t1 WHERE a = 1; +connection slave; +include/start_slave.inc +connection aux_slave; +connect backup_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +connection aux_slave; +ROLLBACK; +connection aux_slave; +connection backup_slave; +BACKUP STAGE END; +connection slave; +include/diff_tables.inc [master:t1,slave:t1] +connection slave; +include/stop_slave.inc +SET @@global.slave_parallel_threads= @old_parallel_threads; +SET @@global.slave_parallel_mode = @old_parallel_mode; +include/start_slave.inc +connection server_1; +DROP TABLE t1; +include/rpl_end.inc +# End of the tests diff --git a/mysql-test/suite/rpl/t/rpl_parallel_backup_worker_retry.test b/mysql-test/suite/rpl/t/rpl_parallel_backup_worker_retry.test new file mode 100644 index 00000000000..f3b6f84e833 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_parallel_backup_worker_retry.test @@ -0,0 +1,99 @@ +--source include/have_innodb.inc +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc + +--echo # +--echo # MDEV-37453 Parallel Replication Crash During Backup +--echo # + +# Retrying after parallel conflict transition must be able to do that +# cleanly despite possible "hard" Backup MDL lock in the way. +# The retrying transaction will complete successfully. +# The plot: +# Two transactions are run by two parallel workers. The 2nd (in binlog order) +# transaction depends on the 1st. +# 1. Block the 1st and let the 2nd reach +# Waiting-for-Prior-Transaction-to-Commit (WfPTtC). +# 2. At this point issue BACKUP commands of which BLOCK_COMMIT will +# later force the 2nd transaction to wait for the BACKUP MDL lock. +# 3. Release locks to the 1st transaction which would kick the 2nd out +# of waiting-for-prior-commit only to return negative from the +# BACKUP MDL acquisition attempt (found itself killed). +# 4. Finally, prove of safety: the 2nd transaction retries successfully. + +--connection master +CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE = innodb; +INSERT INTO t1 VALUES (1, 0); +INSERT INTO t1 VALUES (2, 0); +--sync_slave_with_master +--source include/stop_slave.inc +ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; +SET @old_parallel_threads = @@GLOBAL.slave_parallel_threads; +SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; +SET @@global.slave_parallel_threads= 2; +SET @@global.slave_parallel_mode = 'optimistic'; + +--connection master +begin /* trx1 */; + delete from t1 where a = 1; + update t1 set b = 1 where a = 2; +commit; +begin /* trx2 */; + delete from t1 where a = 2; +commit; + +--save_master_pos + +--connect (aux_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,) +BEGIN; +# block the 1st worker and wait for the 2nd ready to commit + DELETE FROM t1 WHERE a = 1; + +--connection slave +--source include/start_slave.inc + +--connection aux_slave +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" +--source include/wait_condition.inc + +# While the 1st worker is locked out run backup +--connect (backup_slave,127.0.0.1,root,,test,$SLAVE_MYPORT,) +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; + +# release the 1st work +--connection aux_slave +let $status_var= Slave_retried_transactions; +let $status_var_value= query_get_value(SHOW STATUS LIKE '$status_var', Value, 1); +--sleep 1 +ROLLBACK; + +# that will kick the 2nd out of the current WfPTtC into next retry one +--connection aux_slave +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for prior transaction to commit" +--source include/wait_condition.inc + +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc + +--connection backup_slave +BACKUP STAGE END; + +--connection slave +--sync_with_master + +--let $diff_tables= master:t1,slave:t1 +--source include/diff_tables.inc + +# Clean up. +--connection slave +--source include/stop_slave.inc +SET @@global.slave_parallel_threads= @old_parallel_threads; +SET @@global.slave_parallel_mode = @old_parallel_mode; +--source include/start_slave.inc + +--connection server_1 +DROP TABLE t1; + +--source include/rpl_end.inc +--echo # End of the tests diff --git a/sql/handler.cc b/sql/handler.cc index 5d7138490fd..45eb3ce5238 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2072,15 +2072,17 @@ err: thd->rgi_slave->is_parallel_exec); } end: - if (mdl_backup.ticket) + // reset the pointer to the ticket when it's stack instantiated + if (thd->backup_commit_lock == &mdl_backup) { /* We do not always immediately release transactional locks after ha_commit_trans() (see uses of ha_enable_transaction()), thus we release the commit blocker lock as soon as it's not needed. - */ - thd->mdl_context.release_lock(mdl_backup.ticket); + */ + if (mdl_backup.ticket) + thd->mdl_context.release_lock(mdl_backup.ticket); thd->backup_commit_lock= 0; } #ifdef WITH_WSREP From 34a8209d66579d71d2a6fb6d154473693152117d Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Fri, 19 Sep 2025 13:17:06 -0400 Subject: [PATCH 35/69] MDEV-35816 ASAN use-after-poison in st_select_lex::print For prepared statements with derived tables defined by CTEs, and during second execution, there is a dangling pointer to an instance of a JOIN object that no longer exists. Normally, the join member of a SELECT_LEX is freed during a call to st_select_lex::cleanup() which recursively traverses the query tree. But due to CTE merging during mysql_derived_merge, the unit containing the SELECT_LEX that would've been freed is cutoff from the query tree. We now remember all such units in a linked list so that they're cleaned up at the end of the lifetime of the query. --- mysql-test/main/merge.result | 40 ++++++++++++++++++++++++++++++++++++ mysql-test/main/merge.test | 18 ++++++++++++++++ sql/sql_lex.cc | 36 ++++++++++++++++++++++++++++++++ sql/sql_lex.h | 22 ++++++++++++++++++++ sql/sql_union.cc | 2 ++ 5 files changed, 118 insertions(+) diff --git a/mysql-test/main/merge.result b/mysql-test/main/merge.result index 6bf413ac720..0e9a2cb9896 100644 --- a/mysql-test/main/merge.result +++ b/mysql-test/main/merge.result @@ -3930,3 +3930,43 @@ drop table tm, t; # # End of 10.8 tests # +# +# MDEV-35816 ASAN use-after-poison in st_select_lex::print +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5); +SET SESSION optimizer_trace = 'enabled=on'; +PREPARE stmt FROM 'SELECT STRAIGHT_JOIN * FROM t1 WHERE a IN (WITH cte AS (SELECT a FROM t1) SELECT * FROM cte)'; +EXECUTE stmt; +a +1 +2 +3 +4 +5 +EXECUTE stmt; +a +1 +2 +3 +4 +5 +PREPARE nested FROM 'SELECT STRAIGHT_JOIN * FROM t1 WHERE a IN (WITH cte AS (WITH cte2 AS (SELECT a FROM t1) SELECT * from cte2) SELECT * FROM cte)'; +EXECUTE nested; +a +1 +2 +3 +4 +5 +EXECUTE nested; +a +1 +2 +3 +4 +5 +DROP TABLE t1; +# +# End of 10.11 tests +# diff --git a/mysql-test/main/merge.test b/mysql-test/main/merge.test index 58197d9b0ad..e66b3ea1dc4 100644 --- a/mysql-test/main/merge.test +++ b/mysql-test/main/merge.test @@ -2887,3 +2887,21 @@ drop table tm, t; --echo # --echo # End of 10.8 tests --echo # + +--echo # +--echo # MDEV-35816 ASAN use-after-poison in st_select_lex::print +--echo # +CREATE TABLE t1 (a INT); +INSERT INTO t1 (a) VALUES (1),(2),(3),(4),(5); +SET SESSION optimizer_trace = 'enabled=on'; +PREPARE stmt FROM 'SELECT STRAIGHT_JOIN * FROM t1 WHERE a IN (WITH cte AS (SELECT a FROM t1) SELECT * FROM cte)'; +EXECUTE stmt; +EXECUTE stmt; +PREPARE nested FROM 'SELECT STRAIGHT_JOIN * FROM t1 WHERE a IN (WITH cte AS (WITH cte2 AS (SELECT a FROM t1) SELECT * from cte2) SELECT * FROM cte)'; +EXECUTE nested; +EXECUTE nested; +DROP TABLE t1; + +--echo # +--echo # End of 10.11 tests +--echo # diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 2edb1e26d43..e4c18c1a055 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2959,6 +2959,41 @@ void st_select_lex_node::init_query_common() uncacheable= 0; } + +/* + We need to remember this unit for cleanup after it is stranded during CTE + merge (see mysql_derived_merge). Walk to the root unit of this query tree + (the root unit lifetime extends for the entire query) and insert myself + into the front of the stranded_clean_list: + before: root -> B -> A + after: root -> this -> B -> A + During cleanup, the stranded units are cleaned in FIFO order. + */ +void st_select_lex_unit::remember_my_cleanup() +{ + // Walk to the root unit (which lives until the end of the query) ... + st_select_lex_node *root= this; + while (root->master) + root= root->master; + + // ... and add myself to the front of the stranded_clean_list. + st_select_lex_unit *unit= static_cast(root); + st_select_lex_unit *prior_head= unit->stranded_clean_list; + unit->stranded_clean_list= this; + stranded_clean_list= prior_head; +} + + +void st_select_lex_unit::cleanup_stranded_units() +{ + if (!stranded_clean_list) + return; + + stranded_clean_list->cleanup(); + stranded_clean_list= nullptr; +} + + void st_select_lex_unit::init_query() { init_query_common(); @@ -3384,6 +3419,7 @@ void st_select_lex_unit::exclude_level() } // Mark it excluded prev= NULL; + remember_my_cleanup(); } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 4997e6f0b20..a6cf6303aa6 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -862,6 +862,28 @@ bool print_explain_for_slow_log(LEX *lex, THD *thd, String *str); class st_select_lex_unit: public st_select_lex_node { +private: + /* + When a CTE is merged to the parent SELECT, its unit is excluded + which separates it from the tree of units for this query. It + needs to be cleaned up but not at the time it is excluded, since + its queries are merged to the unit above it. Remember all such + units via the stranded_clean_list and clean them at the end of + the query. This list is maintained only at the root unit node + of the query tree. + */ + st_select_lex_unit *stranded_clean_list{nullptr}; + + // Add myself to the stranded_clean_list. + void remember_my_cleanup(); + + /* + Walk the stranded_clean_list and cleanup units. This must only + be called for the st_select_lex_unit type because it assumes + that those are the only nodes in the stranded_clean_list. + */ + void cleanup_stranded_units(); + protected: TABLE_LIST result_table_list; select_unit *union_result; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 7b694550596..1a5c729859e 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -2598,6 +2598,8 @@ err: bool st_select_lex_unit::cleanup() { + cleanup_stranded_units(); + bool error= 0; DBUG_ENTER("st_select_lex_unit::cleanup"); From ca7e1a39b389bdb23e1fe37eb253adad97c87995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 21 May 2025 10:09:31 +0300 Subject: [PATCH 36/69] MDEV-36843 : Galera tests fail if wsrep_provider_options is too long (> 2k) Galera provider options contains many options and several directory names and file names that could lead situation where wsrep_provider_options string is longer than 2k. Many tests set few new options required by test and then restore wsrep_provider_options to original value. This restoring wsrep_provider_options string to original value then fails because of common limit for all charptr variables (2k). Fix is to increase common limit for all charptr variables to 4kb. --- .../r/galera_provider_options_long.result | 16 +++++++++++ .../galera/t/galera_provider_options_long.cnf | 11 ++++++++ .../t/galera_provider_options_long.test | 28 +++++++++++++++++++ mysql-test/suite/sys_vars/r/mdev_15935.result | 8 +++--- mysql-test/suite/sys_vars/t/mdev_15935.test | 2 +- sql/sys_vars.inl | 2 +- 6 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_provider_options_long.result create mode 100644 mysql-test/suite/galera/t/galera_provider_options_long.cnf create mode 100644 mysql-test/suite/galera/t/galera_provider_options_long.test diff --git a/mysql-test/suite/galera/r/galera_provider_options_long.result b/mysql-test/suite/galera/r/galera_provider_options_long.result new file mode 100644 index 00000000000..ea85f47e0d7 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_provider_options_long.result @@ -0,0 +1,16 @@ +connection node_2; +connection node_1; +# +# wsrep_provider_options should be already > 2k length +# +AS_EXPECT_1 +1 +# +# Setting single value should pass +# +SET GLOBAL wsrep_provider_options='pc.ignore_sb=false;pc.weight=2'; +# +# This failed before change with ER_WRONG_STRING_LENGTH +# +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/t/galera_provider_options_long.cnf b/mysql-test/suite/galera/t/galera_provider_options_long.cnf new file mode 100644 index 00000000000..ee8c6e590f4 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_provider_options_long.cnf @@ -0,0 +1,11 @@ +!include ../galera_2nodes.cnf + +[mysqld] +loose-galera-ssl-upgrade=1 +wsrep-debug=1 + +[mysqld.1] +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + +[mysqld.2] +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_provider_options_long.test b/mysql-test/suite/galera/t/galera_provider_options_long.test new file mode 100644 index 00000000000..bc9334447fe --- /dev/null +++ b/mysql-test/suite/galera/t/galera_provider_options_long.test @@ -0,0 +1,28 @@ +--source include/galera_cluster.inc +--source include/have_ssl_communication.inc +--source include/have_openssl.inc + +--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` + +--echo # +--echo # wsrep_provider_options should be already > 2k length +--echo # +--disable_query_log +--eval SELECT LENGTH('$wsrep_provider_options_orig') > 2000 AS_EXPECT_1; +--enable_query_log + +--echo # +--echo # Setting single value should pass +--echo # + +SET GLOBAL wsrep_provider_options='pc.ignore_sb=false;pc.weight=2'; + +--echo # +--echo # This failed before change with ER_WRONG_STRING_LENGTH +--echo # + +--disable_query_log +--eval SET GLOBAL wsrep_provider_options = "$wsrep_provider_options_orig" +--enable_query_log + +--source include/galera_end.inc diff --git a/mysql-test/suite/sys_vars/r/mdev_15935.result b/mysql-test/suite/sys_vars/r/mdev_15935.result index 551cd539db7..7feca48ab10 100644 --- a/mysql-test/suite/sys_vars/r/mdev_15935.result +++ b/mysql-test/suite/sys_vars/r/mdev_15935.result @@ -1,10 +1,10 @@ # # test cleanup of sys_var classes # -set global init_connect="................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................."; -ERROR HY000: String '......................................................................' is too long for init_connect (should be no longer than 2000) -set global ft_boolean_syntax="................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................."; -ERROR HY000: String '......................................................................' is too long for ft_boolean_syntax (should be no longer than 2000) +set global init_connect="................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................."; +ERROR HY000: String '......................................................................' is too long for init_connect (should be no longer than 4096) +set global ft_boolean_syntax="................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................."; +ERROR HY000: String '......................................................................' is too long for ft_boolean_syntax (should be no longer than 4096) # # end of test mdev_15935 # diff --git a/mysql-test/suite/sys_vars/t/mdev_15935.test b/mysql-test/suite/sys_vars/t/mdev_15935.test index 856a97e879c..ec5818fc0e2 100644 --- a/mysql-test/suite/sys_vars/t/mdev_15935.test +++ b/mysql-test/suite/sys_vars/t/mdev_15935.test @@ -2,7 +2,7 @@ --echo # test cleanup of sys_var classes --echo # ---let $long_string=`select repeat('.', 2001)` +--let $long_string=`select repeat('.', 4097)` --error ER_WRONG_STRING_LENGTH eval set global init_connect="$long_string"; --error ER_WRONG_STRING_LENGTH diff --git a/sql/sys_vars.inl b/sql/sys_vars.inl index fa5b3bd1bc7..413e06b2f28 100644 --- a/sql/sys_vars.inl +++ b/sql/sys_vars.inl @@ -506,7 +506,7 @@ public: */ class Sys_var_charptr: public sys_var { - const size_t max_length= 2000; + const size_t max_length= 4096; public: Sys_var_charptr(const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, size_t size, From 4918fc5780fe961c16ad590afab79150712f578e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 17 Oct 2025 10:53:40 +0300 Subject: [PATCH 37/69] MDEV-30764 : Assertion `transaction.is_streaming()' failed in void wsrep::transaction::adopt(const wsrep::transaction&) This is very special case because test first sets read_only=ON disabling some of the writes. Based on documentation replication (slave) threads are not affected by this option. However, threads executing streaming replication recovery were effected by read_only setting. Fix is to set thd->security_ctx->skip_grants() for streaming replication threads so that they are not affected by read_only setting. --- mysql-test/suite/galera/r/MDEV-30764.result | 66 +++++++++++++ mysql-test/suite/galera/t/MDEV-30764.test | 100 ++++++++++++++++++++ sql/wsrep_server_service.cc | 1 + 3 files changed, 167 insertions(+) create mode 100644 mysql-test/suite/galera/r/MDEV-30764.result create mode 100644 mysql-test/suite/galera/t/MDEV-30764.test diff --git a/mysql-test/suite/galera/r/MDEV-30764.result b/mysql-test/suite/galera/r/MDEV-30764.result new file mode 100644 index 00000000000..80ba0d7f776 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-30764.result @@ -0,0 +1,66 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_1; +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2'; +connection node_2; +SET GLOBAL read_only=1; +SET SESSION wsrep_trx_fragment_size = 64; +set default_storage_engine=SEQUENCE; +SET AUTOCOMMIT = OFF; +CREATE TABLE t1(c1 NUMERIC NOT NULL); +ERROR HY000: Can't create table `test`.`t1` (errno: 131 "Command not supported by the engine") +CREATE TABLE t1 (id INT PRIMARY KEY) engine=innodb; +SET SESSION SQL_MODE='HIGH_NOT_PRECEDENCE'; +INSERT INTO t1 VALUES (1),(2),(3); +SET GLOBAL SQL_MODE='NO_ENGINE_SUBSTITUTION'; +DROP TABLE dummy; +ERROR 42S02: Unknown table 'test.dummy' +INSERT INTO t1 VALUES('a'); +Warnings: +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`id` at row 1 +# In this point there should be one fragment +select count(*) AS EXPECT_1 from mysql.wsrep_streaming_log; +EXPECT_1 +1 +SET @@global.wsrep_cluster_address='gcomm://'; +SET SESSION SQL_MODE='TRADITIONAL '; +# Killing cluster because we have messed with wsrep_cluster_address +connection node_2; +SET SESSION wsrep_sync_wait = 0; +Killing server ... +connection node_1; +SET SESSION wsrep_sync_wait = 0; +Killing server ... +connection node_2; +call mtr.add_suppression("WSREP: BF applier thread"); +call mtr.add_suppression("WSREP: Event"); +call mtr.add_suppression("WSREP: SR trx recovery applying returned 1290"); +call mtr.add_suppression("WSREP: Adopting a transaction"); +call mtr.add_suppression("WSREP: Could not find applier context for"); +call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster"); +call mtr.add_suppression("WSREP: Failed to vote on request for"); +select count(*) AS EXPECT_0 from mysql.wsrep_streaming_log; +EXPECT_0 +0 +SELECT * FROM t1; +c1 +connection node_1; +select count(*) AS EXPECT_0 from mysql.wsrep_streaming_log; +EXPECT_0 +0 +SELECT * FROM t1; +c1 +DROP TABLE t1; +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false;pc.weight=1'; +connection node_2; +connection node_1; +call mtr.add_suppression("WSREP: Event"); +call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on"); +call mtr.add_suppression("WSREP: Failed to apply write set: gtid"); +call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster"); +call mtr.add_suppression("WSREP: Could not find applier context for"); +call mtr.add_suppression("WSREP: Failed to vote on request for"); +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/t/MDEV-30764.test b/mysql-test/suite/galera/t/MDEV-30764.test new file mode 100644 index 00000000000..67152ebea12 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-30764.test @@ -0,0 +1,100 @@ +--source include/galera_cluster.inc +--source include/have_sequence.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_1 +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2'; + +--connection node_2 +--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address` +SET GLOBAL read_only=1; +SET SESSION wsrep_trx_fragment_size = 64; +set default_storage_engine=SEQUENCE; +SET AUTOCOMMIT = OFF; +--error 1005 +CREATE TABLE t1(c1 NUMERIC NOT NULL); +CREATE TABLE t1 (id INT PRIMARY KEY) engine=innodb; +SET SESSION SQL_MODE='HIGH_NOT_PRECEDENCE'; +INSERT INTO t1 VALUES (1),(2),(3); +SET GLOBAL SQL_MODE='NO_ENGINE_SUBSTITUTION'; +--error 1051 +DROP TABLE dummy; +INSERT INTO t1 VALUES('a'); +--echo # In this point there should be one fragment +select count(*) AS EXPECT_1 from mysql.wsrep_streaming_log; +SET @@global.wsrep_cluster_address='gcomm://'; +SET SESSION SQL_MODE='TRADITIONAL '; + +# +# Kill the entire cluster and restart +# +--echo # Killing cluster because we have messed with wsrep_cluster_address +--connection node_2 +SET SESSION wsrep_sync_wait = 0; +--source include/kill_galera.inc + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +--source include/kill_galera.inc + +--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat +--let $start_mysqld_params =--wsrep-new-cluster +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--source include/start_mysqld.inc +--source include/wait_until_ready.inc + +--connection node_2 +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--let $start_mysqld_params = +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +--source include/start_mysqld.inc +--source include/wait_until_ready.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +call mtr.add_suppression("WSREP: BF applier thread"); +call mtr.add_suppression("WSREP: Event"); +call mtr.add_suppression("WSREP: SR trx recovery applying returned 1290"); +call mtr.add_suppression("WSREP: Adopting a transaction"); +call mtr.add_suppression("WSREP: Could not find applier context for"); +call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster"); +call mtr.add_suppression("WSREP: Failed to vote on request for"); + +select count(*) AS EXPECT_0 from mysql.wsrep_streaming_log; + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' +--source include/wait_condition.inc + +SELECT * FROM t1; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' +--source include/wait_condition.inc +select count(*) AS EXPECT_0 from mysql.wsrep_streaming_log; +SELECT * FROM t1; +DROP TABLE t1; +SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false;pc.weight=1'; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' +--source include/wait_condition.inc + +--connection node_1 +call mtr.add_suppression("WSREP: Event"); +call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on"); +call mtr.add_suppression("WSREP: Failed to apply write set: gtid"); +call mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster"); +call mtr.add_suppression("WSREP: Could not find applier context for"); +call mtr.add_suppression("WSREP: Failed to vote on request for"); + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index e0fffa84457..ca25a41d132 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -39,6 +39,7 @@ static void init_service_thd(THD* thd, void* thread_stack) thd->thread_stack= thread_stack; thd->real_id= pthread_self(); thd->prior_thr_create_utime= thd->start_utime= microsecond_interval_timer(); + thd->security_ctx->skip_grants(); thd->mark_connection_idle(); thd->reset_for_next_command(true); server_threads.insert(thd); // as wsrep_innobase_kill_one_trx() uses find_thread_by_id() From d4606420f8254ca7d36da16256a0ab5c42e333cf Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Fri, 17 Oct 2025 12:49:47 -0400 Subject: [PATCH 38/69] MDEV-37653: IS TRUE incorrectly converts outer join to inner Include original submission test case --- mysql-test/main/join_outer.result | 3 +++ mysql-test/main/join_outer.test | 1 + mysql-test/main/join_outer_jcl6.result | 3 +++ 3 files changed, 7 insertions(+) diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result index 452adebe7d3..ec487ad823b 100644 --- a/mysql-test/main/join_outer.result +++ b/mysql-test/main/join_outer.result @@ -2924,6 +2924,9 @@ c0 c0 select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is false); c0 c0 1 NULL +select t1.c0, t0.c0 from t1 left join t0 on false where (false or ((t0.c0 is true) in (false))); +c0 c0 +1 NULL drop table t0, t1; # end of 10.11 tests SET optimizer_switch=@org_optimizer_switch; diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test index ad66c882e6d..e202e1b193e 100644 --- a/mysql-test/main/join_outer.test +++ b/mysql-test/main/join_outer.test @@ -2443,6 +2443,7 @@ insert into t1 values (1); insert into t0 values (1); select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is true); select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is false); +select t1.c0, t0.c0 from t1 left join t0 on false where (false or ((t0.c0 is true) in (false))); drop table t0, t1; --echo # end of 10.11 tests diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result index b30fcfb85ae..b4a0f23dc1b 100644 --- a/mysql-test/main/join_outer_jcl6.result +++ b/mysql-test/main/join_outer_jcl6.result @@ -2931,6 +2931,9 @@ c0 c0 select t1.c0, t0.c0 from t1 left join t0 on 0 where not (t0.c0 is false); c0 c0 1 NULL +select t1.c0, t0.c0 from t1 left join t0 on false where (false or ((t0.c0 is true) in (false))); +c0 c0 +1 NULL drop table t0, t1; # end of 10.11 tests SET optimizer_switch=@org_optimizer_switch; From a6dd4cbeff3cb82cc36b3b0b0d973b940a4675c7 Mon Sep 17 00:00:00 2001 From: Brandon Nesterenko Date: Fri, 17 Oct 2025 13:44:17 -0600 Subject: [PATCH 39/69] MDEV-37885: Server crash or ASAN errors in rpl_binlog_state::drop_domain The server crashes with a segfault when trying to drop duplicate domain ids in the same command, e.g. FLUSH BINARY LOGS DELETE_DOMAIN_ID=(0), BINARY LOGS DELETE_DOMAIN_ID=(0) This is because a pointer is referenced at the wrong level. When dropping domain ids, first the code builds a list of unique domain ids to drop, and the actual deletion uses the domain ids from this unique list. However, the logic which checks for uniqueness references elements in the existing list of unique domain ids at the wrong level. That is, the type of the unique domain id list is a pointer to rpl_binlog_state::element (i.e. (rpl_binlog_state::element*)). The code uses dynamic_array_ptr to reference its elements, which is a pointer to one of these elements, i.e. (rpl_binlog_state::element**), but the code treated it as a single-level pointer. This code fixes the return from dynamic_array_ptr to be a double-pointer. --- .../r/binlog_flush_binlogs_delete_domain.result | 8 ++++++++ .../t/binlog_flush_binlogs_delete_domain.test | 16 ++++++++++++++++ sql/rpl_gtid.cc | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result index fdcfb4bfa01..d0f42f5d9ab 100644 --- a/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result +++ b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result @@ -86,5 +86,13 @@ ERROR HY000: The value of gtid domain being deleted ('4294967296') exceeds its m FLUSH BINARY LOGS DELETE_DOMAIN_ID = (4294967295); Warnings: Warning 1076 The gtid domain being deleted ('4294967295') is not in the current binlog state +RESET MASTER; +SET @@GLOBAL.gtid_domain_id=0; +SET @@SESSION.gtid_domain_id=0; +CREATE USER u; +FLUSH BINARY LOGS; +PURGE BINARY LOGS TO 'master-bin.000002'; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (0), BINARY LOGS DELETE_DOMAIN_ID = (0); +DROP USER u; DROP TABLE t; RESET MASTER; diff --git a/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test index 8311f4bd800..f35489eb888 100644 --- a/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test +++ b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test @@ -148,6 +148,22 @@ RESET MASTER; --error 0 --eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($d_max) +# +# MDEV-37885 +# Server crash or ASAN errors in rpl_binlog_state::drop_domain +# +RESET MASTER; +SET @@GLOBAL.gtid_domain_id=0; +SET @@SESSION.gtid_domain_id=0; +CREATE USER u; +FLUSH BINARY LOGS; +--let $purge_to_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +--eval PURGE BINARY LOGS TO '$purge_to_binlog' +--error 0 +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (0), BINARY LOGS DELETE_DOMAIN_ID = (0); +DROP USER u; + + # # Cleanup # diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc index 1f234215d20..1b3ae36d54d 100644 --- a/sql/rpl_gtid.cc +++ b/sql/rpl_gtid.cc @@ -2214,7 +2214,7 @@ rpl_binlog_state::drop_domain(DYNAMIC_ARRAY *ids, // compose a sequence of unique pointers to domain object for (k= 0; k < domain_unique.elements; k++) { - if ((rpl_binlog_state::element*) dynamic_array_ptr(&domain_unique, k) + if (*(rpl_binlog_state::element**) dynamic_array_ptr(&domain_unique, k) == elem) break; // domain_id's elem has been already in } From 8be6d2540baa3ae8affab9604aa75aaccf4c2182 Mon Sep 17 00:00:00 2001 From: bsrikanth-mariadb Date: Tue, 7 Oct 2025 09:49:57 +0530 Subject: [PATCH 40/69] MDEV-35206: Assertion failure in JOIN::dbug_verify_sj_inner_tables A nested select query is crashing in when optimizer_join_limit_pref_ratio=10 and optimizer_search_depth=1 due to an assertion failure in JOIN::dbug_verify_sj_inner_tables(). In sql_select.cc#choose_plan(), there are 2 back-2-back calls to greedy_search(). The first one is invoked to build a join plan that can short-cut ORDER BY...LIMIT, while the second invocation to not consider short-cut. The greedy_search() should start with a value of join->cur_sj_inner_tables set to 0. However, the first greedy_search() call left the value of join->cur_sj_inner_tables to "6". This caused the assert to fail in dbug_verify_sj_inner_tables() as soon as the second greedy_search() started, where in it was expecting a value of 0. Similar problem is noticed with cur_embedding_map in the case of nested joins, and nested_join counter. introduced init_join_plan_search_state() which is called from start of greedy_search() and optimize_straight join that does all the needed initialization by : 1. setting 0's to cur_sj_inner_tables, and cur_embedding_map 2. invoking reset_nj_counters(). --- mysql-test/main/join_nested.result | 63 +++++++++++++++++++++++ mysql-test/main/join_nested.test | 66 +++++++++++++++++++++++++ mysql-test/main/join_nested_jcl6.result | 63 +++++++++++++++++++++++ sql/sql_select.cc | 19 ++++--- 4 files changed, 204 insertions(+), 7 deletions(-) diff --git a/mysql-test/main/join_nested.result b/mysql-test/main/join_nested.result index 564685188bf..1d832a4b0b1 100644 --- a/mysql-test/main/join_nested.result +++ b/mysql-test/main/join_nested.result @@ -2062,4 +2062,67 @@ LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); 1 1 DROP TABLE t1; +# +# MDEV-35206: Assertion in JOIN::dbug_verify_sj_inner_tables +# +SET @save_optimizer_join_limit_pref_ratio= @@optimizer_join_limit_pref_ratio; +SET @save_optimizer_search_depth= @@optimizer_search_depth; +CREATE TABLE t1 (c1 VARCHAR(64) DEFAULT NULL, c2 VARCHAR(8) DEFAULT NULL); +INSERT INTO t1 (c1) values ('one'); +INSERT INTO t1 (c2) values ('2'); +SET optimizer_join_limit_pref_ratio=10; +SET optimizer_search_depth=1; +SELECT +c1 +FROM +t1 +WHERE +c2 IN (SELECT c2 +FROM t1 +WHERE c1 IN (SELECT c1 +FROM t1 +WHERE c1 IN (NULL) +) +) +ORDER BY c1 LIMIT 1; +c1 +DROP TABLE t1; +# +# similar issue with join::cur_embedding_map +# +CREATE TABLE t10 (a int, b int, index(b)); +INSERT INTO t10 SELECT seq, seq FROM seq_1_to_10; +CREATE TABLE t11(a int, b int); +CREATE TABLE t12(a int, b int, index(b)); +INSERT INTO t11 select seq, seq FROM seq_1_to_20; +INSERT INTO t12 select seq, seq FROM seq_1_to_40; +CREATE TABLE t13(a int, b int); +CREATE TABLE t14(a int, b int, index(b)); +INSERT INTO t13 select seq, seq FROM seq_1_to_20; +INSERT INTO t14 select seq, seq FROM seq_1_to_40; +ANALYZE TABLE t10, t11, t12; +Table Op Msg_type Msg_text +test.t10 analyze status Engine-independent statistics collected +test.t10 analyze status Table is already up to date +test.t11 analyze status Engine-independent statistics collected +test.t11 analyze status OK +test.t12 analyze status Engine-independent statistics collected +test.t12 analyze status Table is already up to date +EXPLAIN SELECT * +FROM +t10 LEFT JOIN +( +t11 JOIN t12 ON t11.b=t12.b +left join (t13 join t14 on t13.b=t14.b) on t13.a=t11.a +) ON t10.a=t11.a +ORDER BY t10.b LIMIT 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 SIMPLE t11 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t12 ref b b 5 test.t11.b 1 +1 SIMPLE t13 ALL NULL NULL NULL NULL 20 Using where +1 SIMPLE t14 ref b b 5 test.t13.b 1 +DROP TABLE t10, t11, t12, t13, t14; +SET optimizer_join_limit_pref_ratio= @save_optimizer_join_limit_pref_ratio; +SET optimizer_search_depth= @save_optimizer_search_depth; # end of 10.11 tests diff --git a/mysql-test/main/join_nested.test b/mysql-test/main/join_nested.test index 62370b95262..b0c57e762ef 100644 --- a/mysql-test/main/join_nested.test +++ b/mysql-test/main/join_nested.test @@ -2,6 +2,7 @@ --disable_warnings DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5,t6,t7,t8,t9; --enable_warnings +--source include/have_sequence.inc SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch=ifnull(@optimizer_switch_for_join_nested_test,'outer_join_with_cache=off'); @@ -1470,4 +1471,69 @@ SELECT 1 FROM t1 WHERE i IN LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); DROP TABLE t1; + +--echo # +--echo # MDEV-35206: Assertion in JOIN::dbug_verify_sj_inner_tables +--echo # + +SET @save_optimizer_join_limit_pref_ratio= @@optimizer_join_limit_pref_ratio; +SET @save_optimizer_search_depth= @@optimizer_search_depth; + +CREATE TABLE t1 (c1 VARCHAR(64) DEFAULT NULL, c2 VARCHAR(8) DEFAULT NULL); +INSERT INTO t1 (c1) values ('one'); +INSERT INTO t1 (c2) values ('2'); + +SET optimizer_join_limit_pref_ratio=10; +SET optimizer_search_depth=1; + +SELECT + c1 +FROM + t1 +WHERE + c2 IN (SELECT c2 + FROM t1 + WHERE c1 IN (SELECT c1 + FROM t1 + WHERE c1 IN (NULL) + ) + ) +ORDER BY c1 LIMIT 1; + +DROP TABLE t1; + +--echo # +--echo # similar issue with join::cur_embedding_map +--echo # +CREATE TABLE t10 (a int, b int, index(b)); +INSERT INTO t10 SELECT seq, seq FROM seq_1_to_10; + +CREATE TABLE t11(a int, b int); +CREATE TABLE t12(a int, b int, index(b)); + +INSERT INTO t11 select seq, seq FROM seq_1_to_20; +INSERT INTO t12 select seq, seq FROM seq_1_to_40; + +CREATE TABLE t13(a int, b int); +CREATE TABLE t14(a int, b int, index(b)); + +INSERT INTO t13 select seq, seq FROM seq_1_to_20; +INSERT INTO t14 select seq, seq FROM seq_1_to_40; + +ANALYZE TABLE t10, t11, t12; + +EXPLAIN SELECT * +FROM + t10 LEFT JOIN + ( + t11 JOIN t12 ON t11.b=t12.b + left join (t13 join t14 on t13.b=t14.b) on t13.a=t11.a + ) ON t10.a=t11.a +ORDER BY t10.b LIMIT 1; + +DROP TABLE t10, t11, t12, t13, t14; + +SET optimizer_join_limit_pref_ratio= @save_optimizer_join_limit_pref_ratio; +SET optimizer_search_depth= @save_optimizer_search_depth; + --echo # end of 10.11 tests diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result index 50a1e83a5ab..0a6993e90a5 100644 --- a/mysql-test/main/join_nested_jcl6.result +++ b/mysql-test/main/join_nested_jcl6.result @@ -2071,6 +2071,69 @@ LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); 1 1 DROP TABLE t1; +# +# MDEV-35206: Assertion in JOIN::dbug_verify_sj_inner_tables +# +SET @save_optimizer_join_limit_pref_ratio= @@optimizer_join_limit_pref_ratio; +SET @save_optimizer_search_depth= @@optimizer_search_depth; +CREATE TABLE t1 (c1 VARCHAR(64) DEFAULT NULL, c2 VARCHAR(8) DEFAULT NULL); +INSERT INTO t1 (c1) values ('one'); +INSERT INTO t1 (c2) values ('2'); +SET optimizer_join_limit_pref_ratio=10; +SET optimizer_search_depth=1; +SELECT +c1 +FROM +t1 +WHERE +c2 IN (SELECT c2 +FROM t1 +WHERE c1 IN (SELECT c1 +FROM t1 +WHERE c1 IN (NULL) +) +) +ORDER BY c1 LIMIT 1; +c1 +DROP TABLE t1; +# +# similar issue with join::cur_embedding_map +# +CREATE TABLE t10 (a int, b int, index(b)); +INSERT INTO t10 SELECT seq, seq FROM seq_1_to_10; +CREATE TABLE t11(a int, b int); +CREATE TABLE t12(a int, b int, index(b)); +INSERT INTO t11 select seq, seq FROM seq_1_to_20; +INSERT INTO t12 select seq, seq FROM seq_1_to_40; +CREATE TABLE t13(a int, b int); +CREATE TABLE t14(a int, b int, index(b)); +INSERT INTO t13 select seq, seq FROM seq_1_to_20; +INSERT INTO t14 select seq, seq FROM seq_1_to_40; +ANALYZE TABLE t10, t11, t12; +Table Op Msg_type Msg_text +test.t10 analyze status Engine-independent statistics collected +test.t10 analyze status Table is already up to date +test.t11 analyze status Engine-independent statistics collected +test.t11 analyze status OK +test.t12 analyze status Engine-independent statistics collected +test.t12 analyze status Table is already up to date +EXPLAIN SELECT * +FROM +t10 LEFT JOIN +( +t11 JOIN t12 ON t11.b=t12.b +left join (t13 join t14 on t13.b=t14.b) on t13.a=t11.a +) ON t10.a=t11.a +ORDER BY t10.b LIMIT 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t10 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +1 SIMPLE t11 hash_ALL NULL #hash#$hj 5 test.t10.a 20 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE t12 ref b b 5 test.t11.b 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t13 hash_ALL NULL #hash#$hj 5 test.t10.a 20 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE t14 ref b b 5 test.t13.b 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +DROP TABLE t10, t11, t12, t13, t14; +SET optimizer_join_limit_pref_ratio= @save_optimizer_join_limit_pref_ratio; +SET optimizer_search_depth= @save_optimizer_search_depth; # end of 10.11 tests CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7c8426885fa..952124be5a2 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -342,6 +342,7 @@ static void compute_part_of_sort_key_for_equals(JOIN *join, TABLE *table, Item_field *item_field, key_map *col_keys); +static void init_join_plan_search_state(JOIN *join); #ifndef DBUG_OFF @@ -9396,11 +9397,9 @@ choose_plan(JOIN *join, table_map join_tables) DBUG_ENTER("choose_plan"); join->limit_optimization_mode= false; - join->cur_embedding_map= 0; join->extra_heuristic_pruning= false; join->prune_level= join->thd->variables.optimizer_prune_level; - reset_nj_counters(join, join->join_list); qsort_cmp2 jtab_sort_func; if (join->emb_sjm_nest) @@ -9440,11 +9439,6 @@ choose_plan(JOIN *join, table_map join_tables) { choose_initial_table_order(join); } - /* - Note: constant tables are already in the join prefix. We don't - put them into the cur_sj_inner_tables, though. - */ - join->cur_sj_inner_tables= 0; if (straight_join) { @@ -9781,6 +9775,8 @@ optimize_straight_join(JOIN *join, table_map remaining_tables) POSITION loose_scan_pos; THD *thd= join->thd; + init_join_plan_search_state(join); + for (JOIN_TAB **pos= join->best_ref + idx ; (s= *pos) ; pos++) { POSITION *position= join->positions + idx; @@ -9926,6 +9922,8 @@ greedy_search(JOIN *join, uint n_tables __attribute__((unused)); DBUG_ENTER("greedy_search"); + init_join_plan_search_state(join); + /* number of tables that remain to be optimized */ usable_tables= (join->emb_sjm_nest ? (join->emb_sjm_nest->sj_inner_tables & @@ -18993,6 +18991,7 @@ static bool check_interleaving_with_nj(JOIN_TAB *next_tab) if (!next_emb->sj_on_expr) { next_emb->nested_join->counter++; + DBUG_ASSERT(next_emb->nested_join->counter <= next_emb->nested_join->n_tables); if (next_emb->nested_join->counter == 1) { /* @@ -33073,6 +33072,12 @@ bool JOIN::transform_all_conds_and_on_exprs_in_join_list( return false; } +static void init_join_plan_search_state(JOIN *join) +{ + join->cur_sj_inner_tables= 0; + join->cur_embedding_map= 0; + reset_nj_counters(join, join->join_list); +} /** @} (end of group Query_Optimizer) From 5ed869b0d6d4c18692fb7959894a08446dadbbd9 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 20 Oct 2025 11:48:59 +0200 Subject: [PATCH 41/69] new CC 3.3 --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index 77bdf5a5725..9e2b0370de0 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 77bdf5a5725ec13c9067723ee2d3e1c5787e8c71 +Subproject commit 9e2b0370de0076461ebae71a06acfb7a9364395b From c1e7a2ee6bdec2ac35d15de2817ed6c04686c2b7 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 20 Oct 2025 12:22:37 +0200 Subject: [PATCH 42/69] New CC 3.4 --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index b790c6c149c..46880b00365 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit b790c6c149c9119fb73c416e993af1c7ef256b34 +Subproject commit 46880b003653a000e9588bd73c8b1dd65088c686 From a4052183df06858f2a58f5691c07e74755e71684 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 17 Oct 2025 23:33:02 +0400 Subject: [PATCH 43/69] MDEV-37890 - sys_vars.thread_cache_size_func fails sporadically Removed redundant FLUSH STATUS, doesn't serve any purpose in this test. Shrinking thread_cache_size is done without appropriate mutex protection and it doesn't flush thread cache. It means we may have more threads in the cache than thread_cache_size allows. First FLUSH THREADS (line 36) was added just in case thread_cache_size_func-master.opt file is removed and raising thread_cache_size from 0 to 3 becomes shrinking from the default value to 3. Second FLUSH THREADS (line 81) was added to fix timeout in wait condition (line 100). It serves as a barrier that guarantees fourth preceding disconnect won't pick one of subsequent connects and in turn leave 2 threads in the cache. Threads_cached cannot be queried for exact value because there can (or cannot) be disconnecting threads from previous tests or mtr utility connection. There is also a gap between server_threads.erase() (aka removal from I_S.PROCESSLIST) and thread_cache.park() (aka Threads_cached++). All in all it makes Threads_cached value unpredictable after thread_cache_size is set to 3. Instead of querying for exact value, just make sure Threads_cached doesn't exceed thread_cache_size. --- .../sys_vars/r/thread_cache_size_func.result | 17 ++++++++--------- .../sys_vars/t/thread_cache_size_func.test | 10 ++++------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/thread_cache_size_func.result b/mysql-test/suite/sys_vars/r/thread_cache_size_func.result index 9cdacffaff1..c4b71197e43 100644 --- a/mysql-test/suite/sys_vars/r/thread_cache_size_func.result +++ b/mysql-test/suite/sys_vars/r/thread_cache_size_func.result @@ -1,25 +1,24 @@ SET @global_thread_cache_size = @@GLOBAL.thread_cache_size; -FLUSH STATUS; '# Test1#' SET @@GLOBAL.thread_cache_size=3; -SHOW STATUS LIKE 'Threads_cached'; -Variable_name Value -Threads_cached 0 -0 Expected +FLUSH THREADS; +select variable_value<=@@global.thread_cache_size from information_schema.global_status where variable_name="Threads_cached"; +variable_value<=@@global.thread_cache_size +1 CONNECT conn1,localhost,root,,; CONNECT conn2,localhost,root,,; CONNECT conn3,localhost,root,,; CONNECT conn4,localhost,root,,; connection default; -SHOW STATUS LIKE 'Threads_cached'; -Variable_name Value -Threads_cached 0 -0 Expected +select variable_value<=@@global.thread_cache_size from information_schema.global_status where variable_name="Threads_cached"; +variable_value<=@@global.thread_cache_size +1 disconnect conn1; disconnect conn2; disconnect conn3; disconnect conn4; SET @@GLOBAL.thread_cache_size= 1; +FLUSH THREADS; CONNECT conn1,localhost,root,,; CONNECT conn2,localhost,root,,; connection default; diff --git a/mysql-test/suite/sys_vars/t/thread_cache_size_func.test b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test index 9f4a45ec48c..d66d6cb2814 100644 --- a/mysql-test/suite/sys_vars/t/thread_cache_size_func.test +++ b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test @@ -31,12 +31,10 @@ --source include/one_thread_per_connection.inc SET @global_thread_cache_size = @@GLOBAL.thread_cache_size; -FLUSH STATUS; - -- ECHO '# Test1#' SET @@GLOBAL.thread_cache_size=3; -SHOW STATUS LIKE 'Threads_cached'; ---echo 0 Expected +FLUSH THREADS; +select variable_value<=@@global.thread_cache_size from information_schema.global_status where variable_name="Threads_cached"; ################################## # Make 4 connections # @@ -53,8 +51,7 @@ CONNECTION default; let $wait_condition= SELECT COUNT(*)= 5 FROM INFORMATION_SCHEMA.PROCESSLIST; --source include/wait_condition.inc -SHOW STATUS LIKE 'Threads_cached'; ---echo 0 Expected +select variable_value<=@@global.thread_cache_size from information_schema.global_status where variable_name="Threads_cached"; #################################### #Disconnecting all the connections # @@ -81,6 +78,7 @@ let $wait_condition= SELECT variable_value = 3 FROM INFORMATION_SCHEMA.global_st # Decreasing cache size to 1 # SET @@GLOBAL.thread_cache_size= 1; +FLUSH THREADS; CONNECT (conn1,localhost,root,,); CONNECT (conn2,localhost,root,,); From 4654b4f08c81fdf6e58521f8a9c3d14b3049e43a Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Sun, 19 Oct 2025 14:57:03 +0400 Subject: [PATCH 44/69] MDEV-37893 - main.public_privileges fails sporadically Test output was affected by incompletely closed preceding connections. Make test agnostic to concurrent connections by querying information_schema.processlist only for connections that it uses. --- mysql-test/main/public_privileges.result | 6 +++--- mysql-test/main/public_privileges.test | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mysql-test/main/public_privileges.result b/mysql-test/main/public_privileges.result index 18a45a1231f..57d57c3f29c 100644 --- a/mysql-test/main/public_privileges.result +++ b/mysql-test/main/public_privileges.result @@ -84,7 +84,7 @@ create database testdb; use testdb; create procedure p1 () select 1; connect testuser,localhost,testuser,,; -select user,db from information_schema.processlist where user='root'; +select user,db from information_schema.processlist where id=$default_id; user db call testdb.p1(); ERROR 42000: execute command denied to user 'testuser'@'%' for routine 'testdb.p1' @@ -93,7 +93,7 @@ GRANT PROCESS ON *.* to PUBLIC; GRANT EXECUTE ON testdb.* to PUBLIC; disconnect testuser; connect testuser,localhost,testuser,,; -select user,db from information_schema.processlist where user='root'; +select user,db from information_schema.processlist where id=$default_id; user db root testdb call testdb.p1(); @@ -104,7 +104,7 @@ disconnect testuser; # check that the privileges are correctly read by acl_load flush privileges; connect testuser,localhost,testuser,,; -select user,db from information_schema.processlist where user='root'; +select user,db from information_schema.processlist where id=$default_id; user db root testdb call testdb.p1(); diff --git a/mysql-test/main/public_privileges.test b/mysql-test/main/public_privileges.test index 9465cc9bfad..17e7228ec6a 100644 --- a/mysql-test/main/public_privileges.test +++ b/mysql-test/main/public_privileges.test @@ -78,10 +78,11 @@ create user testuser; create database testdb; use testdb; create procedure p1 () select 1; +let $default_id= `select connection_id()`; connect (testuser,localhost,testuser,,); -select user,db from information_schema.processlist where user='root'; +evalp select user,db from information_schema.processlist where id=$default_id; --error ER_PROCACCESS_DENIED_ERROR call testdb.p1(); @@ -94,7 +95,7 @@ GRANT EXECUTE ON testdb.* to PUBLIC; disconnect testuser; connect (testuser,localhost,testuser,,); -select user,db from information_schema.processlist where user='root'; +evalp select user,db from information_schema.processlist where id=$default_id; call testdb.p1(); connection default; @@ -105,7 +106,7 @@ flush privileges; connect (testuser,localhost,testuser,,); -select user,db from information_schema.processlist where user='root'; +evalp select user,db from information_schema.processlist where id=$default_id; call testdb.p1(); connection default; From cf249cabe4f9c56ed17b37963457e7e5406d598d Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Sun, 19 Oct 2025 17:35:38 +0400 Subject: [PATCH 45/69] MDEV-37894 - main.show_check fails sporadically Test output was affected by incompletely closed preceding connections. Wait for connections to leave I_S.PROCESSLIST before issuing SHOW PROCESSLIST. --- mysql-test/main/show_check.test | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mysql-test/main/show_check.test b/mysql-test/main/show_check.test index 6ae839d8f16..73035a3c581 100644 --- a/mysql-test/main/show_check.test +++ b/mysql-test/main/show_check.test @@ -347,7 +347,6 @@ drop table t1; --error ER_DBACCESS_DENIED_ERROR drop database mysqltest; disconnect con1; ---source include/wait_until_disconnected.inc connect (con2,localhost,mysqltest_2,,"*NO-ONE*"); connection con2; @@ -360,7 +359,6 @@ drop table mysqltest.t1; --error ER_DBACCESS_DENIED_ERROR drop database mysqltest; disconnect con2; ---source include/wait_until_disconnected.inc connect (con3,localhost,mysqltest_3,,"*NO-ONE*"); connection con3; @@ -370,7 +368,6 @@ show create database mysqltest; drop table mysqltest.t1; drop database mysqltest; disconnect con3; ---source include/wait_until_disconnected.inc connection default; set names binary; @@ -1031,7 +1028,6 @@ connect (con4,localhost,mysqltest_4,,mysqltest); connection con4; show create database mysqltest; disconnect con4; ---source include/wait_until_disconnected.inc connection default; delete from mysql.user where user='mysqltest_4'; delete from mysql.db where user='mysqltest_4'; @@ -1267,7 +1263,6 @@ SHOW ENGINE MYISAM STATUS; --enable_result_log disconnect conn1; ---source include/wait_until_disconnected.inc connection default; DROP USER test_u@localhost; @@ -1291,7 +1286,6 @@ connection con1; SHOW CREATE TABLE t1; disconnect con1; ---source include/wait_until_disconnected.inc connection default; UNLOCK TABLES; @@ -1363,7 +1357,6 @@ connection con1; ALTER TABLE t1 CHARACTER SET = utf8; disconnect con1; ---source include/wait_until_disconnected.inc connection default; COMMIT; @@ -1375,6 +1368,9 @@ DROP TABLE t1; --echo # Bug#57306 SHOW PROCESSLIST does not display string literals well. --echo # +let $count_sessions= 1; +source include/wait_until_count_sessions.inc; + SET NAMES latin1; SELECT GET_LOCK('t', 1000); --connect (con1,localhost,root,,) @@ -1397,7 +1393,6 @@ SELECT RELEASE_LOCK('t'); --connection con1 --reap --disconnect con1 ---source include/wait_until_disconnected.inc --connection default SET NAMES latin1; From 9f64b2913fbb799212f5e43f763517bd275f3b46 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Wed, 3 Apr 2024 13:16:25 -0400 Subject: [PATCH 46/69] MDEV-32397, MDEV-32403 Crashes during join processing. Queries having the following form may cause a crash SELECT t1.a FROM ( SELECT a AS a1 FROM t1 ) dt JOIN t1 ON a1 LIKE EXISTS ( SELECT a + RAND () FROM t1 UNION SELECT a FROM t1); because the table t1 has some JOIN cleanup operations performed prematurely during the subselect. In this particular case, the presence of RAND() makes the subquery uncacheable, necessitating the need to execute the subquery multiple times during join record evaluation. Each time the subquery runs, it creates its own JOIN structure which has references to the table t1. When the subquery completes, JOIN::cleanup and functions called by it result in ha_end_keyread() being called on table t1. However, we are not done with table t1 because the upper level `select t1.a from...` query requires table t1 to be open. To solve this, we make the executor aware of when we're in subqueries like this and delay JOIN cleanup until the end of the query. --- mysql-test/main/subselect_union_rand.result | 13 ++++++++++ mysql-test/main/subselect_union_rand.test | 28 +++++++++++++++++++++ sql/sql_lex.cc | 14 +++++++++++ 3 files changed, 55 insertions(+) create mode 100644 mysql-test/main/subselect_union_rand.result create mode 100644 mysql-test/main/subselect_union_rand.test diff --git a/mysql-test/main/subselect_union_rand.result b/mysql-test/main/subselect_union_rand.result new file mode 100644 index 00000000000..95538522bc9 --- /dev/null +++ b/mysql-test/main/subselect_union_rand.result @@ -0,0 +1,13 @@ +CREATE TABLE t1 ( a double, key (a)) ; +INSERT INTO t1 VALUES (1),(2),(-3); +SELECT t1.a FROM ( SELECT a AS a1 FROM t1 ) dt +JOIN t1 ON a1 LIKE EXISTS ( SELECT a + RAND () FROM t1 UNION SELECT a FROM t1) ; +DROP TABLE t1; +CREATE TABLE t1 ( a VARCHAR(100), b bool) ; +INSERT INTO t1 VALUES ('-101',-87),('-95',59),(NULL,48); +SELECT +(SELECT 1 FROM (SELECT 1 HAVING rand() ) dt1 +UNION +SELECT a FROM t1 WHERE b IN (SELECT a FROM t1) LIMIT 1) +FROM t1; +DROP TABLE t1; diff --git a/mysql-test/main/subselect_union_rand.test b/mysql-test/main/subselect_union_rand.test new file mode 100644 index 00000000000..6e78f9ddcaf --- /dev/null +++ b/mysql-test/main/subselect_union_rand.test @@ -0,0 +1,28 @@ +# +# MDEV-32397 join_read_first, keyread SEGV crash +# +CREATE TABLE t1 ( a double, key (a)) ; +INSERT INTO t1 VALUES (1),(2),(-3); +# We disable the result log because RAND() is unpredictable and seeding RAND +# doesn't make it stable when using the PS protocol. +--disable_result_log +SELECT t1.a FROM ( SELECT a AS a1 FROM t1 ) dt +JOIN t1 ON a1 LIKE EXISTS ( SELECT a + RAND () FROM t1 UNION SELECT a FROM t1) ; +--enable_result_log +DROP TABLE t1; + +# +# MDEV-32403 test_if_quick_select: Segv +# +CREATE TABLE t1 ( a VARCHAR(100), b bool) ; +INSERT INTO t1 VALUES ('-101',-87),('-95',59),(NULL,48); +# We disable the result log because RAND() is unpredictable and seeding RAND +# doesn't make it stable when using the PS protocol. +--disable_result_log +SELECT + (SELECT 1 FROM (SELECT 1 HAVING rand() ) dt1 + UNION + SELECT a FROM t1 WHERE b IN (SELECT a FROM t1) LIMIT 1) +FROM t1; +--enable_result_log +DROP TABLE t1; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index e4c18c1a055..49e25e9c381 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -5071,6 +5071,20 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) if (empty_union_result) subquery_predicate->no_rows_in_result(); + /* + If any one SELECT in the subquery has UNCACHEABLE_RAND, then all + SELECTs should be marked as uncacheable. + */ + bool has_rand= false; + for (SELECT_LEX *sl= un->first_select(); sl && !has_rand; + sl= sl->next_select()) + has_rand= sl->uncacheable & UNCACHEABLE_RAND; + if (has_rand) + { + for (SELECT_LEX *sl= un->first_select(); sl; sl= sl->next_select()) + sl->uncacheable |= UNCACHEABLE_UNITED; + } + if (is_correlated_unit) { /* From 3c3f06cc2a68dee0f7b97c9a646a11a9ccac2b32 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 20 Oct 2025 15:37:15 +0200 Subject: [PATCH 47/69] libfmt 12.0 --- cmake/libfmt.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/libfmt.cmake b/cmake/libfmt.cmake index 47f2e00bae1..0eda394a4dc 100644 --- a/cmake/libfmt.cmake +++ b/cmake/libfmt.cmake @@ -15,8 +15,8 @@ MACRO(BUNDLE_LIBFMT) ExternalProject_Add( libfmt PREFIX "${dir}" - URL "https://github.com/fmtlib/fmt/releases/download/11.1.4/fmt-11.1.4.zip" - URL_MD5 ad6a56b15cddf4aad2a234e7cfc9e8c9 + URL "https://github.com/fmtlib/fmt/releases/download/12.0.0/fmt-12.0.0.zip" + URL_MD5 9bd04e6e8c5b1733e4eefb473604219d INSTALL_COMMAND "" CONFIGURE_COMMAND "" BUILD_COMMAND "" From 680b0cd866648dc9ca30198f70126f0d1c121c7c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 29 Apr 2025 19:15:24 +1000 Subject: [PATCH 48/69] MDEV-36721: remove PrivateDevices=false from systemd services The association between PrivateDevices=false and NoNewPrivileges as an old mistake in the kernel that has been now corrected. This was in 2019 via Debian bug #911152. --- support-files/mariadb.service.in | 4 ---- support-files/mariadb@.service.in | 4 ---- 2 files changed, 8 deletions(-) diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index c19e84a898d..0c72c1ee544 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -51,10 +51,6 @@ Group=mysql # These are enabled by default AmbientCapabilities=CAP_IPC_LOCK -# PrivateDevices=true implies NoNewPrivileges=true and -# SUID auth_pam_tool suddenly doesn't do setuid anymore -PrivateDevices=false - # Prevent writes to /usr, /boot, and /etc ProtectSystem=full diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 01859763eb0..3fd37c38862 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -181,10 +181,6 @@ PrivateNetwork=false # These are enabled by default AmbientCapabilities=CAP_IPC_LOCK -# PrivateDevices=true implies NoNewPrivileges=true and -# SUID auth_pam_tool suddenly doesn't do setuid anymore -PrivateDevices=false - # Prevent writes to /usr, /boot, and /etc ProtectSystem=full From 6ea2e998305b54fac1668e425a9373b0c4fd4f85 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 13 Oct 2025 12:36:45 +0400 Subject: [PATCH 49/69] MDEV-33190 Errors or assertion failure upon REPAIR on partitioned Aria table with misplaced rows. The ha_maria::repair() call leaves the MARIA_HA::cur_row::rowid filled after index-recreating scans. Should be emptied so consequent operations dont fail. --- mysql-test/suite/maria/partition.result | 15 +++++++++++ mysql-test/suite/maria/partition.test | 34 +++++++++++++++++++++++++ storage/maria/ha_maria.cc | 7 +++++ 3 files changed, 56 insertions(+) diff --git a/mysql-test/suite/maria/partition.result b/mysql-test/suite/maria/partition.result index 929c6bab22e..7e563a6b75f 100644 --- a/mysql-test/suite/maria/partition.result +++ b/mysql-test/suite/maria/partition.result @@ -2,3 +2,18 @@ CREATE TABLE t (a INT, KEY(a)) ENGINE=Aria PARTITION BY KEY(a) PARTITIONS 2; SELECT * FROM t PARTITION (p1); a DROP TABLE t; +CREATE TABLE t (a INT KEY) ENGINE=Aria PARTITION BY LIST (a) ( +PARTITION p0 VALUES IN (1,2), +PARTITION p1 VALUES IN (3,4) +); +CREATE TABLE t1 (a INT KEY) ENGINE=Aria; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (3); +Swap table t1 and partition p0 of table t. +FLUSH TABLES; +REPAIR TABLE t; +Table Op Msg_type Msg_text +test.t repair warning Moved 1 misplaced rows +test.t repair status OK +DROP TABLE t; +DROP TABLE t1; diff --git a/mysql-test/suite/maria/partition.test b/mysql-test/suite/maria/partition.test index 86f976a05e7..f206b6ca9e1 100644 --- a/mysql-test/suite/maria/partition.test +++ b/mysql-test/suite/maria/partition.test @@ -9,3 +9,37 @@ CREATE TABLE t (a INT, KEY(a)) ENGINE=Aria PARTITION BY KEY(a) PARTITIONS 2; SELECT * FROM t PARTITION (p1); DROP TABLE t; + + +# +# MDEV-33190 +# Errors or assertion failure upon REPAIR on partitioned Aria table with misplaced rows +# + +CREATE TABLE t (a INT KEY) ENGINE=Aria PARTITION BY LIST (a) ( + PARTITION p0 VALUES IN (1,2), + PARTITION p1 VALUES IN (3,4) +); + +CREATE TABLE t1 (a INT KEY) ENGINE=Aria; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (3); + +--echo Swap table t1 and partition p0 of table t. +FLUSH TABLES; +let $datadir=`select @@datadir`; + +move_file $datadir/test/t1.MAD $datadir/test/tmp.MAD; +move_file $datadir/test/t1.MAI $datadir/test/tmp.MAI; + +move_file $datadir/test/t#P#p0.MAD $datadir/test/t1.MAD; +move_file $datadir/test/t#P#p0.MAI $datadir/test/t1.MAI; + +move_file $datadir/test/tmp.MAD $datadir/test/t#P#p0.MAD; +move_file $datadir/test/tmp.MAI $datadir/test/t#P#p0.MAI; + +REPAIR TABLE t; + +DROP TABLE t; +DROP TABLE t1; + diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 5bedaf2e0c9..891c25a68a8 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1755,6 +1755,13 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) /* Set trid (needed if the table was moved from another system) */ share->state.create_trid= trnman_get_min_safe_trid(); } + + /* + Leaving not-zero value here leads to crash in the following + maria_delete() particularly when we execute REPAIR TABLE partitioned_t;. + */ + file->cur_row.trid= 0; + mysql_mutex_lock(&share->intern_lock); if (!error) { From f22b40aae1255e55a5e583f78935b440e72c4589 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 21 Oct 2025 10:51:37 +0530 Subject: [PATCH 50/69] MDEV-37423 Enforce innodb_ft_min_token_size > 0 to prevent unnecessary token indexing Problem: ======= By keeping innodb_ft_min_token_size = 0, InnoDB FTS does tokenization on empty string and tries to add the nullptr as token word. This leads to crash when we try to convert the token into lower case characters. Solution: ========= The minimum value of innodb_ft_min_token_size should be 1. It should be consistent with MYISAM and ARIA engine. --- mysql-test/suite/innodb_fts/r/misc_debug2.result | 6 +++++- mysql-test/suite/innodb_fts/t/misc_debug2.test | 4 ++++ mysql-test/suite/sys_vars/r/sysvars_innodb.result | 2 +- storage/innobase/handler/ha_innodb.cc | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/innodb_fts/r/misc_debug2.result b/mysql-test/suite/innodb_fts/r/misc_debug2.result index 9601e8fc82e..63e8710b3d5 100644 --- a/mysql-test/suite/innodb_fts/r/misc_debug2.result +++ b/mysql-test/suite/innodb_fts/r/misc_debug2.result @@ -1,10 +1,14 @@ call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded."); call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); +call mtr.add_suppression("\\[Warning\\] option 'innodb-ft-min-token-size': unsigned value 0 adjusted to 1"); CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; set debug_dbug="+d,fts_instrument_sync_request"; INSERT INTO mdev21563 VALUES('This is a test'); ALTER TABLE mdev21563 DISCARD TABLESPACE; -# restart +# restart: --innodb_ft_min_token_size=0 +SELECT @@global.innodb_ft_min_token_size; +@@global.innodb_ft_min_token_size +1 DROP TABLE mdev21563; # # MDEV-29342 Assertion failure in file que0que.cc line 728 diff --git a/mysql-test/suite/innodb_fts/t/misc_debug2.test b/mysql-test/suite/innodb_fts/t/misc_debug2.test index 946700e3229..5766beb5f50 100644 --- a/mysql-test/suite/innodb_fts/t/misc_debug2.test +++ b/mysql-test/suite/innodb_fts/t/misc_debug2.test @@ -3,12 +3,15 @@ --source include/not_embedded.inc call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded."); call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded."); +call mtr.add_suppression("\\[Warning\\] option 'innodb-ft-min-token-size': unsigned value 0 adjusted to 1"); CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB; set debug_dbug="+d,fts_instrument_sync_request"; INSERT INTO mdev21563 VALUES('This is a test'); ALTER TABLE mdev21563 DISCARD TABLESPACE; +--let $restart_parameters=--innodb_ft_min_token_size=0 --source include/restart_mysqld.inc +SELECT @@global.innodb_ft_min_token_size; DROP TABLE mdev21563; --echo # @@ -21,6 +24,7 @@ set debug_dbug="+d,fts_instrument_sync_request"; INSERT INTO t1 VALUES('test'); set debug_dbug=@save_dbug; INSERT INTO t1 VALUES('This is a fts issue'); +let $restart_parameters=; --source include/restart_mysqld.inc set debug_dbug="+d,fts_instrument_sync_request"; UPDATE t1 SET f1="mariadb"; diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index ca3038045a5..032dde519cf 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -841,7 +841,7 @@ DEFAULT_VALUE 3 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters -NUMERIC_MIN_VALUE 0 +NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 16 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 5767789fe63..19582b79b2e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19296,7 +19296,7 @@ static MYSQL_SYSVAR_SIZE_T(ft_result_cache_limit, fts_result_cache_limit, static MYSQL_SYSVAR_ULONG(ft_min_token_size, fts_min_token_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "InnoDB Fulltext search minimum token size in characters", - NULL, NULL, 3, 0, 16, 0); + NULL, NULL, 3, 1, 16, 0); static MYSQL_SYSVAR_ULONG(ft_max_token_size, fts_max_token_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, From ef3c577c5b58fc1bac7e5a389c4a668c2514738e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 15 Sep 2025 16:04:29 +0400 Subject: [PATCH 51/69] MDEV-20498 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed upon REBUILD PARTITION. Now ALTER TABLE DROP column for PARTITIONING columns can't be done INPLACE. --- mysql-test/main/partition.result | 18 +++++++++++++++ mysql-test/main/partition.test | 18 +++++++++++++++ sql/sql_partition.cc | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result index f6a656b581f..d02cd9b080d 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -2888,5 +2888,23 @@ a 1 DROP TABLE t1; # +# MDEV-20498 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed upon REBUILD PARTITION. +# ALTER TABLE DROP COLUMN, ADD COLUMN misplacing rows. +# +CREATE TABLE t1 (a INT) +PARTITION BY LIST (a) ( +PARTITION p0 VALUES IN (8), +PARTITION p1 VALUES IN (4,7,0), +PARTITION p2 VALUES IN (9,2,5), +PARTITION p3 VALUES IN (3,1,6)); +INSERT INTO t1 VALUES (8),(5),(4),(0); +ALTER TABLE t1 DROP a, ADD a INT NOT NULL DEFAULT 0, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +ALTER TABLE t1 DROP a, ADD a INT NOT NULL DEFAULT 0; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +DROP TABLE t1; +# # End of 10.6 tests # diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index 440a7a42971..ae1048dd002 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -3097,6 +3097,24 @@ INSERT INTO t1 VALUES (1),(2); SELECT * FROM t1 WHERE a LIKE '1'; DROP TABLE t1; +--echo # +--echo # MDEV-20498 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed upon REBUILD PARTITION. +--echo # ALTER TABLE DROP COLUMN, ADD COLUMN misplacing rows. +--echo # + +CREATE TABLE t1 (a INT) + PARTITION BY LIST (a) ( + PARTITION p0 VALUES IN (8), + PARTITION p1 VALUES IN (4,7,0), + PARTITION p2 VALUES IN (9,2,5), + PARTITION p3 VALUES IN (3,1,6)); +INSERT INTO t1 VALUES (8),(5),(4),(0); +--error ER_ALTER_OPERATION_NOT_SUPPORTED +ALTER TABLE t1 DROP a, ADD a INT NOT NULL DEFAULT 0, algorithm=inplace; +ALTER TABLE t1 DROP a, ADD a INT NOT NULL DEFAULT 0; +CHECK TABLE t1; +DROP TABLE t1; + --echo # --echo # End of 10.6 tests --echo # diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index fac986600b9..8abd6be7ff5 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4798,6 +4798,19 @@ static void check_datadir_altered_for_innodb(THD *thd, } +static bool check_name_in_fields(const Field * const *fields, const char *name) +{ + for (; *fields; fields++) + { + if (my_strcasecmp(system_charset_info, + (*fields)->field_name.str, name) == 0) + return TRUE; + } + + return FALSE; +} + + /* Prepare for ALTER TABLE of partition structure @@ -4847,6 +4860,31 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, DBUG_RETURN(TRUE); } + if (table->part_info && alter_info->partition_flags == 0 && + (alter_info->flags & ALTER_PARSER_DROP_COLUMN)) + { + List_iterator drop_it(alter_info->drop_list); + Alter_drop *drop; + + while ((drop= drop_it++)) + { + if (drop->type != Alter_drop::COLUMN) + continue; + + if (check_name_in_fields(table->part_info->part_field_array, + drop->name) || + check_name_in_fields(table->part_info->subpart_field_array, + drop->name)) + { + /* + The ALTER drops column used in partitioning expression. + That cannot be done INPLACE. + */ + *partition_changed= TRUE; + } + } + } + partition_info *alt_part_info= thd->lex->part_info; /* This variable is TRUE in very special case when we add only DEFAULT From f18dcfc74a740f5aba4603c3f01af27359a4cec1 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 14 Oct 2025 01:14:52 +0400 Subject: [PATCH 52/69] MDEV-20498 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed upon REBUILD PARTITION. Reorganise checks if it inserts rows from old partition into new that wasn't opened for reading. So rows that don't belong there will produce an error. --- mysql-test/main/partition.result | 13 +++++++++++++ mysql-test/main/partition.test | 26 ++++++++++++++++++++++++++ sql/ha_partition.cc | 12 ++++++++++-- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result index d02cd9b080d..df3adf10708 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -2906,5 +2906,18 @@ Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; # +# MDEV-20498 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed upon REBUILD PARTITION. +# ALTER TABLE REBUILD PARTITION crashed on misplaced rows. +# +CREATE TABLE mdev20498 (a INT) ENGINE=myisam PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0), PARTITION p1 VALUES IN (1)); +INSERT INTO mdev20498 values (0), (0), (1), (1); +FLUSH TABLES; +CALL mtr.add_suppression("corrupted: row in wrong partition:"); +ALTER TABLE mdev20498 REBUILD PARTITION p0; +ERROR HY000: Found a row in wrong partition (0 != 1) a:1 +ALTER TABLE mdev20498 REBUILD PARTITION p0, p1; +DROP TABLE mdev20498; +# # End of 10.6 tests # diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index ae1048dd002..da010991330 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -3115,6 +3115,32 @@ ALTER TABLE t1 DROP a, ADD a INT NOT NULL DEFAULT 0; CHECK TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-20498 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed upon REBUILD PARTITION. +--echo # ALTER TABLE REBUILD PARTITION crashed on misplaced rows. +--echo # + +CREATE TABLE mdev20498 (a INT) ENGINE=myisam PARTITION BY LIST (a) + (PARTITION p0 VALUES IN (0), PARTITION p1 VALUES IN (1)); +INSERT INTO mdev20498 values (0), (0), (1), (1); +FLUSH TABLES; + +let $datadir=`select @@datadir`; +CALL mtr.add_suppression("corrupted: row in wrong partition:"); + +move_file $datadir/test/mdev20498#P#p0.MYD $datadir/test//tmp.MYD; +move_file $datadir/test/mdev20498#P#p1.MYD $datadir/test/mdev20498#P#p0.MYD; +move_file $datadir/test/tmp.MYD $datadir/test/mdev20498#P#p1.MYD; + +move_file $datadir/test/mdev20498#P#p0.MYI $datadir/test/tmp.MYI; +move_file $datadir/test/mdev20498#P#p1.MYI $datadir/test/mdev20498#P#p0.MYI; +move_file $datadir/test/tmp.MYI $datadir/test/mdev20498#P#p1.MYI; + +--error ER_ROW_IN_WRONG_PARTITION +ALTER TABLE mdev20498 REBUILD PARTITION p0; +ALTER TABLE mdev20498 REBUILD PARTITION p0, p1; +DROP TABLE mdev20498; + --echo # --echo # End of 10.6 tests --echo # diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 52b4a3f4f78..7cfdb47a4a3 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2227,6 +2227,13 @@ int ha_partition::copy_partitions(ulonglong * const copied, } else { + if (m_new_file[new_part]->m_lock_type != F_WRLCK) + { + m_last_part= reorg_part; + m_err_rec= table->record[0]; + result= HA_ERR_ROW_IN_WRONG_PARTITION; + goto error; + } /* Copy record to new handler */ (*copied)++; DBUG_ASSERT(!m_new_file[new_part]->row_logging); @@ -10326,11 +10333,12 @@ void ha_partition::print_error(int error, myf errflag) } else if (error == HA_ERR_ROW_IN_WRONG_PARTITION) { - /* Should only happen on DELETE or UPDATE! */ + /* Should only happen on DELETE, UPDATE or REBUILD PARTITION! */ DBUG_ASSERT(thd_sql_command(thd) == SQLCOM_DELETE || thd_sql_command(thd) == SQLCOM_DELETE_MULTI || thd_sql_command(thd) == SQLCOM_UPDATE || - thd_sql_command(thd) == SQLCOM_UPDATE_MULTI); + thd_sql_command(thd) == SQLCOM_UPDATE_MULTI || + thd_sql_command(thd) == SQLCOM_ALTER_TABLE); DBUG_ASSERT(m_err_rec); if (m_err_rec) { From 13047cdc97b8bc8356875d1c8003a625651dffdb Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 22 Sep 2025 23:38:36 +0400 Subject: [PATCH 53/69] MDEV-26540 Spider: Assertion `inited==RND' failed in handler::ha_rnd_end on DELETE. The ha_partition::direct_delete_rows() only calls file->ha_rnd_init() if the rnd_seq is on. (that is when it's the first call to the direct_update_rows() with RND scan). So don't call the ::ha_rnd_end() if rnd_seq isn't set. --- sql/ha_partition.cc | 11 +++-- .../spider/bugfix/r/mdev_26540.result | 46 +++++++++++++++++++ .../spider/bugfix/t/mdev_26540.test | 35 ++++++++++++++ 3 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 7cfdb47a4a3..f2ef47a88c0 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -12171,10 +12171,13 @@ int ha_partition::direct_delete_rows(ha_rows *delete_rows_result) file->pre_direct_delete_rows() : file->ha_direct_delete_rows(&delete_rows)))) { - if (m_pre_calling) - file->ha_pre_rnd_end(); - else - file->ha_rnd_end(); + if (rnd_seq) + { + if (m_pre_calling) + file->ha_pre_rnd_end(); + else + file->ha_rnd_end(); + } DBUG_RETURN(error); } delete_rows_result+= delete_rows; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result new file mode 100644 index 00000000000..df6fb0aadb6 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result @@ -0,0 +1,46 @@ +for master_1 +for child2 +for child3 +SET spider_same_server_link=1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; +CREATE TABLE t2 (pk INT,c1 INT) ENGINE=Spider COMMENT='TABLE "st"' PARTITION BY LIST COLUMNS (c1) +(PARTITION p DEFAULT COMMENT='srv "d"' ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"'); +DELETE FROM t2 WHERE pk=2; +ERROR 42S22: Unknown column 'pk' in 'WHERE' +DROP TABLE t, t2; +CREATE TABLE t (c1 INT,c2 INT,c3 INT,c4 DATE,c5 DATE,c6 TIME,c7 TIME,c8 DATE,c9 DATE,c10 CHAR(1),c11 VARCHAR(1),KEY(c1),KEY(c3),KEY(c4),KEY(c6),KEY(c8),KEY(c10,c3)) ENGINE=Spider PARTITION BY LIST (c1) (PARTITION p VALUES IN (1,2)); +SHOW CREATE TABLE t; +Table Create Table +t CREATE TABLE `t` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` date DEFAULT NULL, + `c5` date DEFAULT NULL, + `c6` time DEFAULT NULL, + `c7` time DEFAULT NULL, + `c8` date DEFAULT NULL, + `c9` date DEFAULT NULL, + `c10` char(1) DEFAULT NULL, + `c11` varchar(1) DEFAULT NULL, + KEY `c1` (`c1`), + KEY `c3` (`c3`), + KEY `c4` (`c4`), + KEY `c6` (`c6`), + KEY `c8` (`c8`), + KEY `c10` (`c10`,`c3`) +) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci + PARTITION BY LIST (`c1`) +(PARTITION `p` VALUES IN (1,2) ENGINE = SPIDER) +Warnings: +Error 1429 Unable to connect to foreign data source: localhost +Error 1429 Unable to connect to foreign data source: localhost +DELETE FROM t; +ERROR HY000: Unable to connect to foreign data source: localhost +DROP TABLE t; +DROP SERVER srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test new file mode 100644 index 00000000000..c7cbc23998f --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test @@ -0,0 +1,35 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +--source include/have_innodb.inc +--source include/have_partition.inc + +SET spider_same_server_link=1; + +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE t (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; +CREATE TABLE t2 (pk INT,c1 INT) ENGINE=Spider COMMENT='TABLE "st"' PARTITION BY LIST COLUMNS (c1) + (PARTITION p DEFAULT COMMENT='srv "d"' ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t"'); +--error ER_BAD_FIELD_ERROR +DELETE FROM t2 WHERE pk=2; + +DROP TABLE t, t2; + +CREATE TABLE t (c1 INT,c2 INT,c3 INT,c4 DATE,c5 DATE,c6 TIME,c7 TIME,c8 DATE,c9 DATE,c10 CHAR(1),c11 VARCHAR(1),KEY(c1),KEY(c3),KEY(c4),KEY(c6),KEY(c8),KEY(c10,c3)) ENGINE=Spider PARTITION BY LIST (c1) (PARTITION p VALUES IN (1,2)); +SHOW CREATE TABLE t; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +DELETE FROM t; +DROP TABLE t; + +DROP SERVER srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log From aada4e213cf23383e89c0d668dbf45d2c2634ed8 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Fri, 26 Sep 2025 17:03:51 +0400 Subject: [PATCH 54/69] MDEV-31499 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult. Calculate prev_range when the polygon's border is met. Otherwise we can falsely mark polygon as a 'hole' which breaks the topology of the result. --- mysql-test/main/gis-precise.result | 10 ++++++++++ mysql-test/main/gis-precise.test | 10 ++++++++++ sql/gcalc_tools.cc | 1 + 3 files changed, 21 insertions(+) diff --git a/mysql-test/main/gis-precise.result b/mysql-test/main/gis-precise.result index ca1fa666530..4f79182eabb 100644 --- a/mysql-test/main/gis-precise.result +++ b/mysql-test/main/gis-precise.result @@ -860,3 +860,13 @@ TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10) SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10); TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10) 55878.5933759170 +# +# MDEV-31499 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult. +# +SELECT ST_NUMGEOMETRIES( +ST_INTERSECTION( +ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') )); +ST_NUMGEOMETRIES( +ST_INTERSECTION( +ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST +3 diff --git a/mysql-test/main/gis-precise.test b/mysql-test/main/gis-precise.test index e135bedc38d..aa72e672f63 100644 --- a/mysql-test/main/gis-precise.test +++ b/mysql-test/main/gis-precise.test @@ -476,3 +476,13 @@ set @zenica = ST_GeomFromText('POINT(17.907743 44.203438)'); set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)'); SELECT TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10); SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10); + + +--echo # +--echo # MDEV-31499 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult. +--echo # + +SELECT ST_NUMGEOMETRIES( + ST_INTERSECTION( + ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') )); + diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc index 25c80a7a796..62c42f087a0 100644 --- a/sql/gcalc_tools.cc +++ b/sql/gcalc_tools.cc @@ -928,6 +928,7 @@ int Gcalc_operation_reducer::count_slice(Gcalc_scan_iterator *si) { add_poly_border(1, cur_t, prev_state, events); prev_state^= 1; + prev_range= prev_state ? cur_t : 0; } if (!events->is_bottom()) { From f32dc93faafe81b466d14a5aab39b8ee04ae9ec5 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 20 Oct 2025 21:12:55 +0400 Subject: [PATCH 55/69] MDEV-20498 Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed upon REBUILD PARTITION. Subpartition field list can be NULL. So keep the function null-safe. --- sql/sql_partition.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 8abd6be7ff5..0ce869b2ac3 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4800,6 +4800,9 @@ static void check_datadir_altered_for_innodb(THD *thd, static bool check_name_in_fields(const Field * const *fields, const char *name) { + if (!fields) + return FALSE; + for (; *fields; fields++) { if (my_strcasecmp(system_charset_info, From bc80ce41ef2702ec9e9a912abf84063ea0170d21 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 20 Oct 2025 23:17:04 +0400 Subject: [PATCH 56/69] Keep --cursor-protocol happy. --- storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result | 3 --- storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result index df6fb0aadb6..38a39ffc66a 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26540.result @@ -34,9 +34,6 @@ t CREATE TABLE `t` ( ) ENGINE=SPIDER DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`c1`) (PARTITION `p` VALUES IN (1,2) ENGINE = SPIDER) -Warnings: -Error 1429 Unable to connect to foreign data source: localhost -Error 1429 Unable to connect to foreign data source: localhost DELETE FROM t; ERROR HY000: Unable to connect to foreign data source: localhost DROP TABLE t; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test index c7cbc23998f..e3c6ed17259 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26540.test @@ -20,10 +20,12 @@ DELETE FROM t2 WHERE pk=2; DROP TABLE t, t2; +--disable_warnings CREATE TABLE t (c1 INT,c2 INT,c3 INT,c4 DATE,c5 DATE,c6 TIME,c7 TIME,c8 DATE,c9 DATE,c10 CHAR(1),c11 VARCHAR(1),KEY(c1),KEY(c3),KEY(c4),KEY(c6),KEY(c8),KEY(c10,c3)) ENGINE=Spider PARTITION BY LIST (c1) (PARTITION p VALUES IN (1,2)); SHOW CREATE TABLE t; --error ER_CONNECT_TO_FOREIGN_DATA_SOURCE DELETE FROM t; +--enable_warnings DROP TABLE t; DROP SERVER srv; From b1ff40d98c54b865566055dbb3494a2ecca115a4 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 21 Oct 2025 00:30:15 +0400 Subject: [PATCH 57/69] Make --view-protocol happy. --- mysql-test/main/gis-precise.result | 6 ++---- mysql-test/main/gis-precise.test | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mysql-test/main/gis-precise.result b/mysql-test/main/gis-precise.result index 4f79182eabb..242fa2eb5ef 100644 --- a/mysql-test/main/gis-precise.result +++ b/mysql-test/main/gis-precise.result @@ -865,8 +865,6 @@ TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10) # SELECT ST_NUMGEOMETRIES( ST_INTERSECTION( -ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') )); -ST_NUMGEOMETRIES( -ST_INTERSECTION( -ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST +ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') )) as V; +V 3 diff --git a/mysql-test/main/gis-precise.test b/mysql-test/main/gis-precise.test index aa72e672f63..4f84589c999 100644 --- a/mysql-test/main/gis-precise.test +++ b/mysql-test/main/gis-precise.test @@ -484,5 +484,5 @@ SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10); SELECT ST_NUMGEOMETRIES( ST_INTERSECTION( - ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') )); + ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') )) as V; From 0195bafc401c4943c6c79e6c2d87420ed05ea6d4 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Thu, 18 Sep 2025 00:27:20 +0400 Subject: [PATCH 58/69] MDEV-31766 SIGSEGV in maria_rtree_split_page | maria_rtree_add_key. Raise an error when UPDATE with the bad spatial object. --- mysql-test/main/gis-rtree.result | 5 +++++ mysql-test/main/gis-rtree.test | 12 +++++++++++ .../innodb_gis/r/innodb_gis_rtree.result | 5 +++++ mysql-test/suite/maria/maria-gis-rtree.result | 5 +++++ mysql-test/suite/maria/maria-gis-rtree.test | 10 ++++++++++ storage/maria/ma_update.c | 20 ++++++++++++++----- 6 files changed, 52 insertions(+), 5 deletions(-) diff --git a/mysql-test/main/gis-rtree.result b/mysql-test/main/gis-rtree.result index 4ca50fcfd9a..7750e310899 100644 --- a/mysql-test/main/gis-rtree.result +++ b/mysql-test/main/gis-rtree.result @@ -1629,3 +1629,8 @@ DROP TABLE t1; # # End of 10.1 tests # +CREATE TABLE t1 (c POINT NOT NULL,SPATIAL (c)); +INSERT INTO t1 VALUES (ST_GEOMFROMTEXT ('POINT(1 0)')); +UPDATE t1 SET c=''; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +DROP TABLE t1; diff --git a/mysql-test/main/gis-rtree.test b/mysql-test/main/gis-rtree.test index c4ff77991e8..6451b7dc853 100644 --- a/mysql-test/main/gis-rtree.test +++ b/mysql-test/main/gis-rtree.test @@ -1010,3 +1010,15 @@ DROP TABLE t1; --echo # --echo # End of 10.1 tests --echo # + +# +# Bug #31766 SIGSEGV in maria_rtree_split_page | maria_rtree_add_key +# + +CREATE TABLE t1 (c POINT NOT NULL,SPATIAL (c)); +INSERT INTO t1 VALUES (ST_GEOMFROMTEXT ('POINT(1 0)')); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +UPDATE t1 SET c=''; +DROP TABLE t1; + + diff --git a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result index 4ca50fcfd9a..7750e310899 100644 --- a/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result +++ b/mysql-test/suite/innodb_gis/r/innodb_gis_rtree.result @@ -1629,3 +1629,8 @@ DROP TABLE t1; # # End of 10.1 tests # +CREATE TABLE t1 (c POINT NOT NULL,SPATIAL (c)); +INSERT INTO t1 VALUES (ST_GEOMFROMTEXT ('POINT(1 0)')); +UPDATE t1 SET c=''; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +DROP TABLE t1; diff --git a/mysql-test/suite/maria/maria-gis-rtree.result b/mysql-test/suite/maria/maria-gis-rtree.result index cf189d13415..02238fe9482 100644 --- a/mysql-test/suite/maria/maria-gis-rtree.result +++ b/mysql-test/suite/maria/maria-gis-rtree.result @@ -1484,3 +1484,8 @@ COUNT(*) 2 DROP TABLE t1; End of 5.0 tests. +CREATE TABLE t1 (c POINT NOT NULL,SPATIAL (c)); +INSERT INTO t1 VALUES (ST_GEOMFROMTEXT ('POINT(1 0)')); +UPDATE t1 SET c=''; +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +DROP TABLE t1; diff --git a/mysql-test/suite/maria/maria-gis-rtree.test b/mysql-test/suite/maria/maria-gis-rtree.test index 6c82108ecb0..946eeb61565 100644 --- a/mysql-test/suite/maria/maria-gis-rtree.test +++ b/mysql-test/suite/maria/maria-gis-rtree.test @@ -886,3 +886,13 @@ SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE DROP TABLE t1; --echo End of 5.0 tests. + +# +# Bug #31766 SIGSEGV in maria_rtree_split_page | maria_rtree_add_key +# + +CREATE TABLE t1 (c POINT NOT NULL,SPATIAL (c)); +INSERT INTO t1 VALUES (ST_GEOMFROMTEXT ('POINT(1 0)')); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +UPDATE t1 SET c=''; +DROP TABLE t1; diff --git a/storage/maria/ma_update.c b/storage/maria/ma_update.c index 60ab4452384..4c433047700 100644 --- a/storage/maria/ma_update.c +++ b/storage/maria/ma_update.c @@ -16,6 +16,7 @@ #include "ma_fulltext.h" #include "ma_rt_index.h" #include "trnman.h" +#include /** Update an old row in a MARIA table @@ -113,10 +114,19 @@ int maria_update(register MARIA_HA *info, const uchar *oldrec, { MARIA_KEY new_key, old_key; - (*keyinfo->make_key)(info,&new_key, i, new_key_buff, newrec, - pos, info->trn->trid); - (*keyinfo->make_key)(info,&old_key, i, old_key_buff, - oldrec, pos, info->cur_row.trid); + if (!(*keyinfo->make_key)(info,&new_key, i, new_key_buff, newrec, + pos, info->trn->trid)) + goto err; + + if (!(*keyinfo->make_key)(info,&old_key, i, old_key_buff, + oldrec, pos, info->cur_row.trid)) + { + /* + Can't make a key from the record from the table already. + Sholdn't happen normally. Table is corrupted. + */ + goto err; + } /* The above changed info->lastkey2. Inform maria_rnext_same(). */ info->update&= ~HA_STATE_RNEXT_SAME; @@ -204,7 +214,7 @@ err: save_errno= HA_ERR_INTERNAL_ERROR; /* Should never happen */ if (my_errno == HA_ERR_FOUND_DUPP_KEY || my_errno == HA_ERR_OUT_OF_MEM || - my_errno == HA_ERR_RECORD_FILE_FULL) + my_errno == HA_ERR_RECORD_FILE_FULL || my_errno == HA_ERR_NULL_IN_SPATIAL) { info->errkey= (int) i; flag=0; From 5a8cd03f0f3ae9fbcc3b6f33843d030d840f6e2f Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Mon, 20 Oct 2025 18:45:56 +1100 Subject: [PATCH 59/69] MDEV-37899 galera sst generates numerous selinux AVCs when starting From downstream bug RHEL-116757, the use of ss to map all the usage of ports to pids and process names under selinux is rather limited by the mysqld_exec_t limitations. The checking of the mapping is a bit excessive in a selinux environment where binding is limited. We replace the use of ss under selinux to raw reading of the /proc/tcp{,} interfaces of the linux that aren't selinux restricted. --- scripts/wsrep_sst_common.sh | 13 ++++++++++++- scripts/wsrep_sst_rsync.sh | 9 +++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index f23707c497a..db6415b5d1e 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1230,6 +1230,13 @@ check_sockets_utils() lsof_available=0 sockstat_available=0 ss_available=0 + raw_socket_check=0 + + if [ -n "$(commandex selinuxenabled)" ] && selinuxenabled; then + raw_socket_check=1 + wsrep_log_info "/proc/net/tcp{,6} is being used directly to avoid excessive selinux AVC notices" + return 0 + fi socket_utility="$(commandex ss)" if [ -n "$socket_utility" ]; then @@ -1298,7 +1305,11 @@ check_port() local rc=2 # ENOENT - if [ $ss_available -ne 0 ]; then + if [ $raw_socket_check -ne 0 ]; then + for key in $(awk -v p="$port" 'BEGIN { hex_port = sprintf(":%04X", p) } $2 ~ hex_port && $4 == "0A" { print $10 }' /proc/net/tcp /proc/net/tcp6); do + return 0 + done + elif [ $ss_available -ne 0 ]; then $socket_utility $ss_opts -t "( sport = :$port )" 2>/dev/null | \ grep -q -E "[[:space:]]users:[[:space:]]?\\(.*\\(\"($utils)[^[:space:]]*\"[^)]*,pid=$pid(,[^)]*)?\\)" && rc=0 elif [ $sockstat_available -ne 0 ]; then diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 361cef4a9fc..5b7efbf3b60 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -105,7 +105,9 @@ check_pid_and_port() local final if ! check_port $pid "$port" "$utils"; then - if [ $ss_available -ne 0 -o $sockstat_available -ne 0 ]; then + if [ $raw_socket_check -ne 0 ]; then + return 1 + elif [ $ss_available -ne 0 -o $sockstat_available -ne 0 ]; then if [ $ss_available -ne 0 ]; then port_info=$($socket_utility $ss_opts -t "( sport = :$port )" 2>/dev/null | \ grep -E '[[:space:]]users:[[:space:]]?\(' | \ @@ -163,7 +165,10 @@ check_pid_and_port() fi fi - check_pid "$pid_file" && [ $CHECK_PID -eq $pid ] + if [ $raw_socket_check -ne 0 ]; then + return 0 + fi + check_pid "$pid_file" && [ "$CHECK_PID" -eq "$pid" ] } get_binlog From 78ed44beb3ce41c8a6a47223d726a6d8e5644e5e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 15 Oct 2025 17:05:32 +0200 Subject: [PATCH 60/69] MDEV-37744 Table Charset Mismatch (Primary/Replica) via Event Events should use proper mysql_change_db() to configure the current database correctly, in particular to set the db_charset. --- mysql-test/main/events_2.result | 24 ++++++++++++++++++++++++ mysql-test/main/events_2.test | 23 +++++++++++++++++++++++ sql/event_data_objects.cc | 23 +++-------------------- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/mysql-test/main/events_2.result b/mysql-test/main/events_2.result index 1753fa41ad0..d7b3bd2c969 100644 --- a/mysql-test/main/events_2.result +++ b/mysql-test/main/events_2.result @@ -437,3 +437,27 @@ Warnings: Note 1544 Event execution time is in the past. Event has been disabled drop event event_35981; drop database events_test; +# +# MDEV-37744 Table Charset Mismatch (Primary/Replica) via Event +# +set global event_scheduler=1; +create schema andre default charset utf8mb4 collate utf8mb4_general_ci; +use andre; +create event daily_table_creation +on schedule every 1 day starts now() + interval 5 second do +create table andre_table ( +id int(11) not null auto_increment primary key, +col_1 varchar(50) not null +); +show create table andre_table; +Table Create Table +andre_table CREATE TABLE `andre_table` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `col_1` varchar(50) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci +set global event_scheduler=0; +drop event daily_table_creation; +drop schema andre; +use test; +# End of 10.11 tests diff --git a/mysql-test/main/events_2.test b/mysql-test/main/events_2.test index cd0d908b870..9385f5d356d 100644 --- a/mysql-test/main/events_2.test +++ b/mysql-test/main/events_2.test @@ -526,3 +526,26 @@ let $wait_condition= drop database events_test; --enable_service_connection + +--echo # +--echo # MDEV-37744 Table Charset Mismatch (Primary/Replica) via Event +--echo # +set global event_scheduler=1; +create schema andre default charset utf8mb4 collate utf8mb4_general_ci; +use andre; +create event daily_table_creation +on schedule every 1 day starts now() + interval 5 second do + create table andre_table ( + id int(11) not null auto_increment primary key, + col_1 varchar(50) not null + ); + +let $wait_condition= select count(*)= 1 from information_schema.tables where table_name = 'andre_table'; +source include/wait_condition.inc; +show create table andre_table; +set global event_scheduler=0; +drop event daily_table_creation; +drop schema andre; +use test; + +--echo # End of 10.11 tests diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 3486e76f19d..18fa9d43737 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -1371,30 +1371,13 @@ Event_job_data::execute(THD *thd, bool drop) wsrep_open(thd); wsrep_before_command(thd); #endif /* WITH_WSREP */ - /* - MySQL parser currently assumes that current database is either - present in THD or all names in all statements are fully specified. - And yet not fully specified names inside stored programs must be - be supported, even if the current database is not set: - CREATE PROCEDURE db1.p1() BEGIN CREATE TABLE t1; END// - -- in this example t1 should be always created in db1 and the statement - must parse even if there is no current database. - - To support this feature and still address the parser limitation, - we need to set the current database here. - We don't have to call mysql_change_db, since the checks performed - in it are unnecessary for the purpose of parsing, and - mysql_change_db will be invoked anyway later, to activate the - procedure database before it's executed. - */ - thd->set_db(&dbname); lex_start(thd); #ifndef NO_EMBEDDED_ACCESS_CHECKS - if (event_sctx.change_security_context(thd, - &definer_user, &definer_host, - &dbname, &save_sctx)) + if (event_sctx.change_security_context(thd, &definer_user, &definer_host, + &dbname, &save_sctx) || + mysql_change_db(thd, &dbname, false)) { sql_print_error("Event Scheduler: " "[%s].[%s.%s] execution failed, " From 58318518d25f698027e5e3045fd713128336a6d4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 16 Oct 2025 19:24:45 +0200 Subject: [PATCH 61/69] MDEV-37835 mysqli silently trims each json_arrayagg result to modulo 64KB Item_string was always using Type_handler_varchar, even though varchar only has 2 bytes for the length and Item_string can be longer. --- mysql-test/main/func_str.result | 6 ++++++ mysql-test/main/func_str.test | 8 ++++++++ sql/item.h | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index 7e7e64d9413..4c6c651ef4b 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -5628,4 +5628,10 @@ SET sql_mode=DEFAULT; select locate(1,2,NULL); locate(1,2,NULL) NULL +# +# MDEV-37835 mysqli silently trims each json_arrayagg result to modulo 64KB +# +select group_concat(v) from ( select '$a' as v union all select '$b' as v) t; +group_concat(v) +a...aaaaa,b...bbbbb # End of 10.11 tests diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 0c331d955c9..c43c405b2d4 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -2577,4 +2577,12 @@ SET sql_mode=DEFAULT; --echo # select locate(1,2,NULL); +--echo # +--echo # MDEV-37835 mysqli silently trims each json_arrayagg result to modulo 64KB +--echo # +let $a=`select repeat('a', 65540)`; +let $b=`select repeat('b', 65540)`; +replace_regex /a{65535}/a.../ /b{65535}/b.../; +evalp select group_concat(v) from ( select '$a' as v union all select '$b' as v) t; + --echo # End of 10.11 tests diff --git a/sql/item.h b/sql/item.h index 570c24bf041..0daa169d9c4 100644 --- a/sql/item.h +++ b/sql/item.h @@ -4896,7 +4896,7 @@ public: } int save_in_field(Field *field, bool no_conversions) override; const Type_handler *type_handler() const override - { return &type_handler_varchar; } + { return Type_handler::string_type_handler(max_length); } Item *clone_item(THD *thd) const override; Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override { From c604028de4667a9f078dbddab4420e86a6bb81fa Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 17 Oct 2025 13:29:16 +0200 Subject: [PATCH 62/69] mandatory plugins cannot be less mature than the server --- sql/sql_plugin.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 1239d165fc7..bc986386dfc 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1680,6 +1680,8 @@ int plugin_init(int *argc, char **argv, int flags) tmp.name.length= strlen(plugin->name); tmp.state= 0; tmp.load_option= mandatory ? PLUGIN_FORCE : PLUGIN_ON; + DBUG_ASSERT(!mandatory || + plugin_maturity_map[plugin->maturity] >= SERVER_MATURITY_LEVEL); for (i=0; i < array_elements(override_plugin_load_policy); i++) { From 57629c25816dfc553938e842fd02d2b5641d7d52 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 17 Oct 2025 17:51:21 +0200 Subject: [PATCH 63/69] MDEV-34744 server cannot load client plugins on Debian symlink client pligins into INSTALL_PLUGINDIR on Debian --- debian/mariadb-server.links | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 debian/mariadb-server.links diff --git a/debian/mariadb-server.links b/debian/mariadb-server.links new file mode 100644 index 00000000000..40b0b80a143 --- /dev/null +++ b/debian/mariadb-server.links @@ -0,0 +1,6 @@ +#!/usr/bin/dh-exec +usr/lib/${DEB_HOST_MULTIARCH}/libmariadb3/plugin/caching_sha2_password.so usr/lib/mysql/plugin/caching_sha2_password.so +usr/lib/${DEB_HOST_MULTIARCH}/libmariadb3/plugin/client_ed25519.so usr/lib/mysql/plugin/client_ed25519.so +usr/lib/${DEB_HOST_MULTIARCH}/libmariadb3/plugin/dialog.so usr/lib/mysql/plugin/dialog.so +usr/lib/${DEB_HOST_MULTIARCH}/libmariadb3/plugin/mysql_clear_password.so usr/lib/mysql/plugin/mysql_clear_password.so +usr/lib/${DEB_HOST_MULTIARCH}/libmariadb3/plugin/sha256_password.so usr/lib/mysql/plugin/sha256_password.so From cff68791de82243cde5d1aa11ba37a01fa86d5e6 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Fri, 10 Oct 2025 22:41:57 +0700 Subject: [PATCH 64/69] MDEV-30721: Assertion `fixed()' failed in Item_cond_and::val_bool() When processing a degenerate JTBM semi-join (a subquery that produces 0 or 1 rows), `execute_degenerate_jtbm_semi_join()` creates equality conditions and adds them to `eq_list`. These equalities are then merged with existing conditions via `and_new_conditions_to_optimized_cond()`, creating an `Item_cond_and`. When multiple conditions need to be combined, a new `Item_cond_and` is created and populated. However, this item was not fixed before being walked by the `is_simplified_cond_processor`, which calls `val_bool()` to check if the condition is a known constant. Calling `val_bool()` on an unfixed item triggers the assertion. Solution: Fix the newly created `Item_cond_and` immediately after it's populated ensuring it's ready for any subsequent operations including evaluation. --- mysql-test/main/subselect_mat.result | 11 +++++++++++ mysql-test/main/subselect_sj_mat.result | 11 +++++++++++ mysql-test/main/subselect_sj_mat.test | 17 +++++++++++++++++ sql/opt_subselect.cc | 5 +---- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result index f554b6f6786..b048dc54ab6 100644 --- a/mysql-test/main/subselect_mat.result +++ b/mysql-test/main/subselect_mat.result @@ -2744,6 +2744,17 @@ ORDER BY l_orderkey, l_linenumber; l_orderkey l_linenumber l_quantity DROP TABLE t1; # end of 10.6 tests +# +# MDEV-30721: Assertion `fixed()' failed in Item_cond_and::val_bool() +# with degenerate JTBM semi-join +# +CREATE TABLE t1 (c INT KEY); +INSERT INTO t1 (c) VALUES (0); +SELECT * FROM t1 WHERE (0,0) IN (SELECT MAX(c),MIN(c) FROM t1); +c +0 +DROP TABLE t1; +# end of 10.11 tests set @subselect_mat_test_optimizer_switch_value=null; set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off'; set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result index ed6a2a9ef57..3e30d3828e5 100644 --- a/mysql-test/main/subselect_sj_mat.result +++ b/mysql-test/main/subselect_sj_mat.result @@ -2786,3 +2786,14 @@ ORDER BY l_orderkey, l_linenumber; l_orderkey l_linenumber l_quantity DROP TABLE t1; # end of 10.6 tests +# +# MDEV-30721: Assertion `fixed()' failed in Item_cond_and::val_bool() +# with degenerate JTBM semi-join +# +CREATE TABLE t1 (c INT KEY); +INSERT INTO t1 (c) VALUES (0); +SELECT * FROM t1 WHERE (0,0) IN (SELECT MAX(c),MIN(c) FROM t1); +c +0 +DROP TABLE t1; +# end of 10.11 tests diff --git a/mysql-test/main/subselect_sj_mat.test b/mysql-test/main/subselect_sj_mat.test index 0222743d1e1..5bbd9d29b96 100644 --- a/mysql-test/main/subselect_sj_mat.test +++ b/mysql-test/main/subselect_sj_mat.test @@ -2456,3 +2456,20 @@ ORDER BY l_orderkey, l_linenumber; DROP TABLE t1; --echo # end of 10.6 tests + +--echo # +--echo # MDEV-30721: Assertion `fixed()' failed in Item_cond_and::val_bool() +--echo # with degenerate JTBM semi-join +--echo # + +CREATE TABLE t1 (c INT KEY); +INSERT INTO t1 (c) VALUES (0); + +# This query triggered an assertion because the Item_cond_and created +# during condition merging in and_new_conditions_to_optimized_cond() +# was evaluated before being fixed. +SELECT * FROM t1 WHERE (0,0) IN (SELECT MAX(c),MIN(c) FROM t1); + +DROP TABLE t1; + +--echo # end of 10.11 tests diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 5071c561a9b..3d8a6c08d2f 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -6138,7 +6138,7 @@ Item *and_new_conditions_to_optimized_cond(THD *thd, Item *cond, } } - if (!cond) + if (!cond || cond->fix_fields_if_needed(thd, &cond)) return NULL; if (*cond_eq) @@ -6171,9 +6171,6 @@ Item *and_new_conditions_to_optimized_cond(THD *thd, Item *cond, if (cond && is_simplified_cond) cond= cond->remove_eq_conds(thd, cond_value, true); - if (cond && cond->fix_fields_if_needed(thd, NULL)) - return NULL; - return cond; } From eb337a2b15cdea932a22cf5d1186fa2e449a3615 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 21 Oct 2025 11:25:18 +0200 Subject: [PATCH 65/69] columnstore 6.4.12-1 --- storage/columnstore/columnstore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/columnstore/columnstore b/storage/columnstore/columnstore index 5ba808d542e..746293c977f 160000 --- a/storage/columnstore/columnstore +++ b/storage/columnstore/columnstore @@ -1 +1 @@ -Subproject commit 5ba808d542e8552a4b3a868fce9e119623f366d7 +Subproject commit 746293c977f577a7d5a098a2c0770372ee880347 From 63c2826ba9e325019d09c445bfe80268a24274bc Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 21 Oct 2025 16:41:03 +0200 Subject: [PATCH 66/69] columnstore 25.10.1-1 --- storage/columnstore/columnstore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/columnstore/columnstore b/storage/columnstore/columnstore index f33e9ce86c7..22454e6eef5 160000 --- a/storage/columnstore/columnstore +++ b/storage/columnstore/columnstore @@ -1 +1 @@ -Subproject commit f33e9ce86c73f606dbef2d50cac8b92e393344ef +Subproject commit 22454e6eef5ba17c573f7602203e997c9331748d From b81aef5ec2e7d67d57b8a0123b573f3020add40e Mon Sep 17 00:00:00 2001 From: ParadoxV5 Date: Tue, 21 Oct 2025 15:22:00 -0600 Subject: [PATCH 67/69] MDEV-37908: Replace `perror` link with GitBook Replace the KB link in `extra/perror` (from MDEV-34168) with a computed GitBook docs link Reviewed-by: Daniel Black --- extra/perror.c | 7 ++++++- mysql-test/main/perror-win.result | 2 +- mysql-test/main/perror.result | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/extra/perror.c b/extra/perror.c index 4710b28035a..0cfb5b84dd0 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -360,8 +360,13 @@ int main(int argc,char *argv[]) { found= 1; if (verbose) + { + int hundred= code / 100; printf("MariaDB error code %3d (%s): %s\n" - "Learn more: https://mariadb.com/kb/en/e%3d/\n", code, name, msg, code); + "Learn more: https://mariadb.com/docs/server/reference/" + "error-codes/mariadb-error-codes-%d00-to-%d99/e%3d\n", + code, name, msg, hundred, hundred, code); + } else puts(msg); } diff --git a/mysql-test/main/perror-win.result b/mysql-test/main/perror-win.result index 696dd47b72d..d8e1352f4f6 100644 --- a/mysql-test/main/perror-win.result +++ b/mysql-test/main/perror-win.result @@ -3,6 +3,6 @@ Win32 error code 150: System trace information was not specified in your CONFIG. OS error code 23: Too many open files in system Win32 error code 23: Data error (cyclic redundancy check). MariaDB error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192T' for key %d -Learn more: https://mariadb.com/kb/en/e1062/ +Learn more: https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1000-to-1099/e1062 Win32 error code 1062: The service has not been started. Illegal error code: 30000 diff --git a/mysql-test/main/perror.result b/mysql-test/main/perror.result index a6293bda6d8..0cfcc16ff78 100644 --- a/mysql-test/main/perror.result +++ b/mysql-test/main/perror.result @@ -1,10 +1,10 @@ Illegal error code: 10000 MariaDB error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192T' for key %d -Learn more: https://mariadb.com/kb/en/e1062/ +Learn more: https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1000-to-1099/e1062 MariaDB error code 1408 (ER_STARTUP): %s: ready for connections. Version: '%s' socket: '%s' port: %d %s -Learn more: https://mariadb.com/kb/en/e1408/ +Learn more: https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1400-to-1499/e1408 MariaDB error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it! -Learn more: https://mariadb.com/kb/en/e1459/ +Learn more: https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1400-to-1499/e1459 MariaDB error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u) -Learn more: https://mariadb.com/kb/en/e1461/ +Learn more: https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1400-to-1499/e1461 From cd28452e630fa1ecbbfb82215f62a5a1b406a345 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Mon, 20 Oct 2025 12:00:32 +0530 Subject: [PATCH 68/69] MDEV-37864: mysql-test/mtr --cursor main.func_json fails Analysis: Maximum length of the field of the temorary table that cursor protocol uses is not enough, which it actually gets when we prepare the json_array_intersect() function and set the max length of the result. So even though the entire result is sent, only partial is actually copied because the field length is not enough. Fix: Have enough max_length. --- mysql-test/main/func_json.result | 10 ++++++++++ mysql-test/main/func_json.test | 6 ++++++ sql/item_jsonfunc.cc | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 9957fb3dd26..42e5963f82f 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -5297,4 +5297,14 @@ result SELECT ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ); ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ) 1.000000 +# +# MDEV-37864: mysql-test/mtr --cursor main.func_json fails +# +select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') from mysql.user; +json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] +[["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] # End of 11.4 Test diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 6219d7ac9c1..541d2c45ebc 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -4196,4 +4196,10 @@ SELECT json_array_intersect(@a,@b); select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') as result from mysql.user; SELECT ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ); +--echo # +--echo # MDEV-37864: mysql-test/mtr --cursor main.func_json fails +--echo # + +select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') from mysql.user; + --echo # End of 11.4 Test diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index ac9f5b57f4d..4a553136028 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -5501,8 +5501,8 @@ bool Item_func_json_array_intersect::prepare_json_and_create_hash(json_engine_t null_value= 1; } - max_length= (args[0]->max_length < args[1]->max_length) ? - args[0]->max_length : args[1]->max_length; + max_length= 2*(args[0]->max_length < args[1]->max_length ? + args[0]->max_length : args[1]->max_length); return false; } From 83df4a3c9e6208139731bb26c83504ff649ece05 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 24 Oct 2025 07:13:01 +1100 Subject: [PATCH 69/69] MDEV-37864: mysql-test/mtr --cursor main.func_json fails (postfix) Postfix to correct view-protocol --- mysql-test/main/func_json.result | 8 ++++---- mysql-test/main/func_json.test | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 42e5963f82f..27697e5c08e 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -5294,14 +5294,14 @@ result [["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] [["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] [["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] -SELECT ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ); -( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ) +SELECT ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ) as result; +result 1.000000 # # MDEV-37864: mysql-test/mtr --cursor main.func_json fails # -select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') from mysql.user; -json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') +select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') as result from mysql.user; +result [["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] [["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] [["2", "6"], ["3", "8"], ["4", "5"], ["1", "7"]] diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 541d2c45ebc..2ec2413ce63 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -4194,12 +4194,12 @@ SELECT json_array_intersect(@a,@b); --echo # MDEV-36809: json_array_intersect crashs when unused table ref provided --echo # select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') as result from mysql.user; -SELECT ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ); +SELECT ( WITH x AS ( WITH x ( x ) AS ( SELECT ( 1.000000 ) ) SELECT x FROM x ) SELECT * FROM x WHERE ( SELECT AVG ( x ) OVER ( ORDER BY JSON_ARRAY_INTERSECT ( '[["1", "7"], ["2", "6"], ["3", "8"]]' , '[["2","6"],["3","8"],["4","5"],["1","7"]]' ) ) FROM x ) ) as result; --echo # --echo # MDEV-37864: mysql-test/mtr --cursor main.func_json fails --echo # -select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') from mysql.user; +select json_array_intersect('[["1", "7"], ["2", "6"], ["4", "5"], ["3", "8"]]', '[["2","6"],["3","8"],["4","5"],["1","7"]]') as result from mysql.user; --echo # End of 11.4 Test